mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Working on waveform/spectrogram
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@465 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
cce271875e
commit
87b6e781b2
@ -36,11 +36,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
private Subtitle _subtitle = null;
|
||||
private bool _noClear = false;
|
||||
|
||||
private List<Bitmap> _spectrumBitmaps = new List<Bitmap>();
|
||||
private List<Bitmap> _spectrogramBitmaps = new List<Bitmap>();
|
||||
private string _spectrogramDirectory;
|
||||
private double _sampleDuration = 0;
|
||||
private double _totalDuration = 0;
|
||||
private const int SpectrumBitmapWidth = 1024;
|
||||
private const int SpectrogramBitmapWidth = 1024;
|
||||
|
||||
public delegate void ParagraphChangedHandler(Paragraph paragraph);
|
||||
public event ParagraphChangedHandler OnNewSelectionRightClicked;
|
||||
@ -81,11 +81,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSpectrumAvailable
|
||||
public bool IsSpectrogramAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return _spectrumBitmaps != null && _spectrumBitmaps.Count > 0;
|
||||
return _spectrogramBitmaps != null && _spectrogramBitmaps.Count > 0;
|
||||
}
|
||||
}
|
||||
public bool ShowSpectrogram { get; set; }
|
||||
@ -162,7 +162,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
|
||||
public void ResetSpectrogram()
|
||||
{
|
||||
_spectrumBitmaps = new List<Bitmap>();
|
||||
_spectrogramBitmaps = new List<Bitmap>();
|
||||
}
|
||||
|
||||
public void ClearSelection()
|
||||
@ -282,7 +282,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
int x = 0;
|
||||
int y = Height / 2;
|
||||
|
||||
if (IsSpectrumAvailable && ShowSpectrogram)
|
||||
if (IsSpectrogramAvailable && ShowSpectrogram)
|
||||
{
|
||||
DrawSpectrogramBitmap(StartPositionSeconds, graphics);
|
||||
if (ShowWaveform)
|
||||
@ -1067,7 +1067,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
|
||||
public void InitializeSpectrogram(string spectrogramDirectory)
|
||||
{
|
||||
_spectrumBitmaps = new List<Bitmap>();
|
||||
_spectrogramBitmaps = new List<Bitmap>();
|
||||
ShowSpectrogram = false;
|
||||
if (System.IO.Directory.Exists(spectrogramDirectory))
|
||||
{
|
||||
@ -1094,14 +1094,14 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
while (System.IO.File.Exists(System.IO.Path.Combine(_spectrogramDirectory, count + ".gif")))
|
||||
{
|
||||
Bitmap bmp = new Bitmap(System.IO.Path.Combine(_spectrogramDirectory, count + ".gif"));
|
||||
_spectrumBitmaps.Add(bmp);
|
||||
_spectrogramBitmaps.Add(bmp);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeSpectrogram(List<Bitmap> spectrumBitmaps, string spectrogramDirectory)
|
||||
public void InitializeSpectrogram(List<Bitmap> spectrogramBitmaps, string spectrogramDirectory)
|
||||
{
|
||||
_spectrumBitmaps = spectrumBitmaps;
|
||||
_spectrogramBitmaps = spectrogramBitmaps;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string xmlInfoFileName = System.IO.Path.Combine(spectrogramDirectory, "Info.xml");
|
||||
@ -1127,19 +1127,19 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
Graphics gfx = Graphics.FromImage(bmpDestination);
|
||||
|
||||
double startRow = seconds / (_sampleDuration);
|
||||
int bitmapIndex = (int)(startRow / SpectrumBitmapWidth);
|
||||
int subtractValue = (int)startRow % SpectrumBitmapWidth;
|
||||
int bitmapIndex = (int)(startRow / SpectrogramBitmapWidth);
|
||||
int subtractValue = (int)startRow % SpectrogramBitmapWidth;
|
||||
|
||||
int i = 0;
|
||||
while (i * SpectrumBitmapWidth < width && i + bitmapIndex < _spectrumBitmaps.Count)
|
||||
while (i * SpectrogramBitmapWidth < width && i + bitmapIndex < _spectrogramBitmaps.Count)
|
||||
{
|
||||
var bmp = _spectrumBitmaps[i + bitmapIndex];
|
||||
var bmp = _spectrogramBitmaps[i + bitmapIndex];
|
||||
gfx.DrawImage(bmp, new Point(bmp.Width * i - subtractValue, 0));
|
||||
i++;
|
||||
}
|
||||
if (i + bitmapIndex < _spectrumBitmaps.Count && subtractValue > 0)
|
||||
if (i + bitmapIndex < _spectrogramBitmaps.Count && subtractValue > 0)
|
||||
{
|
||||
var bmp = _spectrumBitmaps[i + bitmapIndex];
|
||||
var bmp = _spectrogramBitmaps[i + bitmapIndex];
|
||||
gfx.DrawImage(bmp, new Point(bmp.Width * i - subtractValue, 0));
|
||||
i++;
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public string SourceVideoFileName { get; private set; }
|
||||
private bool _cancel = false;
|
||||
private string _wavFileName = null;
|
||||
private string _spectrumDirectory;
|
||||
public List<Bitmap> SpectrumBitmaps { get; private set; }
|
||||
private string _spectrogramDirectory;
|
||||
public List<Bitmap> SpectrogramBitmaps { get; private set; }
|
||||
|
||||
public AddWareForm()
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public WavePeakGenerator WavePeak { get; private set; }
|
||||
|
||||
public void Initialize(string videoFile, string spectrumDirectory)
|
||||
public void Initialize(string videoFile, string spectrogramDirectory)
|
||||
{
|
||||
Text = Configuration.Settings.Language.AddWaveForm.Title;
|
||||
buttonRipWave.Text = Configuration.Settings.Language.AddWaveForm.GenerateWaveFormData;
|
||||
@ -33,7 +33,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelVideoFileName.Text = videoFile;
|
||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||
labelSourcevideoFile.Text = Configuration.Settings.Language.AddWaveForm.SourceVideoFile;
|
||||
_spectrumDirectory = spectrumDirectory;
|
||||
_spectrogramDirectory = spectrogramDirectory;
|
||||
}
|
||||
|
||||
private void buttonRipWave_Click(object sender, EventArgs e)
|
||||
@ -137,8 +137,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
labelProgress.Text = Configuration.Settings.Language.AddWaveForm.GeneratingSpectrogram;
|
||||
this.Refresh();
|
||||
System.IO.Directory.CreateDirectory(_spectrumDirectory);
|
||||
SpectrumBitmaps = waveFile.GenerateFourierData(256, _spectrumDirectory);
|
||||
System.IO.Directory.CreateDirectory(_spectrogramDirectory);
|
||||
SpectrogramBitmaps = waveFile.GenerateFourierData(256, _spectrogramDirectory);
|
||||
}
|
||||
labelPleaseWait.Visible = false;
|
||||
|
||||
|
@ -7010,11 +7010,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelVideoInfo.Text = Path.GetFileName(fileName) + " " + videoInfo.Width + "x" + videoInfo.Height + " " + videoInfo.VideoCodec;
|
||||
|
||||
string peakWaveFileName = GetPeakWaveFileName(fileName);
|
||||
string spectrogramFolder = GetSpectrogramFolder(fileName);
|
||||
if (File.Exists(peakWaveFileName))
|
||||
{
|
||||
AudioWaveForm.WavePeaks = new WavePeakGenerator(peakWaveFileName);
|
||||
AudioWaveForm.ResetSpectrogram();
|
||||
AudioWaveForm.InitializeSpectrogram(peakWaveFileName.Substring(0, peakWaveFileName.Length-4));
|
||||
AudioWaveForm.InitializeSpectrogram(spectrogramFolder);
|
||||
toolStripComboBoxWaveForm_SelectedIndexChanged(null, null);
|
||||
AudioWaveForm.WavePeaks.GenerateAllSamples();
|
||||
AudioWaveForm.WavePeaks.Close();
|
||||
@ -8409,6 +8410,19 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return wavePeakName;
|
||||
}
|
||||
|
||||
private string GetSpectrogramFolder(string videoFileName)
|
||||
{
|
||||
string dir = Configuration.SpectrogramsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
FileInfo fi = new FileInfo(videoFileName);
|
||||
string name = Sha256Hash(Path.GetFileName(videoFileName) + fi.Length.ToString() + fi.CreationTimeUtc.ToShortDateString());
|
||||
name = name.Replace("=", string.Empty).Replace("/", string.Empty).Replace(",", string.Empty).Replace("?", string.Empty).Replace("*", string.Empty).Replace("+", string.Empty).Replace("\\", string.Empty);
|
||||
name = Path.Combine(dir, name);
|
||||
return name;
|
||||
}
|
||||
|
||||
private void AudioWaveForm_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AudioWaveForm.WavePeaks == null)
|
||||
@ -8422,16 +8436,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
AddWareForm addWaveForm = new AddWareForm();
|
||||
string peakWaveFileName = GetPeakWaveFileName(_videoFileName);
|
||||
string spectrumFileName = peakWaveFileName.Substring(0, peakWaveFileName.Length - 4);
|
||||
addWaveForm.Initialize(_videoFileName, spectrumFileName);
|
||||
string spectrogramFolder = GetSpectrogramFolder(_videoFileName);
|
||||
addWaveForm.Initialize(_videoFileName, spectrogramFolder);
|
||||
if (addWaveForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
addWaveForm.WavePeak.WritePeakSamples(peakWaveFileName);
|
||||
var audioPeakWave = new WavePeakGenerator(peakWaveFileName);
|
||||
audioPeakWave.GenerateAllSamples();
|
||||
AudioWaveForm.WavePeaks = audioPeakWave;
|
||||
if (addWaveForm.SpectrumBitmaps != null)
|
||||
AudioWaveForm.InitializeSpectrogram(addWaveForm.SpectrumBitmaps, spectrumFileName);
|
||||
if (addWaveForm.SpectrogramBitmaps != null)
|
||||
AudioWaveForm.InitializeSpectrogram(addWaveForm.SpectrogramBitmaps, spectrogramFolder);
|
||||
timerWaveForm.Start();
|
||||
}
|
||||
}
|
||||
@ -10261,7 +10275,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void contextMenuStripWaveForm_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (AudioWaveForm.IsSpectrumAvailable)
|
||||
if (AudioWaveForm.IsSpectrogramAvailable)
|
||||
{
|
||||
if (AudioWaveForm.ShowSpectrogram && AudioWaveForm.ShowWaveform)
|
||||
{
|
||||
|
125
src/Forms/Settings.Designer.cs
generated
125
src/Forms/Settings.Designer.cs
generated
@ -125,6 +125,8 @@
|
||||
this.radioButtonVideoPlayerDirectShow = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonVideoPlayerManagedDirectX = new System.Windows.Forms.RadioButton();
|
||||
this.tabPageWaveForm = new System.Windows.Forms.TabPage();
|
||||
this.groupBoxSpectrogram = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxGenerateSpectrogram = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.buttonWaveFormsFolderEmpty = new System.Windows.Forms.Button();
|
||||
this.labelWaveFormsFolderInfo = new System.Windows.Forms.Label();
|
||||
@ -210,8 +212,8 @@
|
||||
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
|
||||
this.fontDialogSSAStyle = new System.Windows.Forms.FontDialog();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.groupBoxSpectrogram = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxGenerateSpectrogram = new System.Windows.Forms.CheckBox();
|
||||
this.buttonSpectrogramsFolderEmpty = new System.Windows.Forms.Button();
|
||||
this.labelSpectrogramsFolderInfo = new System.Windows.Forms.Label();
|
||||
this.tabControlSettings.SuspendLayout();
|
||||
this.tabPageGenerel.SuspendLayout();
|
||||
this.groupBoxMiscellaneous.SuspendLayout();
|
||||
@ -233,6 +235,7 @@
|
||||
this.groupBoxVideoPlayerDefault.SuspendLayout();
|
||||
this.groupBoxVideoEngine.SuspendLayout();
|
||||
this.tabPageWaveForm.SuspendLayout();
|
||||
this.groupBoxSpectrogram.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBoxWaveFormAppearence.SuspendLayout();
|
||||
this.tabPageTools.SuspendLayout();
|
||||
@ -252,7 +255,6 @@
|
||||
this.groupBoxProxyAuthentication.SuspendLayout();
|
||||
this.tabPageShortcuts.SuspendLayout();
|
||||
this.groupBoxShortcuts.SuspendLayout();
|
||||
this.groupBoxSpectrogram.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonOK
|
||||
@ -355,7 +357,7 @@
|
||||
this.checkBoxPromptDeleteLines.AutoSize = true;
|
||||
this.checkBoxPromptDeleteLines.Location = new System.Drawing.Point(436, 319);
|
||||
this.checkBoxPromptDeleteLines.Name = "checkBoxPromptDeleteLines";
|
||||
this.checkBoxPromptDeleteLines.Size = new System.Drawing.Size(142, 17);
|
||||
this.checkBoxPromptDeleteLines.Size = new System.Drawing.Size(138, 17);
|
||||
this.checkBoxPromptDeleteLines.TabIndex = 40;
|
||||
this.checkBoxPromptDeleteLines.Text = "Prompt for deleting lines";
|
||||
this.checkBoxPromptDeleteLines.UseVisualStyleBackColor = true;
|
||||
@ -365,7 +367,7 @@
|
||||
this.checkBoxAutoWrapWhileTyping.AutoSize = true;
|
||||
this.checkBoxAutoWrapWhileTyping.Location = new System.Drawing.Point(193, 146);
|
||||
this.checkBoxAutoWrapWhileTyping.Name = "checkBoxAutoWrapWhileTyping";
|
||||
this.checkBoxAutoWrapWhileTyping.Size = new System.Drawing.Size(137, 17);
|
||||
this.checkBoxAutoWrapWhileTyping.Size = new System.Drawing.Size(132, 17);
|
||||
this.checkBoxAutoWrapWhileTyping.TabIndex = 4;
|
||||
this.checkBoxAutoWrapWhileTyping.Text = "Auto-wrap while typing";
|
||||
this.checkBoxAutoWrapWhileTyping.UseVisualStyleBackColor = true;
|
||||
@ -393,7 +395,7 @@
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.AutoSize = true;
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.Location = new System.Drawing.Point(436, 296);
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.Name = "checkBoxAllowEditOfOriginalSubtitle";
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.Size = new System.Drawing.Size(160, 17);
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.Size = new System.Drawing.Size(155, 17);
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.TabIndex = 24;
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.Text = "Allow edit of original subtitle";
|
||||
this.checkBoxAllowEditOfOriginalSubtitle.UseVisualStyleBackColor = true;
|
||||
@ -561,7 +563,7 @@
|
||||
this.checkBoxRememberWindowPosition.AutoSize = true;
|
||||
this.checkBoxRememberWindowPosition.Location = new System.Drawing.Point(436, 101);
|
||||
this.checkBoxRememberWindowPosition.Name = "checkBoxRememberWindowPosition";
|
||||
this.checkBoxRememberWindowPosition.Size = new System.Drawing.Size(223, 17);
|
||||
this.checkBoxRememberWindowPosition.Size = new System.Drawing.Size(222, 17);
|
||||
this.checkBoxRememberWindowPosition.TabIndex = 15;
|
||||
this.checkBoxRememberWindowPosition.Text = "Remember main window position and size";
|
||||
this.checkBoxRememberWindowPosition.UseVisualStyleBackColor = true;
|
||||
@ -608,7 +610,7 @@
|
||||
this.checkBoxStartInSourceView.AutoSize = true;
|
||||
this.checkBoxStartInSourceView.Location = new System.Drawing.Point(436, 124);
|
||||
this.checkBoxStartInSourceView.Name = "checkBoxStartInSourceView";
|
||||
this.checkBoxStartInSourceView.Size = new System.Drawing.Size(121, 17);
|
||||
this.checkBoxStartInSourceView.Size = new System.Drawing.Size(119, 17);
|
||||
this.checkBoxStartInSourceView.TabIndex = 16;
|
||||
this.checkBoxStartInSourceView.Text = "Start in source view";
|
||||
this.checkBoxStartInSourceView.UseVisualStyleBackColor = true;
|
||||
@ -618,7 +620,7 @@
|
||||
this.checkBoxReopenLastOpened.AutoSize = true;
|
||||
this.checkBoxReopenLastOpened.Location = new System.Drawing.Point(444, 52);
|
||||
this.checkBoxReopenLastOpened.Name = "checkBoxReopenLastOpened";
|
||||
this.checkBoxReopenLastOpened.Size = new System.Drawing.Size(145, 17);
|
||||
this.checkBoxReopenLastOpened.Size = new System.Drawing.Size(140, 17);
|
||||
this.checkBoxReopenLastOpened.TabIndex = 13;
|
||||
this.checkBoxReopenLastOpened.Text = "Start with last file loaded";
|
||||
this.checkBoxReopenLastOpened.UseVisualStyleBackColor = true;
|
||||
@ -628,7 +630,7 @@
|
||||
this.checkBoxRememberRecentFiles.AutoSize = true;
|
||||
this.checkBoxRememberRecentFiles.Location = new System.Drawing.Point(436, 28);
|
||||
this.checkBoxRememberRecentFiles.Name = "checkBoxRememberRecentFiles";
|
||||
this.checkBoxRememberRecentFiles.Size = new System.Drawing.Size(195, 17);
|
||||
this.checkBoxRememberRecentFiles.Size = new System.Drawing.Size(188, 17);
|
||||
this.checkBoxRememberRecentFiles.TabIndex = 12;
|
||||
this.checkBoxRememberRecentFiles.Text = "Remember recent files (for reopen)";
|
||||
this.checkBoxRememberRecentFiles.UseVisualStyleBackColor = true;
|
||||
@ -639,7 +641,7 @@
|
||||
this.checkBoxSubtitleFontBold.AutoSize = true;
|
||||
this.checkBoxSubtitleFontBold.Location = new System.Drawing.Point(193, 269);
|
||||
this.checkBoxSubtitleFontBold.Name = "checkBoxSubtitleFontBold";
|
||||
this.checkBoxSubtitleFontBold.Size = new System.Drawing.Size(46, 17);
|
||||
this.checkBoxSubtitleFontBold.Size = new System.Drawing.Size(47, 17);
|
||||
this.checkBoxSubtitleFontBold.TabIndex = 8;
|
||||
this.checkBoxSubtitleFontBold.Text = "Bold";
|
||||
this.checkBoxSubtitleFontBold.UseVisualStyleBackColor = true;
|
||||
@ -743,7 +745,7 @@
|
||||
this.checkBoxShowFrameRate.AutoSize = true;
|
||||
this.checkBoxShowFrameRate.Location = new System.Drawing.Point(16, 29);
|
||||
this.checkBoxShowFrameRate.Name = "checkBoxShowFrameRate";
|
||||
this.checkBoxShowFrameRate.Size = new System.Drawing.Size(154, 17);
|
||||
this.checkBoxShowFrameRate.Size = new System.Drawing.Size(149, 17);
|
||||
this.checkBoxShowFrameRate.TabIndex = 34;
|
||||
this.checkBoxShowFrameRate.Text = "Show frame rate in toolbar";
|
||||
this.checkBoxShowFrameRate.UseVisualStyleBackColor = true;
|
||||
@ -809,7 +811,7 @@
|
||||
this.checkBoxHelp.AutoSize = true;
|
||||
this.checkBoxHelp.Location = new System.Drawing.Point(596, 80);
|
||||
this.checkBoxHelp.Name = "checkBoxHelp";
|
||||
this.checkBoxHelp.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxHelp.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxHelp.TabIndex = 31;
|
||||
this.checkBoxHelp.Text = "Visible";
|
||||
this.checkBoxHelp.UseVisualStyleBackColor = true;
|
||||
@ -836,7 +838,7 @@
|
||||
this.checkBoxSettings.AutoSize = true;
|
||||
this.checkBoxSettings.Location = new System.Drawing.Point(532, 80);
|
||||
this.checkBoxSettings.Name = "checkBoxSettings";
|
||||
this.checkBoxSettings.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxSettings.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxSettings.TabIndex = 28;
|
||||
this.checkBoxSettings.Text = "Visible";
|
||||
this.checkBoxSettings.UseVisualStyleBackColor = true;
|
||||
@ -863,7 +865,7 @@
|
||||
this.checkBoxSpellCheck.AutoSize = true;
|
||||
this.checkBoxSpellCheck.Location = new System.Drawing.Point(464, 80);
|
||||
this.checkBoxSpellCheck.Name = "checkBoxSpellCheck";
|
||||
this.checkBoxSpellCheck.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxSpellCheck.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxSpellCheck.TabIndex = 26;
|
||||
this.checkBoxSpellCheck.Text = "Visible";
|
||||
this.checkBoxSpellCheck.UseVisualStyleBackColor = true;
|
||||
@ -890,7 +892,7 @@
|
||||
this.checkBoxVisualSync.AutoSize = true;
|
||||
this.checkBoxVisualSync.Location = new System.Drawing.Point(398, 80);
|
||||
this.checkBoxVisualSync.Name = "checkBoxVisualSync";
|
||||
this.checkBoxVisualSync.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxVisualSync.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxVisualSync.TabIndex = 19;
|
||||
this.checkBoxVisualSync.Text = "Visible";
|
||||
this.checkBoxVisualSync.UseVisualStyleBackColor = true;
|
||||
@ -917,7 +919,7 @@
|
||||
this.checkBoxReplace.AutoSize = true;
|
||||
this.checkBoxReplace.Location = new System.Drawing.Point(335, 80);
|
||||
this.checkBoxReplace.Name = "checkBoxReplace";
|
||||
this.checkBoxReplace.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxReplace.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxReplace.TabIndex = 16;
|
||||
this.checkBoxReplace.Text = "Visible";
|
||||
this.checkBoxReplace.UseVisualStyleBackColor = true;
|
||||
@ -944,7 +946,7 @@
|
||||
this.checkBoxToolbarFind.AutoSize = true;
|
||||
this.checkBoxToolbarFind.Location = new System.Drawing.Point(272, 80);
|
||||
this.checkBoxToolbarFind.Name = "checkBoxToolbarFind";
|
||||
this.checkBoxToolbarFind.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxToolbarFind.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxToolbarFind.TabIndex = 13;
|
||||
this.checkBoxToolbarFind.Text = "Visible";
|
||||
this.checkBoxToolbarFind.UseVisualStyleBackColor = true;
|
||||
@ -971,7 +973,7 @@
|
||||
this.checkBoxToolbarSaveAs.AutoSize = true;
|
||||
this.checkBoxToolbarSaveAs.Location = new System.Drawing.Point(209, 80);
|
||||
this.checkBoxToolbarSaveAs.Name = "checkBoxToolbarSaveAs";
|
||||
this.checkBoxToolbarSaveAs.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxToolbarSaveAs.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxToolbarSaveAs.TabIndex = 10;
|
||||
this.checkBoxToolbarSaveAs.Text = "Visible";
|
||||
this.checkBoxToolbarSaveAs.UseVisualStyleBackColor = true;
|
||||
@ -998,7 +1000,7 @@
|
||||
this.checkBoxToolbarSave.AutoSize = true;
|
||||
this.checkBoxToolbarSave.Location = new System.Drawing.Point(146, 80);
|
||||
this.checkBoxToolbarSave.Name = "checkBoxToolbarSave";
|
||||
this.checkBoxToolbarSave.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxToolbarSave.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxToolbarSave.TabIndex = 7;
|
||||
this.checkBoxToolbarSave.Text = "Visible";
|
||||
this.checkBoxToolbarSave.UseVisualStyleBackColor = true;
|
||||
@ -1025,7 +1027,7 @@
|
||||
this.checkBoxToolbarOpen.AutoSize = true;
|
||||
this.checkBoxToolbarOpen.Location = new System.Drawing.Point(83, 80);
|
||||
this.checkBoxToolbarOpen.Name = "checkBoxToolbarOpen";
|
||||
this.checkBoxToolbarOpen.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxToolbarOpen.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxToolbarOpen.TabIndex = 4;
|
||||
this.checkBoxToolbarOpen.Text = "Visible";
|
||||
this.checkBoxToolbarOpen.UseVisualStyleBackColor = true;
|
||||
@ -1052,7 +1054,7 @@
|
||||
this.checkBoxToolbarNew.AutoSize = true;
|
||||
this.checkBoxToolbarNew.Location = new System.Drawing.Point(20, 80);
|
||||
this.checkBoxToolbarNew.Name = "checkBoxToolbarNew";
|
||||
this.checkBoxToolbarNew.Size = new System.Drawing.Size(55, 17);
|
||||
this.checkBoxToolbarNew.Size = new System.Drawing.Size(56, 17);
|
||||
this.checkBoxToolbarNew.TabIndex = 1;
|
||||
this.checkBoxToolbarNew.Text = "Visible";
|
||||
this.checkBoxToolbarNew.UseVisualStyleBackColor = true;
|
||||
@ -1163,7 +1165,7 @@
|
||||
this.checkBoxVideoPlayerShowStopButton.AutoSize = true;
|
||||
this.checkBoxVideoPlayerShowStopButton.Location = new System.Drawing.Point(9, 19);
|
||||
this.checkBoxVideoPlayerShowStopButton.Name = "checkBoxVideoPlayerShowStopButton";
|
||||
this.checkBoxVideoPlayerShowStopButton.Size = new System.Drawing.Size(111, 17);
|
||||
this.checkBoxVideoPlayerShowStopButton.Size = new System.Drawing.Size(109, 17);
|
||||
this.checkBoxVideoPlayerShowStopButton.TabIndex = 10;
|
||||
this.checkBoxVideoPlayerShowStopButton.Text = "Show stop button";
|
||||
this.checkBoxVideoPlayerShowStopButton.UseVisualStyleBackColor = true;
|
||||
@ -1230,7 +1232,7 @@
|
||||
this.radioButtonVideoPlayerVLC.AutoSize = true;
|
||||
this.radioButtonVideoPlayerVLC.Location = new System.Drawing.Point(10, 46);
|
||||
this.radioButtonVideoPlayerVLC.Name = "radioButtonVideoPlayerVLC";
|
||||
this.radioButtonVideoPlayerVLC.Size = new System.Drawing.Size(43, 17);
|
||||
this.radioButtonVideoPlayerVLC.Size = new System.Drawing.Size(45, 17);
|
||||
this.radioButtonVideoPlayerVLC.TabIndex = 4;
|
||||
this.radioButtonVideoPlayerVLC.TabStop = true;
|
||||
this.radioButtonVideoPlayerVLC.Text = "VLC";
|
||||
@ -1286,7 +1288,7 @@
|
||||
this.radioButtonVideoPlayerDirectShow.AutoSize = true;
|
||||
this.radioButtonVideoPlayerDirectShow.Location = new System.Drawing.Point(10, 23);
|
||||
this.radioButtonVideoPlayerDirectShow.Name = "radioButtonVideoPlayerDirectShow";
|
||||
this.radioButtonVideoPlayerDirectShow.Size = new System.Drawing.Size(82, 17);
|
||||
this.radioButtonVideoPlayerDirectShow.Size = new System.Drawing.Size(83, 17);
|
||||
this.radioButtonVideoPlayerDirectShow.TabIndex = 1;
|
||||
this.radioButtonVideoPlayerDirectShow.TabStop = true;
|
||||
this.radioButtonVideoPlayerDirectShow.Text = "DirectShow ";
|
||||
@ -1297,7 +1299,7 @@
|
||||
this.radioButtonVideoPlayerManagedDirectX.AutoSize = true;
|
||||
this.radioButtonVideoPlayerManagedDirectX.Location = new System.Drawing.Point(10, 90);
|
||||
this.radioButtonVideoPlayerManagedDirectX.Name = "radioButtonVideoPlayerManagedDirectX";
|
||||
this.radioButtonVideoPlayerManagedDirectX.Size = new System.Drawing.Size(106, 17);
|
||||
this.radioButtonVideoPlayerManagedDirectX.Size = new System.Drawing.Size(108, 17);
|
||||
this.radioButtonVideoPlayerManagedDirectX.TabIndex = 6;
|
||||
this.radioButtonVideoPlayerManagedDirectX.TabStop = true;
|
||||
this.radioButtonVideoPlayerManagedDirectX.Text = "Managed DirectX";
|
||||
@ -1316,8 +1318,30 @@
|
||||
this.tabPageWaveForm.Text = "Waveform/spectrogram";
|
||||
this.tabPageWaveForm.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBoxSpectrogram
|
||||
//
|
||||
this.groupBoxSpectrogram.Controls.Add(this.checkBoxGenerateSpectrogram);
|
||||
this.groupBoxSpectrogram.Location = new System.Drawing.Point(6, 216);
|
||||
this.groupBoxSpectrogram.Name = "groupBoxSpectrogram";
|
||||
this.groupBoxSpectrogram.Size = new System.Drawing.Size(786, 103);
|
||||
this.groupBoxSpectrogram.TabIndex = 4;
|
||||
this.groupBoxSpectrogram.TabStop = false;
|
||||
this.groupBoxSpectrogram.Text = "Spectrogram";
|
||||
//
|
||||
// checkBoxGenerateSpectrogram
|
||||
//
|
||||
this.checkBoxGenerateSpectrogram.AutoSize = true;
|
||||
this.checkBoxGenerateSpectrogram.Location = new System.Drawing.Point(10, 20);
|
||||
this.checkBoxGenerateSpectrogram.Name = "checkBoxGenerateSpectrogram";
|
||||
this.checkBoxGenerateSpectrogram.Size = new System.Drawing.Size(131, 17);
|
||||
this.checkBoxGenerateSpectrogram.TabIndex = 11;
|
||||
this.checkBoxGenerateSpectrogram.Text = "Generate spectrogram";
|
||||
this.checkBoxGenerateSpectrogram.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.buttonSpectrogramsFolderEmpty);
|
||||
this.groupBox1.Controls.Add(this.labelSpectrogramsFolderInfo);
|
||||
this.groupBox1.Controls.Add(this.buttonWaveFormsFolderEmpty);
|
||||
this.groupBox1.Controls.Add(this.labelWaveFormsFolderInfo);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 325);
|
||||
@ -1498,7 +1522,7 @@
|
||||
this.checkBoxSpellCheckAutoChangeNames.AutoSize = true;
|
||||
this.checkBoxSpellCheckAutoChangeNames.Location = new System.Drawing.Point(15, 20);
|
||||
this.checkBoxSpellCheckAutoChangeNames.Name = "checkBoxSpellCheckAutoChangeNames";
|
||||
this.checkBoxSpellCheckAutoChangeNames.Size = new System.Drawing.Size(216, 17);
|
||||
this.checkBoxSpellCheckAutoChangeNames.Size = new System.Drawing.Size(209, 17);
|
||||
this.checkBoxSpellCheckAutoChangeNames.TabIndex = 0;
|
||||
this.checkBoxSpellCheckAutoChangeNames.Text = "Auto fix names where only casing differ";
|
||||
this.checkBoxSpellCheckAutoChangeNames.UseVisualStyleBackColor = true;
|
||||
@ -1522,7 +1546,7 @@
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.AutoSize = true;
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.Location = new System.Drawing.Point(15, 115);
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.Name = "checkBoxFixCommonOcrErrorsUsingHardcodedRules";
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.Size = new System.Drawing.Size(268, 17);
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.Size = new System.Drawing.Size(264, 17);
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.TabIndex = 2;
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.Text = "Fix common OCR errors - also use hardcoded rules";
|
||||
this.checkBoxFixCommonOcrErrorsUsingHardcodedRules.UseVisualStyleBackColor = true;
|
||||
@ -1805,7 +1829,7 @@
|
||||
this.checkBoxNamesEtcOnline.AutoSize = true;
|
||||
this.checkBoxNamesEtcOnline.Location = new System.Drawing.Point(7, 22);
|
||||
this.checkBoxNamesEtcOnline.Name = "checkBoxNamesEtcOnline";
|
||||
this.checkBoxNamesEtcOnline.Size = new System.Drawing.Size(163, 17);
|
||||
this.checkBoxNamesEtcOnline.Size = new System.Drawing.Size(162, 17);
|
||||
this.checkBoxNamesEtcOnline.TabIndex = 26;
|
||||
this.checkBoxNamesEtcOnline.Text = "Use online names etc xml file";
|
||||
this.checkBoxNamesEtcOnline.UseVisualStyleBackColor = true;
|
||||
@ -2189,7 +2213,7 @@
|
||||
this.checkBoxShortcutsShift.Enabled = false;
|
||||
this.checkBoxShortcutsShift.Location = new System.Drawing.Point(243, 366);
|
||||
this.checkBoxShortcutsShift.Name = "checkBoxShortcutsShift";
|
||||
this.checkBoxShortcutsShift.Size = new System.Drawing.Size(48, 17);
|
||||
this.checkBoxShortcutsShift.Size = new System.Drawing.Size(47, 17);
|
||||
this.checkBoxShortcutsShift.TabIndex = 3;
|
||||
this.checkBoxShortcutsShift.Text = "Shift";
|
||||
this.checkBoxShortcutsShift.UseVisualStyleBackColor = true;
|
||||
@ -2200,7 +2224,7 @@
|
||||
this.checkBoxShortcutsAlt.Enabled = false;
|
||||
this.checkBoxShortcutsAlt.Location = new System.Drawing.Point(174, 366);
|
||||
this.checkBoxShortcutsAlt.Name = "checkBoxShortcutsAlt";
|
||||
this.checkBoxShortcutsAlt.Size = new System.Drawing.Size(39, 17);
|
||||
this.checkBoxShortcutsAlt.Size = new System.Drawing.Size(38, 17);
|
||||
this.checkBoxShortcutsAlt.TabIndex = 2;
|
||||
this.checkBoxShortcutsAlt.Text = "Alt";
|
||||
this.checkBoxShortcutsAlt.UseVisualStyleBackColor = true;
|
||||
@ -2211,7 +2235,7 @@
|
||||
this.checkBoxShortcutsControl.Enabled = false;
|
||||
this.checkBoxShortcutsControl.Location = new System.Drawing.Point(87, 367);
|
||||
this.checkBoxShortcutsControl.Name = "checkBoxShortcutsControl";
|
||||
this.checkBoxShortcutsControl.Size = new System.Drawing.Size(61, 17);
|
||||
this.checkBoxShortcutsControl.Size = new System.Drawing.Size(59, 17);
|
||||
this.checkBoxShortcutsControl.TabIndex = 1;
|
||||
this.checkBoxShortcutsControl.Text = "Control";
|
||||
this.checkBoxShortcutsControl.UseVisualStyleBackColor = true;
|
||||
@ -2254,25 +2278,24 @@
|
||||
this.labelStatus.TabIndex = 3;
|
||||
this.labelStatus.Text = "labelStatus";
|
||||
//
|
||||
// groupBoxSpectrogram
|
||||
// buttonSpectrogramsFolderEmpty
|
||||
//
|
||||
this.groupBoxSpectrogram.Controls.Add(this.checkBoxGenerateSpectrogram);
|
||||
this.groupBoxSpectrogram.Location = new System.Drawing.Point(6, 216);
|
||||
this.groupBoxSpectrogram.Name = "groupBoxSpectrogram";
|
||||
this.groupBoxSpectrogram.Size = new System.Drawing.Size(786, 103);
|
||||
this.groupBoxSpectrogram.TabIndex = 4;
|
||||
this.groupBoxSpectrogram.TabStop = false;
|
||||
this.groupBoxSpectrogram.Text = "Spectrogram";
|
||||
this.buttonSpectrogramsFolderEmpty.Location = new System.Drawing.Point(341, 35);
|
||||
this.buttonSpectrogramsFolderEmpty.Name = "buttonSpectrogramsFolderEmpty";
|
||||
this.buttonSpectrogramsFolderEmpty.Size = new System.Drawing.Size(188, 23);
|
||||
this.buttonSpectrogramsFolderEmpty.TabIndex = 3;
|
||||
this.buttonSpectrogramsFolderEmpty.Text = "Empty \'Spectrograms\' folder";
|
||||
this.buttonSpectrogramsFolderEmpty.UseVisualStyleBackColor = true;
|
||||
this.buttonSpectrogramsFolderEmpty.Click += new System.EventHandler(this.buttonSpectrogramsFolderEmpty_Click);
|
||||
//
|
||||
// checkBoxGenerateSpectrogram
|
||||
// labelSpectrogramsFolderInfo
|
||||
//
|
||||
this.checkBoxGenerateSpectrogram.AutoSize = true;
|
||||
this.checkBoxGenerateSpectrogram.Location = new System.Drawing.Point(10, 20);
|
||||
this.checkBoxGenerateSpectrogram.Name = "checkBoxGenerateSpectrogram";
|
||||
this.checkBoxGenerateSpectrogram.Size = new System.Drawing.Size(134, 17);
|
||||
this.checkBoxGenerateSpectrogram.TabIndex = 11;
|
||||
this.checkBoxGenerateSpectrogram.Text = "Generate spectrogram";
|
||||
this.checkBoxGenerateSpectrogram.UseVisualStyleBackColor = true;
|
||||
this.labelSpectrogramsFolderInfo.AutoSize = true;
|
||||
this.labelSpectrogramsFolderInfo.Location = new System.Drawing.Point(338, 18);
|
||||
this.labelSpectrogramsFolderInfo.Name = "labelSpectrogramsFolderInfo";
|
||||
this.labelSpectrogramsFolderInfo.Size = new System.Drawing.Size(216, 13);
|
||||
this.labelSpectrogramsFolderInfo.TabIndex = 2;
|
||||
this.labelSpectrogramsFolderInfo.Text = "\'Spectrograms\' folder contains x files (x mb)";
|
||||
//
|
||||
// Settings
|
||||
//
|
||||
@ -2318,6 +2341,8 @@
|
||||
this.groupBoxVideoEngine.ResumeLayout(false);
|
||||
this.groupBoxVideoEngine.PerformLayout();
|
||||
this.tabPageWaveForm.ResumeLayout(false);
|
||||
this.groupBoxSpectrogram.ResumeLayout(false);
|
||||
this.groupBoxSpectrogram.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBoxWaveFormAppearence.ResumeLayout(false);
|
||||
@ -2351,8 +2376,6 @@
|
||||
this.tabPageShortcuts.ResumeLayout(false);
|
||||
this.groupBoxShortcuts.ResumeLayout(false);
|
||||
this.groupBoxShortcuts.PerformLayout();
|
||||
this.groupBoxSpectrogram.ResumeLayout(false);
|
||||
this.groupBoxSpectrogram.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -2544,5 +2567,7 @@
|
||||
private System.Windows.Forms.CheckBox checkBoxPromptDeleteLines;
|
||||
private System.Windows.Forms.GroupBox groupBoxSpectrogram;
|
||||
private System.Windows.Forms.CheckBox checkBoxGenerateSpectrogram;
|
||||
private System.Windows.Forms.Button buttonSpectrogramsFolderEmpty;
|
||||
private System.Windows.Forms.Label labelSpectrogramsFolderInfo;
|
||||
}
|
||||
}
|
@ -238,9 +238,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonWaveFormBackgroundColor.Text = language.WaveFormBackgroundColor;
|
||||
groupBoxSpectrogram.Text = language.Spectrogram;
|
||||
checkBoxGenerateSpectrogram.Text = language.GenerateSpectrogram;
|
||||
buttonSpectrogramsFolderEmpty.Text = language.SpectrogramsFolderEmpty;
|
||||
|
||||
buttonWaveFormsFolderEmpty.Text = language.WaveFormsFolderEmpty;
|
||||
InitializeWaveFormsFolderEmpty(language);
|
||||
InitializeWaveformsAndSpectrogramsFolderEmpty(language);
|
||||
|
||||
|
||||
groupBoxSsaStyle.Text = language.SubStationAlphaStyle;
|
||||
@ -501,16 +502,41 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeWaveFormsFolderEmpty(LanguageStructure.Settings language)
|
||||
private void InitializeWaveformsAndSpectrogramsFolderEmpty(LanguageStructure.Settings language)
|
||||
{
|
||||
string waveFormsFolder = Configuration.WaveFormsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (Directory.Exists(waveFormsFolder))
|
||||
{
|
||||
string spectrogramsFolder = Configuration.SpectrogramsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
long bytes = 0;
|
||||
int count = 0;
|
||||
|
||||
if (Directory.Exists(waveFormsFolder))
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(waveFormsFolder);
|
||||
|
||||
// spectrum data
|
||||
// waveform data
|
||||
bytes = 0;
|
||||
count = 0;
|
||||
foreach (FileInfo fi in di.GetFiles("*.wav"))
|
||||
{
|
||||
bytes += fi.Length;
|
||||
count++;
|
||||
}
|
||||
labelWaveFormsFolderInfo.Text = string.Format(language.WaveFormsFolderInfo, count, bytes / 1024.0 / 1024.0);
|
||||
buttonWaveFormsFolderEmpty.Enabled = count > 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonWaveFormsFolderEmpty.Enabled = false;
|
||||
labelWaveFormsFolderInfo.Text = string.Format(language.WaveFormsFolderInfo, 0, 0);
|
||||
}
|
||||
|
||||
if (Directory.Exists(spectrogramsFolder))
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(spectrogramsFolder);
|
||||
|
||||
// spectrogram data
|
||||
bytes = 0;
|
||||
count = 0;
|
||||
foreach (DirectoryInfo dir in di.GetDirectories())
|
||||
{
|
||||
DirectoryInfo spectrogramDir = new DirectoryInfo(dir.FullName);
|
||||
@ -527,20 +553,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
// waveform data
|
||||
foreach (FileInfo fi in di.GetFiles("*.wav"))
|
||||
{
|
||||
bytes += fi.Length;
|
||||
count++;
|
||||
}
|
||||
labelWaveFormsFolderInfo.Text = string.Format(language.WaveFormsFolderInfo, count, bytes / 1024.0 / 1024.0);
|
||||
buttonWaveFormsFolderEmpty.Enabled = count > 0;
|
||||
labelSpectrogramsFolderInfo.Text = string.Format(language.SpectrogramsFolderInfo, count, bytes / 1024.0 / 1024.0);
|
||||
buttonSpectrogramsFolderEmpty.Enabled = count > 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonWaveFormsFolderEmpty.Enabled = false;
|
||||
labelWaveFormsFolderInfo.Text = string.Format(language.WaveFormsFolderInfo, 0, 0);
|
||||
buttonSpectrogramsFolderEmpty.Enabled = false;
|
||||
labelSpectrogramsFolderInfo.Text = string.Format(language.SpectrogramsFolderInfo, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1535,19 +1554,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(waveFormsFolder);
|
||||
|
||||
foreach (DirectoryInfo dir in di.GetDirectories())
|
||||
{
|
||||
DirectoryInfo spectrogramDir = new DirectoryInfo(dir.FullName);
|
||||
foreach (FileInfo fileName in spectrogramDir.GetFiles("*.gif"))
|
||||
{
|
||||
File.Delete(fileName.FullName);
|
||||
}
|
||||
string xmlFileName = Path.Combine(dir.FullName, "Info.xml");
|
||||
if (File.Exists(xmlFileName))
|
||||
File.Delete(xmlFileName);
|
||||
Directory.Delete(dir.FullName);
|
||||
}
|
||||
|
||||
foreach (FileInfo fileName in di.GetFiles("*.wav"))
|
||||
{
|
||||
try
|
||||
@ -1560,7 +1566,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
}
|
||||
InitializeWaveFormsFolderEmpty(Configuration.Settings.Language.Settings);
|
||||
InitializeWaveformsAndSpectrogramsFolderEmpty(Configuration.Settings.Language.Settings);
|
||||
}
|
||||
|
||||
private void checkBoxRememberRecentFiles_CheckedChanged(object sender, EventArgs e)
|
||||
@ -1705,5 +1711,28 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSpectrogramsFolderEmpty_Click(object sender, EventArgs e)
|
||||
{
|
||||
string spectrogramsFolder = Configuration.SpectrogramsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (Directory.Exists(spectrogramsFolder))
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(spectrogramsFolder);
|
||||
|
||||
foreach (DirectoryInfo dir in di.GetDirectories())
|
||||
{
|
||||
DirectoryInfo spectrogramDir = new DirectoryInfo(dir.FullName);
|
||||
foreach (FileInfo fileName in spectrogramDir.GetFiles("*.gif"))
|
||||
{
|
||||
File.Delete(fileName.FullName);
|
||||
}
|
||||
string xmlFileName = Path.Combine(dir.FullName, "Info.xml");
|
||||
if (File.Exists(xmlFileName))
|
||||
File.Delete(xmlFileName);
|
||||
Directory.Delete(dir.FullName);
|
||||
}
|
||||
}
|
||||
InitializeWaveformsAndSpectrogramsFolderEmpty(Configuration.Settings.Language.Settings);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,14 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
public static string SpectrogramsFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataDirectory + "Spectrograms" + Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
public static string AutoBackupFolder
|
||||
{
|
||||
get
|
||||
|
@ -1162,6 +1162,8 @@ can edit in same subtitle file (collaboration)",
|
||||
WaveFormTextColor = "Text color",
|
||||
WaveFormsFolderEmpty = "Empty 'WaveForms' folder",
|
||||
WaveFormsFolderInfo = "'WaveForms' folder contains {0} files ({1:0.00} MB)",
|
||||
SpectrogramsFolderEmpty = "Empty 'Spectrograms' folder",
|
||||
SpectrogramsFolderInfo = "'Spectrograms' folder contains {0} files ({1:0.00} MB)",
|
||||
Spectrogram = "Spectrogram",
|
||||
GenerateSpectrogram = "Generate spectrogram",
|
||||
SubStationAlphaStyle = "Sub Station Alpha style",
|
||||
|
@ -1096,6 +1096,8 @@
|
||||
public string WaveFormTextColor { get; set; }
|
||||
public string WaveFormsFolderEmpty { get; set; }
|
||||
public string WaveFormsFolderInfo { get; set; }
|
||||
public string SpectrogramsFolderEmpty { get; set; }
|
||||
public string SpectrogramsFolderInfo { get; set; }
|
||||
public string Spectrogram { get; set; }
|
||||
public string GenerateSpectrogram { get; set; }
|
||||
public string SubStationAlphaStyle { get; set; }
|
||||
|
@ -366,7 +366,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
//////////////////////////////////////// SPECTRUM ///////////////////////////////////////////////////////////
|
||||
|
||||
public List<Bitmap> GenerateFourierData(int NFFT, string spectrumDirectory)
|
||||
public List<Bitmap> GenerateFourierData(int NFFT, string spectrogramDirectory)
|
||||
{
|
||||
List<Bitmap> bitmaps = new List<Bitmap>();
|
||||
|
||||
@ -421,7 +421,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
for (int k = 0; k < sampleSize; k++)
|
||||
samplesAsReal[k] = samples[k] / divider;
|
||||
Bitmap bmp = DrawSpectrogram(NFFT, samplesAsReal, f, palette);
|
||||
bmp.Save(Path.Combine(spectrumDirectory, count + ".gif"), System.Drawing.Imaging.ImageFormat.Gif);
|
||||
bmp.Save(Path.Combine(spectrogramDirectory, count + ".gif"), System.Drawing.Imaging.ImageFormat.Gif);
|
||||
bitmaps.Add(bmp); // save serialized gif instead????
|
||||
samples = new List<int>();
|
||||
count++;
|
||||
@ -437,7 +437,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
for (int k = 0; k < sampleSize && k < samples.Count; k++)
|
||||
samplesAsReal[k] = samples[k] / divider;
|
||||
Bitmap bmp = DrawSpectrogram(NFFT, samplesAsReal, f, palette);
|
||||
bmp.Save(Path.Combine(spectrumDirectory, count + ".gif"), System.Drawing.Imaging.ImageFormat.Gif);
|
||||
bmp.Save(Path.Combine(spectrogramDirectory, count + ".gif"), System.Drawing.Imaging.ImageFormat.Gif);
|
||||
bitmaps.Add(bmp); // save serialized gif instead????
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
double totalDuration = Header.LengthInSeconds;
|
||||
doc.DocumentElement.SelectSingleNode("SampleDuration").InnerText = sampleDuration.ToString();
|
||||
doc.DocumentElement.SelectSingleNode("TotalDuration").InnerText = totalDuration.ToString();
|
||||
doc.Save(System.IO.Path.Combine(spectrumDirectory, "Info.xml"));
|
||||
doc.Save(System.IO.Path.Combine(spectrogramDirectory, "Info.xml"));
|
||||
|
||||
return bitmaps;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user