public static void Stop() { AppCore.CoreEnqueue(() => { AppCore.Stop(); }); }
/// <summary> /// プレイリストの指定したindex番目のトラックを再生する /// </summary> /// <param name="index"></param> public static void PlayPlaylistItem(int index) { AppCore.CoreEnqueue(() => { icache = index; AppCore.PlayPlaylistItem(index); }); }
/// <summary> /// キューのストリームを再生開始する /// </summary> private static void PlayQueuedStream() { lock (PrepareMutex) { // 再生するstreamが用意されているかどうかチェック if (PreparedStream == null) { Logger.Log("Playback Error"); Stop(); Controller._OnPlaybackErrorOccured(); AppCore.CoreEnqueue(() => { System.Threading.Thread.Sleep(500); Controller.NextTrack(); }); return; } if (PreparedStream is StopperInputStream) { Stop(); return; } if (IndexInPlaylist(PreparedStream.DatabaseFileName) == -1) { DisposePreparedStream(); PrepareNextStream(GetSuccTrackIndex()); PlayQueuedStream(); return; } // Output Streamを確認・再構築 try { EnsureOutputDevice(PreparedStream); } catch (Exception ex) { Logger.Error(ex); Stop(); Controller._OnPlaybackErrorOccured(); AppCore.CoreEnqueue(() => { System.Threading.Thread.Sleep(500); Controller.NextTrack(); }); return; } DisposeCurrentStream(); PreparedStream.Ready = true; CurrentStream = PreparedStream; OutputDevice.Resume(); PreparedStream = null; Pause = false; ElapsedTime = -1; Controller._OnTrackChange(Controller.Current.IndexInPlaylist); } }
public static void NextTrack() { Logger.Log("next Track"); AppCore.CoreEnqueue(() => { int i = (icache > 0 ? icache : Current.IndexInPlaylist); if (playbackOrder == Controller.PlaybackOrder.Track) { icache = (i + 1 >= PlaylistRowCount) ? 0 : i + 1; } else { icache = AppCore.GetSuccTrackIndex(); } AppCore.PlayPlaylistItem(icache); }); }
public static void SetRating(string[] filenames, int rate) { AppCore.CoreEnqueue(() => { using (var db = GetDBConnection()) { db.Exec("BEGIN;"); using (var stmt = db.Prepare("UPDATE list SET " + LibraryDBColumnTextMinimum.rating + " = ? WHERE " + LibraryDBColumnTextMinimum.file_name + " = ? ;")) { foreach (var file_name in filenames) { stmt.Bind(1, rate.ToString()); stmt.Bind(2, file_name); stmt.Evaluate(null); stmt.Reset(); AppCore.InvalidatePlaylistCache(file_name); } } db.Exec("COMMIT;"); } _PlaylistUpdated(null); }); }
public static void PrevTrack() { Logger.Log("prev Track"); AppCore.CoreEnqueue(() => { int i = (icache > 0 ? icache : Current.IndexInPlaylist); if (i == -1) { icache = 0; } else { if (Current.Position > 5) // 現在位置が5秒以内なら現在のトラックの頭に { icache = i; } else { icache = (i - 1 < 0) ? PlaylistRowCount - 1 : i - 1; } } AppCore.PlayPlaylistItem(icache); }); }