mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Working on waveform/spectrogram
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@460 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
c970c694a5
commit
cd9e9f25f8
@ -1088,11 +1088,23 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeSpectrogram(List<Bitmap> spectrumBitmaps, double sampleDuration, double totalDuration)
|
||||
public void InitializeSpectrogram(List<Bitmap> spectrumBitmaps, string spectrogramDirectory)
|
||||
{
|
||||
_spectrumBitmaps = spectrumBitmaps;
|
||||
_sampleDuration = sampleDuration;
|
||||
_totalDuration = totalDuration;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string xmlInfoFileName = System.IO.Path.Combine(spectrogramDirectory, "Info.xml");
|
||||
if (System.IO.File.Exists(xmlInfoFileName))
|
||||
{
|
||||
doc.Load(xmlInfoFileName);
|
||||
_sampleDuration = Convert.ToDouble(doc.DocumentElement.SelectSingleNode("SampleDuration").InnerText);
|
||||
_totalDuration = Convert.ToDouble(doc.DocumentElement.SelectSingleNode("TotalDuration").InnerText);
|
||||
ShowSpectrogram = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowSpectrogram = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSpectrogramBitmap(double seconds, Graphics graphics)
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
@ -12,6 +14,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private bool _cancel = false;
|
||||
private string _wavFileName = null;
|
||||
private string _spectrumDirectory;
|
||||
public List<Bitmap> SpectrumBitmaps { get; private set; }
|
||||
|
||||
public AddWareForm()
|
||||
{
|
||||
@ -135,7 +138,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelProgress.Text = Configuration.Settings.Language.AddWaveForm.GeneratingSpectrogram;
|
||||
this.Refresh();
|
||||
System.IO.Directory.CreateDirectory(_spectrumDirectory);
|
||||
waveFile.GenerateFourierData(256, _spectrumDirectory);
|
||||
SpectrumBitmaps = waveFile.GenerateFourierData(256, _spectrumDirectory);
|
||||
}
|
||||
labelPleaseWait.Visible = false;
|
||||
|
||||
|
@ -8430,6 +8430,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var audioPeakWave = new WavePeakGenerator(peakWaveFileName);
|
||||
audioPeakWave.GenerateAllSamples();
|
||||
AudioWaveForm.WavePeaks = audioPeakWave;
|
||||
if (addWaveForm.SpectrumBitmaps != null)
|
||||
AudioWaveForm.InitializeSpectrogram(addWaveForm.SpectrumBitmaps, spectrumFileName);
|
||||
timerWaveForm.Start();
|
||||
}
|
||||
}
|
||||
|
@ -684,7 +684,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAeABBgHgAQYBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAfABBgHwAQYBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
Loading…
Reference in New Issue
Block a user