/// <summary> /// プレイリストを生成する(スレッド) /// </summary> private void CreatePlaylistProc() { SetupConnection(); while (true) { try { CreatePlaylistRequest req; if (Request.QueryText == null) { Thread.Sleep(System.Threading.Timeout.Infinite); } //createPlaylistからinterruptが連続で発行されたとき、このsleep内で捕捉する Thread.Sleep(10); req = Request; Request = new CreatePlaylistRequest(); CreatePlaylistTableInDB(req.QueryText); Controller._PlaylistUpdated(req.IsReloadOnly ? null : req.QueryText); if (req.PlayOnCreate) { AppCore.PlayPlaylistItem(0); } } catch (ThreadInterruptedException) { } } }
/// <summary> /// プレイリストの指定したindex番目のトラックを再生する /// </summary> /// <param name="index"></param> public static void PlayPlaylistItem(int index) { AppCore.CoreEnqueue(() => { icache = index; AppCore.PlayPlaylistItem(index); }); }
public static bool QueueNext(int index) { if (IsPlaying) { return(AppCore.QueuePlaylistItem(index)); } else { return(AppCore.PlayPlaylistItem(index)); } }
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 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); }); }