private void LoadSpectrum(WavImagesPack pack, WaveForm waveForm, ViewOptions viewOptions) { var bitmap = spectrogram.MakeSpectrogram(waveForm, viewOptions); if (bitmap == null) { return; } pack.Spectrogram = bitmap; }
private void LoadWaveForm(WavImagesPack pack, WaveForm waveForm, int height, double yScale) { var bitmap = waveForm.DrawWaveform(height, waveformColor, yScale, waveForm.Path); if (bitmap == null) { return; } pack.WavImage = bitmap; }
private void LoadFrq(WavImagesPack pack, WaveForm waveForm, int height) { var frq = new Frq(); frq.Load(waveForm.Path); if (frq.Points != null) { var visualPoints = frq.CalculateVisualPoints(waveForm, height); var bitmap = frq.DrawPoints(visualPoints, height, waveForm.Path); if (bitmap == null) { return; } pack.Frq = bitmap; } }
public void Load(WaveForm waveForm, int height, WavImagesHash hash) { var hasImage = images.TryGetValue(waveForm, out var pack); if (!hasImage) { pack = new WavImagesPack(); } images.TryAdd(waveForm, pack); if (!waveForm.IsEnabled) { ClearWavformImages(waveForm); pack.IsLoading = false; pack.IsLoaded = false; Console.WriteLine($"ImagesLibrary: failed to load image {hash.Recline}"); OnImageLoaded(waveForm); return; } if (hash.Equals(waveForm.ImageHash) && pack.IsLoaded) { Console.WriteLine($"ImagesLibrary: image is already loaded {hash.Recline}"); OnImageLoaded(waveForm); return; } if (!hash.Equals(waveForm.ImageHash)) { ClearWavformImages(waveForm); images.TryAdd(waveForm, pack); } pack.IsLoading = true; pack.IsLoaded = false; Console.WriteLine($"ImagesLibrary: started load image {hash.Recline}"); LoadWaveForm(pack, waveForm, height, Settings.UserScaleY); LoadFrq(pack, waveForm, height); LoadSpectrum(pack, waveForm, ViewOptions); Console.WriteLine($"ImagesLibrary: finished load imag {hash.Recline}"); pack.IsLoading = false; pack.IsLoaded = true; OnImageLoaded(waveForm); }
public void RegisterWaveForm(WaveForm waveForm) { var pack = new WavImagesPack(); images.TryAdd(waveForm, pack); }