private void InitializeSpectrogramInternal(SpectrogramData spectrogram) { if (_spectrogram != null) return; _spectrogram = spectrogram; Invalidate(); }
///////////////////////////////////////////////// private void InitializeSpectrogram(SpectrogramData spectrogram) { if (_spectrogram != null) { _spectrogram.Dispose(); _spectrogram = null; Invalidate(); } if (spectrogram == null) return; if (spectrogram.IsLoaded) { InitializeSpectrogramInternal(spectrogram); } else { Task.Factory.StartNew(() => { spectrogram.Load(); BeginInvoke((Action)(() => { InitializeSpectrogramInternal(spectrogram); })); }); } }
// private void WaveformMouseWheel(object sender, MouseEventArgs e) // { // // The scroll wheel could work in theory without the waveform loaded (it would be // // just like dragging the slider, which does work without the waveform), but the // // code below doesn't support it, so bail out until someone feels like fixing it. // if (_wavePeaks == null) // return; // // if (ModifierKeys == Keys.Control) // { // if (e.Delta > 0) // ZoomIn(); // else // ZoomOut(); // // return; // } // // if (ModifierKeys == (Keys.Control | Keys.Shift)) // { // if (e.Delta > 0) // VerticalZoomIn(); // else // VerticalZoomOut(); // // return; // } // // int delta = e.Delta; // if (!MouseWheelScrollUpIsForward) // delta = delta * -1; // if (Locked) // { // OnPositionSelected.Invoke(this, new ParagraphEventArgs(_currentVideoPositionSeconds + (delta / 256.0), null)); // } // else // { // StartPositionSeconds += delta / 256.0; // if (_currentVideoPositionSeconds < StartPositionSeconds || _currentVideoPositionSeconds >= EndPositionSeconds) // OnPositionSelected.Invoke(this, new ParagraphEventArgs(StartPositionSeconds, null)); // } // } ///////////////////////////////////////////////// protected void InitializeSpectrogram(SpectrogramData spectrogram) { if (_spectrogram != null) { _spectrogram.Dispose(); _spectrogram = null; } if (spectrogram == null) return; if (spectrogram.IsLoaded) { InitializeSpectrogramInternal(spectrogram); } else { // Task.Factory.StartNew(() => // { // spectrogram.Load(); // BeginInvoke((Action)(() => // { // InitializeSpectrogramInternal(spectrogram); // })); // }); } }
protected void InitializeSpectrogramInternal(SpectrogramData spectrogram) { if (_spectrogram != null) return; _spectrogram = spectrogram; }
private void ReadWaveFile(string targetFile, int delayInMilliseconds) { labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingPeakFile; Refresh(); using (var waveFile = new WavePeakGenerator(targetFile)) { Peaks = waveFile.GeneratePeaks(delayInMilliseconds, _peakWaveFileName); if (Configuration.Settings.VideoControls.GenerateSpectrogram) { labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingSpectrogram; Refresh(); Spectrogram = waveFile.GenerateSpectrogram(delayInMilliseconds, _spectrogramDirectory); } } labelPleaseWait.Visible = false; }