private void Play() { if (_targetSource == null) { return; } if ((_isPlaying)) { return; } _isPlaying = true; //Start from beginning if at end if (trackBar1.Value == _targetSource.NumFrames) { trackBar1.Value = 0; } //Seek buffer to current sample if (_buffer != null) { float sample = trackBar1.Value / _targetSource.FrameRate * _targetSource.Frequency; int s = (int)Math.Round(sample, 0); _buffer.Seek(s); } //Fill initial buffer RenderUpdate(null, null); btnPlay.Text = "Stop"; previewPanel1.btnLeft.Visible = previewPanel1.btnRight.Visible = false; //Begin playback if (_buffer != null) { _buffer.Play(); } _timer.Run(0, _targetSource.FrameRate); }
public void PlayAnim() { if (TargetAnimation == null || _maxFrame == 1) { return; } _playing = true; if (disableBonesWhenPlayingToolStripMenuItem.Checked) { if (RenderBones == false) { _bonesWereOff = true; } RenderBones = false; } EnableTransformEdit = false; if (_animFrame >= _maxFrame) //Reset anim { SetFrame(1); } if (_animFrame < _maxFrame) { pnlPlayback.btnPlay.Text = "Stop"; _timer.Run(0, (double)pnlPlayback.numFPS.Value); } else { if (disableBonesWhenPlayingToolStripMenuItem.Checked) { RenderBones = true; } _playing = false; } }
private void Play() { if (_targetSource == null) { return; } if ((_isPlaying)) { return; } _isPlaying = true; //Start from beginning if at end if (trackBar1.Value == _targetSource.NumFrames) { trackBar1.Value = 1; } btnPlay.Text = "Stop"; previewPanel1.btnLeft.Visible = previewPanel1.btnRight.Visible = false; if (_buffer != null) { //Seek buffer to current sample _buffer.Seek((int)Math.Round((trackBar1.Value - 1) / _targetSource.FrameRate * _targetSource.Frequency, 0)); //Fill initial buffer _buffer.Fill(); //Begin playback _buffer.Play(); } _timer.Run(0, _targetSource.FrameRate); }
public static void Run() { Playing = true; _timer.Run(0, FramesPerSecond); }