diff --git a/VG Music Studio/Properties/Strings.Designer.cs b/VG Music Studio/Properties/Strings.Designer.cs
index 7153b37..e9c370c 100644
--- a/VG Music Studio/Properties/Strings.Designer.cs
+++ b/VG Music Studio/Properties/Strings.Designer.cs
@@ -19,7 +19,7 @@ namespace Kermalis.VGMusicStudio.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
@@ -321,6 +321,15 @@ internal static string ErrorSaveMIDI {
}
}
+ ///
+ /// Looks up a localized string similar to Error Exporting MIDI {0}.
+ ///
+ internal static string ErrorSaveMIDIBatch {
+ get {
+ return ResourceManager.GetString("ErrorSaveMIDIBatch", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Error Exporting SF2.
///
@@ -510,6 +519,15 @@ internal static string MenuSaveMIDI {
}
}
+ ///
+ /// Looks up a localized string similar to Export All Songs as MIDI.
+ ///
+ internal static string MenuSaveMIDIBatch {
+ get {
+ return ResourceManager.GetString("MenuSaveMIDIBatch", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Export VoiceTable as SF2.
///
@@ -672,6 +690,15 @@ internal static string SuccessSaveMIDI {
}
}
+ ///
+ /// Looks up a localized string similar to MIDIs saved to {0}..
+ ///
+ internal static string SuccessSaveMIDIBatch {
+ get {
+ return ResourceManager.GetString("SuccessSaveMIDIBatch", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to VoiceTable saved to {0}..
///
diff --git a/VG Music Studio/Properties/Strings.es.resx b/VG Music Studio/Properties/Strings.es.resx
index d98bb26..eb3153e 100644
--- a/VG Music Studio/Properties/Strings.es.resx
+++ b/VG Music Studio/Properties/Strings.es.resx
@@ -345,4 +345,13 @@
DLS guardado en {0}.
+
+ Error al Exportar MIDI {0}
+
+
+ Exportar todo CanciĆ³n como MIDI
+
+
+ MIDIs guardado en {0}.
+
\ No newline at end of file
diff --git a/VG Music Studio/Properties/Strings.it.resx b/VG Music Studio/Properties/Strings.it.resx
index 935f17e..4914775 100644
--- a/VG Music Studio/Properties/Strings.it.resx
+++ b/VG Music Studio/Properties/Strings.it.resx
@@ -345,4 +345,13 @@
VoiceTable salvata in {0}.
+
+ Errore Durante L'Esportazione in MIDI {0}
+
+
+ Esporta tutto Brano in MIDI
+
+
+ MIDIs salvato in {0}.
+
\ No newline at end of file
diff --git a/VG Music Studio/Properties/Strings.resx b/VG Music Studio/Properties/Strings.resx
index 8e4ae4a..359db2e 100644
--- a/VG Music Studio/Properties/Strings.resx
+++ b/VG Music Studio/Properties/Strings.resx
@@ -373,4 +373,15 @@
VoiceTable saved to {0}.
{0} is the file name.
+
+ Error Exporting MIDI {0}
+ {0} is the song number.
+
+
+ Export All Songs as MIDI
+
+
+ MIDIs saved to {0}.
+ {0} is the folder name.
+
\ No newline at end of file
diff --git a/VG Music Studio/UI/MainForm.cs b/VG Music Studio/UI/MainForm.cs
index 761394f..bd7d9a6 100644
--- a/VG Music Studio/UI/MainForm.cs
+++ b/VG Music Studio/UI/MainForm.cs
@@ -35,7 +35,7 @@ internal class MainForm : ThemedForm
private readonly MenuStrip _mainMenu;
private readonly ToolStripMenuItem _fileItem, _openDSEItem, _openAlphaDreamItem, _openMP2KItem, _openSDATItem,
- _dataItem, _trackViewerItem, _exportDLSItem, _exportMIDIItem, _exportSF2Item, _exportWAVItem,
+ _dataItem, _trackViewerItem, _exportDLSItem, _exportMIDIItem, _exportMIDIBatchItem, _exportSF2Item, _exportWAVItem,
_playlistItem, _endPlaylistItem;
private readonly Timer _timer;
private readonly ThemedNumeric _songNumerical;
@@ -83,12 +83,14 @@ private MainForm()
_exportDLSItem.Click += ExportDLS;
_exportMIDIItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveMIDI };
_exportMIDIItem.Click += ExportMIDI;
+ _exportMIDIBatchItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveMIDIBatch };
+ _exportMIDIBatchItem.Click += ExportMIDIBatch;
_exportSF2Item = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveSF2 };
_exportSF2Item.Click += ExportSF2;
_exportWAVItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveWAV };
_exportWAVItem.Click += ExportWAV;
_dataItem = new ToolStripMenuItem { Text = Strings.MenuData };
- _dataItem.DropDownItems.AddRange(new ToolStripItem[] { _trackViewerItem, _exportDLSItem, _exportMIDIItem, _exportSF2Item, _exportWAVItem });
+ _dataItem.DropDownItems.AddRange(new ToolStripItem[] { _trackViewerItem, _exportDLSItem, _exportMIDIItem, _exportMIDIBatchItem, _exportSF2Item, _exportWAVItem });
// Playlist Menu
_endPlaylistItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuEndPlaylist };
@@ -241,6 +243,7 @@ private void SongNumerical_ValueChanged(object sender, EventArgs e)
int numTracks = (Engine.Instance.Player.Events?.Length).GetValueOrDefault();
_positionBar.Enabled = _exportWAVItem.Enabled = success && numTracks > 0;
_exportMIDIItem.Enabled = success && Engine.Instance.Type == Engine.EngineType.GBA_MP2K && numTracks > 0;
+ _exportMIDIBatchItem.Enabled = success && Engine.Instance.Type == Engine.EngineType.GBA_MP2K;
_exportDLSItem.Enabled = _exportSF2Item.Enabled = success && Engine.Instance.Type == Engine.EngineType.GBA_AlphaDream;
_autoplay = true;
@@ -343,6 +346,7 @@ private void OpenDSE(object sender, EventArgs e)
_songNumerical.Visible = false;
_exportDLSItem.Visible = false;
_exportMIDIItem.Visible = false;
+ _exportMIDIBatchItem.Visible = false;
_exportSF2Item.Visible = false;
}
}
@@ -375,6 +379,7 @@ private void OpenAlphaDream(object sender, EventArgs e)
_songNumerical.Visible = true;
_exportDLSItem.Visible = true;
_exportMIDIItem.Visible = false;
+ _exportMIDIBatchItem.Visible = false;
_exportSF2Item.Visible = true;
}
}
@@ -407,6 +412,7 @@ private void OpenMP2K(object sender, EventArgs e)
_songNumerical.Visible = true;
_exportDLSItem.Visible = false;
_exportMIDIItem.Visible = true;
+ _exportMIDIBatchItem.Visible = true;
_exportSF2Item.Visible = false;
}
}
@@ -439,6 +445,7 @@ private void OpenSDAT(object sender, EventArgs e)
_songNumerical.Visible = true;
_exportDLSItem.Visible = false;
_exportMIDIItem.Visible = false;
+ _exportMIDIBatchItem.Visible = false;
_exportSF2Item.Visible = false;
}
}
@@ -500,6 +507,66 @@ private void ExportMIDI(object sender, EventArgs e)
}
}
}
+ private void ExportMIDIBatch(object sender, EventArgs e)
+ {
+ var d = new CommonOpenFileDialog
+ {
+ Title = Strings.MenuSaveMIDIBatch,
+ AllowNonFileSystemItems = true,
+ IsFolderPicker = true,
+ EnsurePathExists = true,
+ Multiselect = false,
+ ShowPlacesList = true
+ };
+ if (d.ShowDialog() == CommonFileDialogResult.Ok)
+ {
+ var p = (Core.GBA.MP2K.Player)Engine.Instance.Player;
+ Stop();
+ var args = new Core.GBA.MP2K.Player.MIDISaveArgs
+ {
+ SaveCommandsBeforeTranspose = true,
+ ReverseVolume = true,
+ TimeSignatures = new List<(int AbsoluteTick, (byte Numerator, byte Denominator))>
+ {
+ (0, (4, 4))
+ }
+ };
+ for (long i = 0; i <= _songNumerical.Maximum; i++)
+ {
+ try
+ {
+ p.LoadSong(i);
+ }
+ catch (Exception ex)
+ {
+ FlexibleMessageBox.Show(ex, string.Format(Strings.ErrorLoadSong, i));
+ continue;
+ }
+ if (p.MaxTicks <= 0)
+ {
+ continue;
+ }
+ try
+ {
+ p.SaveAsMIDI(d.FileName + "/" + i.ToString() + ".mid", args);
+ }
+ catch (Exception ex)
+ {
+ FlexibleMessageBox.Show(ex, string.Format(Strings.ErrorSaveMIDIBatch, i));
+ }
+ }
+ FlexibleMessageBox.Show(string.Format(Strings.SuccessSaveMIDIBatch, d.FileName), Text);
+ long oldIndex = (long)_songNumerical.Value;
+ try
+ {
+ Engine.Instance.Player.LoadSong(oldIndex);
+ }
+ catch (Exception ex)
+ {
+ FlexibleMessageBox.Show(ex, string.Format(Strings.ErrorLoadSong, Engine.Instance.Config.GetSongName(oldIndex)));
+ }
+ }
+ }
private void ExportSF2(object sender, EventArgs e)
{
var d = new CommonSaveFileDialog