public TrackQueue(Playlist pl, int beginningIdx, PlaybackMode mode) : base(pl.TrackAmount) { Mode = mode; ListGUID = pl.GUID; Soundtracks = pl.Soundtracks; SetTrackQueue(pl.TrackAmount, beginningIdx, mode); }
private int[] GenerateTrackIndicesArray(int trackAmount, PlaybackMode mode) { if (mode == PlaybackMode.RandomSingle) { return new int[] { -1 } } ; bool isShuffleMode = mode == PlaybackMode.Shuffle || mode == PlaybackMode.ShuffleOnce; trackAmount = isShuffleMode ? trackAmount + 1 : trackAmount; int[] trackIndices = new int[trackAmount]; if (isShuffleMode) { for (int i = 0; i < trackAmount; i++) { trackIndices[i] = i - 1; } } else { for (int i = 0; i < trackAmount; i++) { trackIndices[i] = i; } } return(trackIndices); }
public void Simulate(PlaybackMode mode) { switch (mode) { case PlaybackMode.Pause: movementControl._velocity = ((MoveCommand)commands[lastComandIdx]).velocity; break; case PlaybackMode.PlayAndRecord: CutExcessCommands(); ExecuteOrRecord(); break; case PlaybackMode.FastForward: ResetInput(); ExecuteOrRecord(); break; case PlaybackMode.Rewind: TryUndoCommand(); break; } ResetInput(); }
// TODO: add a parameter: get prev/next private TrackInfo GetTrack(MusicPlayer player, Guid listGUID, int selectedTrackIndex = -1, PlaybackMode mode = PlaybackMode.None, bool selectNext = true) { if (lb_PlaylistMenu.Items.Count == 0) { throw new EmptyPlaylistException("No tracklist is avalible"); } try { // If no playlist is selected (user click btn_StartPlayback to play music) TracksViewModel tracksVM = lv_Playlist.DataContext as TracksViewModel; listGUID = (listGUID == Guid.Empty) ? tracksVM.TracklistGUID : listGUID; if (mode == PlaybackMode.None) { throw new Exception("Invalid playback mode"); } return(selectNext ? player.GetTrack(listGUID, selectedTrackIndex, mode) : player.GetPrevTrack(listGUID, selectedTrackIndex, mode)); } catch { throw; } }
public async Task <string> ReplayFromStorageAsync(PlaybackMode playbackMode, string playbackId) { var fileInfo = await DownloadFromStorageAsync(playbackId); switch (playbackMode) { case PlaybackMode.PlaybackReal: await WaitFor(fileInfo.ResponseTime); break; case PlaybackMode.PlaybackChaos: long min = fileInfo.ResponseTime; long max = 15000; long mean = (long)((max - fileInfo.ResponseTime) / 2.0); min = mean < min ? mean : min; max = max < mean ? mean : max; var rt = (long)RandomGaussian.NextInRange(min, mean, max); await WaitFor(rt); break; default: break; } return(fileInfo.BodyString); }
private void Update() { if (!IsSimulationActive()) { return; } if (Input.GetKeyDown(pauseToggleKey) || isTimeExceeded) { if (isTimeExceeded) { currentMode = PlaybackMode.Pause; } else { switch (currentMode) { case PlaybackMode.Pause: currentMode = PlaybackMode.PlayAndRecord; break; case PlaybackMode.PlayAndRecord: currentMode = PlaybackMode.Pause; break; } } } if (currentMode != PlaybackMode.PlayAndRecord) { ProcessKeys(); } }
/// <summary>Initializes a new instance of the /// <see cref="T:XNAnimation.Controllers.AnimationController" /> /// class. /// </summary> /// <param name="skeleton">The skeleton of the model to be animated</param> public AnimationController(SkinnedModelBoneCollection skeleton) { this.skeleton = skeleton; localBonePoses = new Pose[skeleton.Count]; skinnedBoneTransforms = new Matrix[skeleton.Count]; skeleton[0].CopyBindPoseTo(localBonePoses); time = TimeSpan.Zero; speed = 1.0f; loopEnabled = true; playbackMode = PlaybackMode.Forward; blendWeight = 1.0f; translationInterpolation = InterpolationMode.None; orientationInterpolation = InterpolationMode.None; scaleInterpolation = InterpolationMode.None; crossFadeEnabled = false; crossFadeInterpolationAmount = 0.0f; crossFadeTime = TimeSpan.Zero; crossFadeElapsedTime = TimeSpan.Zero; hasFinished = false; isPlaying = false; }
public Sound(string id, string soundName, SyncPoint startTime, SyncPoint endTime, PlaybackMode playbackMode, float volume, float pitch) : base(id, startTime, endTime) { this.Mode = playbackMode; this.Volume = volume; this.Pitch = pitch; this.SoundName = soundName; }
private void SetTrackQueue(int trackAmount, int beginningIdx, PlaybackMode mode) { this.Clear(); playedTrackAmount = 0; switch (mode) { case PlaybackMode.Default: _SetTrackQueue_Default(trackAmount, beginningIdx); playedTrackAmountLimit = trackAmount - beginningIdx; break; case PlaybackMode.RepeatList: _SetTrackQueue_RepeatList(trackAmount, beginningIdx); playedTrackAmountLimit = -1; break; case PlaybackMode.Shuffle: _SetTrackQueue_Shuffle(trackAmount, beginningIdx); playedTrackAmountLimit = -1; break; case PlaybackMode.ShuffleOnce: _SetTrackQueue_Shuffle(trackAmount, beginningIdx); playedTrackAmountLimit = trackAmount; break; case PlaybackMode.PlaySingle: case PlaybackMode.RepeatTrack: _SetTrackQueue_Single(trackAmount, beginningIdx); playedTrackAmountLimit = 1; break; case PlaybackMode.RandomSingle: _SetTrackQueue_RandomSingle(trackAmount, beginningIdx); playedTrackAmountLimit = 1; break; case PlaybackMode.SuffleFromNthTrack: if (beginningIdx > 0) { _SetTrackQueue_Default(beginningIdx, 0); playedTrackAmountLimit = beginningIdx; } else { // Specified track is the first track -> no song have to be played in order _SetTrackQueue_Shuffle(trackAmount, 0); playedTrackAmountLimit = -1; } break; default: break; } }
public void OpenVideo() { cams.Init(SourceVideo.VideoFile, out FirstFrame, out LastFrame); // cams.AddTestModels(); VideoLoadedEvent?.Invoke(FirstFrame, LastFrame); GotoFrame(FirstFrame); playbackMode = PlaybackMode.Step; }
void RecordVideoTick() { if (CurrentFrame + 1 > LastFrame) { /* at last frame, we are done recording */ playbackMode = PlaybackMode.Step; texRecorder.StopRecording(); return; } GotoNextFrame(); }
private void cmbPlaybackMode_SelectionChanged(object sender, SelectionChangedEventArgs e) { Playlist pl = cmbPlaylist.SelectedItem as Playlist; if (pl.TrackAmount == 0) { return; } PlaybackMode mode = (PlaybackMode)cmbPlaybackMode.SelectedItem; cmbTrackIndex.ItemsSource = GenerateTrackIndicesArray(pl.TrackAmount, mode); cmbTrackIndex.SelectedIndex = 0; }
private void PlaySoundtrack(Guid playlistGUID, int selectedTrackIndex = -1, PlaybackMode mode = PlaybackMode.None) { try { // Fire event to notify MainWindow that a track is selected and waiting to be played PlayTrackEvent(playlistGUID, selectedTrackIndex, mode); } catch { throw; } }
public TrackInfo GetPrevTrack(Guid listGuid, int selIdx, PlaybackMode mode) { TrackInfo prevTrack; int prevTrackIdx = trackQueue.Previous(out prevTrack); if (prevTrackIdx == -1) { prevTrack = trackQueue.Soundtracks[trackQueue[0]]; } else { prevTrack = trackQueue.Soundtracks[prevTrackIdx]; } return(prevTrack); }
public void ChangePlaybackMode() { int intMode = gameEngine.uiHandler.onlineOfflinePlaybackMode.value; if (intMode == 0) { gameEngine.uiHandler.switchPlaybackPlayer.gameObject.SetActive(true); gameEngine.uiHandler.OSCServerAddressInput.gameObject.SetActive(true); mode = PlaybackMode.Online; } else if (intMode == 1) { gameEngine.uiHandler.switchPlaybackPlayer.gameObject.SetActive(false); gameEngine.uiHandler.OSCServerAddressInput.gameObject.SetActive(false); mode = PlaybackMode.Offline; } }
// Default value of playlistName should be `null` so that music play can selected playlist automatically. public PlayTrackEventArgs(Guid listGUID, int trackIdx = -1, TrackInfo track = null, PlaybackMode mode = PlaybackMode.None, TrackStatus trackStatus = TrackStatus.None) { PlaylistGUID = (PlaylistGUID == null) ? Properties.Settings.Default.LastSelectedPlaylistGUID : listGUID; PrevTrack = null; CurrTrack = track; PrevTrackIndex = -1; CurrTrackIndex = trackIdx; PrevTrackStatus = TrackStatus.None; CurrTrackStatus = (trackStatus == TrackStatus.None) ? TrackStatus.None : trackStatus; PlaybackMode = (mode == PlaybackMode.None) ? (PlaybackMode)Properties.Settings.Default.PlaybackMode : mode; // Use TaskPlaybackMode as a global variable to handle PlayTrackEvent whether it comes from user-clicked or scheduler-triggered. Properties.Settings.Default.TaskPlaybackMode = (int)PlaybackMode; Properties.Settings.Default.Save(); }
private void ProcessKeys() { if (Input.GetKey(rewindKey)) { currentMode = PlaybackMode.Rewind; } if (!isTimeExceeded && Input.GetKey(forwardKey)) { currentMode = PlaybackMode.FastForward; } if (Input.GetKeyUp(rewindKey) || Input.GetKeyUp(forwardKey)) { currentMode = PlaybackMode.Pause; } isFastPlayBack = Input.GetKey(fastPlayBackKey); }
public TrackInfo GetTrack(Guid listGUID, int selIdx, PlaybackMode mode) { if (trackQueue == null) { Playlist pl = PlaylistCollection.GetDatabase().TrackLists.Find(x => x.GUID == listGUID); if (pl == null || pl.TrackAmount == 0) { throw new InvalidPlaylistException(string.Format("Given playlist \"{0}\" is invalid.", listGUID)); } trackQueue = new TrackQueue(pl, selIdx, mode); Properties.Settings.Default.TaskPlaylistGUID = listGUID; Properties.Settings.Default.Save(); } TrackInfo nextTrack; int nextTrackIdx = trackQueue.Next(out nextTrack); return(nextTrack); }
public Sound(string id, string soundName, SyncPoint startTime, SyncPoint endTime, PlaybackMode playbackMode, float volume) : this(id, soundName, startTime, endTime, playbackMode, volume, 1.0f) {}
public Sound(string id, string soundName, SyncPoint startTime, PlaybackMode playbackMode) : this(id, soundName, startTime, SyncPoint.Null, playbackMode, 1.0f) { }
public Sound(string id, string soundName, PlaybackMode playbackMode, float volume) : this(id, soundName, SyncPoint.Null, SyncPoint.Null, playbackMode, volume, 1.0f) { }
public Sound(string soundName, SyncPoint startTime, SyncPoint endTime, PlaybackMode playbackMode) : this("Sound" + Counter++, soundName, startTime, endTime, playbackMode, 1.0f) { }
public Sound(string soundName, SyncPoint startTime, PlaybackMode playbackMode, float volume) : this("Sound" + Counter++, soundName, startTime, SyncPoint.Null, playbackMode, volume, 1.0f) { }
public Sound(string soundName, PlaybackMode playbackMode) : this("Sound" + Counter++, soundName, SyncPoint.Null, SyncPoint.Null, playbackMode, 1.0f) { }
private void ShuffleButton_Click(object sender, RoutedEventArgs e) { ((Window.Current.Content as Frame).Content as MainPage).ShuffleButton_Click(null, null); NowMode = ((Window.Current.Content as Frame).Content as MainPage).NowMode; switch (NowMode) { case PlaybackMode.Normal: ShuffleButton.IsChecked = true; break; case PlaybackMode.Repeat: ShuffleButton.IsChecked = true; break; case PlaybackMode.RepeatSingle: ShuffleButton.IsChecked = false; break; case PlaybackMode.Shuffle: ShuffleButton.IsChecked = false; break; case PlaybackMode.ShuffleRepeat: ShuffleButton.IsChecked = false; break; default: break; } }
/// <summary> /// Called often. Allows us to handle any user input (gestures on screen) and/or game time related work - e.g. moving an animation character based on /// elapsed time since last called etc /// </summary> /// <param name='gameTime'> /// Allows you to monitor time passed since last draw /// </param> protected override void Update(GameTime gameTime) { if (this.playbackMode == PlaybackMode.Exiting) { return; } this.HandleInput(); if (this.canvasPlayback.DataAvailable == false) { this.playbackMode = PlaybackMode.Finished; this.playbackToolbox.SetPlayButtonDisabled(); } else if (this.playbackMode == PlaybackMode.Playing) { var touchPointCount = this.calculatePlaybackSpeed.TouchPointsToRender(this.playbackToolbox.PlaybackSpeed); var touchPoints = this.canvasPlayback.GetNextTouchPoints(touchPointCount); this.CanvasTouchPoints.AddRange(touchPoints); this.playbackToolbox.PlaybackProgressPercentage = this.canvasPlayback.PercentageRead; } base.Update(gameTime); }
public ForePlaybackChangedMessage(PlaybackMode mode) { DesiredPlaybackMode = mode; DesiredSongs = null; }
/// <summary> /// Creates the toolbox. /// </summary> /// <returns>The toolbox.</returns> protected override IToolBox CreateToolbox() { this.playbackToolbox = new PlaybackToolbox(this.ToolboxLayoutDefinition, this.GraphicsDisplay, this.DeviceScale); this.playbackToolbox.ExitSelected += (sender, e) => { if (this.playbackMode != PlaybackMode.Exiting) { this.playbackMode = PlaybackMode.Exiting; this.Exit(); } }; this.playbackToolbox.PauseSelected += (sender, e) => { if (this.playbackMode != PlaybackMode.Exiting && this.playbackMode != PlaybackMode.Finished) { this.playbackMode = PlaybackMode.Paused; } }; this.playbackToolbox.PlaySelected += (sender, e) => { if (this.playbackMode != PlaybackMode.Exiting && this.playbackMode != PlaybackMode.Finished) { this.playbackMode = PlaybackMode.Playing; } }; this.playbackToolbox.RestartSelected += (sender, e) => { if (this.playbackMode != PlaybackMode.Exiting) { this.canvasPlayback.Restart(); this.BlankRenderTarget(this.InMemoryCanvasRenderTarget); this.playbackMode = PlaybackMode.Playing; } }; return this.playbackToolbox; }
/// <summary> /// Forces the playback to pause. /// </summary> public void ForcePause() { if (this.playbackMode == PlaybackMode.Playing) { this.playbackMode = PlaybackMode.Paused; this.playbackToolbox.SetPlayButtonPaused(); } }
/// <summary> /// Plays the sound. /// </summary> /// <param name="playbackMode">The PlaybackMode.</param> public void Play(PlaybackMode playbackMode) { _playbackMode = playbackMode; _userStop = false; _audioBuffer.Play(); }
/// <summary> /// Plays the specified audio source. /// </summary> /// <param name="playbackMode">The PlaybackMode.</param> public void Play(PlaybackMode playbackMode) { _audioProvider.Play(playbackMode); }
private void RepeatButton_Click(object sender, RoutedEventArgs e) { var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); var t = (TextBlock)ToolTipService.GetToolTip(PlayPauseButton); ((Window.Current.Content as Frame).Content as MainPage).RepeatButton_Checked(null, null); NowMode = ((Window.Current.Content as Frame).Content as MainPage).NowMode; switch (NowMode) { case PlaybackMode.Normal: RepeatButton.IsChecked = true; (RepeatButton.FindName("RepeatSymbol") as SymbolIcon).Symbol = Symbol.RepeatAll; t.Text = loader.GetString("RepeatAllTip.Text"); break; case PlaybackMode.Repeat: RepeatButton.IsChecked = true; (RepeatButton.FindName("RepeatSymbol") as SymbolIcon).Symbol = Symbol.RepeatOne; t.Text = loader.GetString("RepeatOnceTip.Text"); break; case PlaybackMode.RepeatSingle: RepeatButton.IsChecked = false; (RepeatButton.FindName("RepeatSymbol") as SymbolIcon).Symbol = Symbol.RepeatAll; t.Text = loader.GetString("RepeatButtonTip.Text"); break; case PlaybackMode.Shuffle: RepeatButton.IsChecked = true; t.Text = loader.GetString("RepeatAllTip.Text"); break; case PlaybackMode.ShuffleRepeat: RepeatButton.IsChecked = true; (RepeatButton.FindName("RepeatSymbol") as SymbolIcon).Symbol = Symbol.RepeatOne; ShuffleButton.IsChecked = false; t.Text = loader.GetString("RepeatOnceTip.Text"); break; default: break; } }
/// <summary> /// Plays the sound. /// </summary> /// <param name="playbackMode">The PlaybackMode.</param> public void Play(PlaybackMode playbackMode) { _playbackMode = playbackMode; _waveOut.Play(); }
public void StartPlayback(Frame[] recordedFrames, PlaybackMode mode) { this.recordedFrames = recordedFrames; this.mode = mode; this.isPlaying = true; }