diff --git a/OmniConverter.sln b/OmniConverter.sln index 7bd48cf..3107fc3 100644 --- a/OmniConverter.sln +++ b/OmniConverter.sln @@ -13,9 +13,11 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {27EFEEA6-BF11-4AB7-92EC-E95430D9C3D6}.Debug|x64.ActiveCfg = Debug|x64 + {27EFEEA6-BF11-4AB7-92EC-E95430D9C3D6}.Debug|x64.Build.0 = Debug|x64 {27EFEEA6-BF11-4AB7-92EC-E95430D9C3D6}.Release|x64.ActiveCfg = Release|x64 {27EFEEA6-BF11-4AB7-92EC-E95430D9C3D6}.Release|x64.Build.0 = Release|x64 {49122F52-0B71-46BE-9F86-17A53C7FF333}.Debug|x64.ActiveCfg = Debug|x64 + {49122F52-0B71-46BE-9F86-17A53C7FF333}.Debug|x64.Build.0 = Debug|x64 {49122F52-0B71-46BE-9F86-17A53C7FF333}.Release|x64.ActiveCfg = Release|x64 {49122F52-0B71-46BE-9F86-17A53C7FF333}.Release|x64.Build.0 = Release|x64 EndGlobalSection diff --git a/OmniConverter/App.config b/OmniConverter/App.config index 44cb82e..f509f81 100644 --- a/OmniConverter/App.config +++ b/OmniConverter/App.config @@ -94,6 +94,9 @@ 0 + + 1 + diff --git a/OmniConverter/Controls/MIDIThreadStatus.Designer.cs b/OmniConverter/Controls/MIDIThreadStatus.Designer.cs deleted file mode 100644 index 73e7daf..0000000 --- a/OmniConverter/Controls/MIDIThreadStatus.Designer.cs +++ /dev/null @@ -1,77 +0,0 @@ -namespace OmniConverter -{ - partial class MIDIThreadStatus - { - /// - /// Variabile di progettazione necessaria. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Pulire le risorse in uso. - /// - /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Codice generato da Progettazione componenti - - /// - /// Metodo necessario per il supporto della finestra di progettazione. Non modificare - /// il contenuto del metodo con l'editor di codice. - /// - private void InitializeComponent() - { - this.MIDIPB = new System.Windows.Forms.ProgressBar(); - this.MIDIT = new System.Windows.Forms.RichTextBox(); - this.SuspendLayout(); - // - // MIDIPB - // - this.MIDIPB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MIDIPB.Location = new System.Drawing.Point(3, 19); - this.MIDIPB.Name = "MIDIPB"; - this.MIDIPB.Size = new System.Drawing.Size(287, 13); - this.MIDIPB.TabIndex = 1; - // - // MIDIT - // - this.MIDIT.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MIDIT.BackColor = System.Drawing.SystemColors.Control; - this.MIDIT.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.MIDIT.Location = new System.Drawing.Point(3, 3); - this.MIDIT.Multiline = false; - this.MIDIT.Name = "MIDIT"; - this.MIDIT.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - this.MIDIT.Size = new System.Drawing.Size(287, 13); - this.MIDIT.TabIndex = 3; - this.MIDIT.TabStop = false; - this.MIDIT.Text = "N/A"; - // - // MIDIThreadStatus - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.MIDIT); - this.Controls.Add(this.MIDIPB); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Name = "MIDIThreadStatus"; - this.Size = new System.Drawing.Size(293, 35); - this.ResumeLayout(false); - - } - - #endregion - public System.Windows.Forms.ProgressBar MIDIPB; - private System.Windows.Forms.RichTextBox MIDIT; - } -} diff --git a/OmniConverter/Controls/MIDIThreadStatus.cs b/OmniConverter/Controls/MIDIThreadStatus.cs deleted file mode 100644 index 1e39bae..0000000 --- a/OmniConverter/Controls/MIDIThreadStatus.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace OmniConverter -{ - public partial class MIDIThreadStatus : UserControl - { - public MIDIThreadStatus(String MIDITitle) - { - InitializeComponent(); - - MIDIT.Text = MIDITitle; - } - - public void UpdatePB(Int32 PBV) - { - MIDIPB.Value = PBV.LimitToRange(0, 100); - } - } -} diff --git a/OmniConverter/Controls/MIDIThreadStatus.resx b/OmniConverter/Controls/MIDIThreadStatus.resx deleted file mode 100644 index 1af7de1..0000000 --- a/OmniConverter/Controls/MIDIThreadStatus.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/OmniConverter/Controls/TaskStatus.Designer.cs b/OmniConverter/Controls/TaskStatus.Designer.cs new file mode 100644 index 0000000..6077e22 --- /dev/null +++ b/OmniConverter/Controls/TaskStatus.Designer.cs @@ -0,0 +1,73 @@ +namespace OmniConverter +{ + partial class TaskStatus + { + /// + /// Variabile di progettazione necessaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Pulire le risorse in uso. + /// + /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Codice generato da Progettazione componenti + + /// + /// Metodo necessario per il supporto della finestra di progettazione. Non modificare + /// il contenuto del metodo con l'editor di codice. + /// + private void InitializeComponent() + { + MIDIPB = new System.Windows.Forms.ProgressBar(); + MIDIT = new System.Windows.Forms.RichTextBox(); + SuspendLayout(); + // + // MIDIPB + // + MIDIPB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + MIDIPB.Location = new System.Drawing.Point(3, 19); + MIDIPB.Name = "MIDIPB"; + MIDIPB.Size = new System.Drawing.Size(287, 13); + MIDIPB.TabIndex = 1; + // + // MIDIT + // + MIDIT.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + MIDIT.BackColor = System.Drawing.SystemColors.Control; + MIDIT.BorderStyle = System.Windows.Forms.BorderStyle.None; + MIDIT.Location = new System.Drawing.Point(3, 3); + MIDIT.Multiline = false; + MIDIT.Name = "MIDIT"; + MIDIT.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; + MIDIT.Size = new System.Drawing.Size(287, 16); + MIDIT.TabIndex = 3; + MIDIT.TabStop = false; + MIDIT.Text = "N/A"; + // + // MIDIThreadStatus + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + Controls.Add(MIDIT); + Controls.Add(MIDIPB); + Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + Name = "MIDIThreadStatus"; + Size = new System.Drawing.Size(293, 35); + ResumeLayout(false); + } + + #endregion + public System.Windows.Forms.ProgressBar MIDIPB; + private System.Windows.Forms.RichTextBox MIDIT; + } +} diff --git a/OmniConverter/Controls/TaskStatus.cs b/OmniConverter/Controls/TaskStatus.cs new file mode 100644 index 0000000..6dd7d8e --- /dev/null +++ b/OmniConverter/Controls/TaskStatus.cs @@ -0,0 +1,55 @@ +using MIDIModificationFramework; +using System; +using System.Windows.Forms; + +namespace OmniConverter +{ + public partial class TaskStatus : UserControl + { + string OgTitle = string.Empty; + + public TaskStatus(String MIDITitle) + { + InitializeComponent(); + + OgTitle = MIDITitle; + MIDIT.Text = OgTitle; + } + + public void UpdateTitle(string Text) + { + if (InvokeRequired) + { + BeginInvoke(new MethodInvoker(() => UpdateTitle(Text)), null); + return; + } + + if (!string.IsNullOrEmpty(Text)) + MIDIT.Text = $"{OgTitle} - {Text}"; + else + MIDIT.Text = OgTitle; + } + + public void UpdatePBStyle(ProgressBarStyle PBM) + { + if (InvokeRequired) + { + BeginInvoke(new MethodInvoker(() => UpdatePBStyle(PBM)), null); + return; + } + + MIDIPB.Style = PBM; + } + + public void UpdatePB(int PBV) + { + if (InvokeRequired) + { + BeginInvoke(new MethodInvoker(() => UpdatePB(PBV)), null); + return; + } + + MIDIPB.Value = PBV.LimitToRange(0, 100); + } + } +} diff --git a/OmniConverter/Controls/TaskStatus.resx b/OmniConverter/Controls/TaskStatus.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/OmniConverter/Controls/TaskStatus.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OmniConverter/Controls/TrackThreadStatus.Designer.cs b/OmniConverter/Controls/TrackThreadStatus.Designer.cs deleted file mode 100644 index 1bddbb1..0000000 --- a/OmniConverter/Controls/TrackThreadStatus.Designer.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace OmniConverter -{ - partial class TrackThreadStatus - { - /// - /// Variabile di progettazione necessaria. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Pulire le risorse in uso. - /// - /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Codice generato da Progettazione componenti - - /// - /// Metodo necessario per il supporto della finestra di progettazione. Non modificare - /// il contenuto del metodo con l'editor di codice. - /// - private void InitializeComponent() - { - this.Trck = new System.Windows.Forms.Label(); - this.TrckPB = new System.Windows.Forms.ProgressBar(); - this.SuspendLayout(); - // - // Trck - // - this.Trck.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.Trck.AutoSize = true; - this.Trck.Location = new System.Drawing.Point(2, 10); - this.Trck.Name = "Trck"; - this.Trck.Size = new System.Drawing.Size(70, 15); - this.Trck.TabIndex = 0; - this.Trck.Text = "Track 65.535"; - // - // TrckPB - // - this.TrckPB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TrckPB.Location = new System.Drawing.Point(87, 4); - this.TrckPB.Name = "TrckPB"; - this.TrckPB.Size = new System.Drawing.Size(202, 27); - this.TrckPB.TabIndex = 1; - // - // TrackThreadStatus - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.TrckPB); - this.Controls.Add(this.Trck); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Name = "TrackThreadStatus"; - this.Size = new System.Drawing.Size(293, 35); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label Trck; - public System.Windows.Forms.ProgressBar TrckPB; - } -} diff --git a/OmniConverter/Controls/TrackThreadStatus.cs b/OmniConverter/Controls/TrackThreadStatus.cs deleted file mode 100644 index 0f3f05b..0000000 --- a/OmniConverter/Controls/TrackThreadStatus.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; - -namespace OmniConverter -{ - public partial class TrackThreadStatus : UserControl - { - private bool IsInUse = false; - - public TrackThreadStatus(Int64 Track) - { - InitializeComponent(); - - Trck.Text = String.Format("Track {0}", Track); - } - - public void UpdatePB(Int32 PBV) - { - TrckPB.Value = PBV.LimitToRange(0, 100); - } - - public bool IsFree() { return !IsInUse; } - - public void Done() { IsInUse = false; } - } -} diff --git a/OmniConverter/Controls/TrackThreadStatus.resx b/OmniConverter/Controls/TrackThreadStatus.resx deleted file mode 100644 index 1af7de1..0000000 --- a/OmniConverter/Controls/TrackThreadStatus.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/OmniConverter/Extensions/BASSMIDI.cs b/OmniConverter/Extensions/BASSMIDI.cs index e8731d0..436039e 100644 --- a/OmniConverter/Extensions/BASSMIDI.cs +++ b/OmniConverter/Extensions/BASSMIDI.cs @@ -4,9 +4,15 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Forms; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Vst; -using Un4seen.Bass.AddOn.Midi; +using ManagedBass; +using ManagedBass.Midi; +using ManagedBass.Fx; +using System.Threading.Channels; +using MIDIModificationFramework; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Xml.Linq; // Written with help from Arduano @@ -68,30 +74,36 @@ public void SetNewEvent(uint DWORD) public class BASSMIDI : ISampleSource { private readonly object Lock = new object(); - private BASSFlag Flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_MIDI_DECAYEND; + private BassFlags Flags; private int Handle; + private bool _disposed = false; - public string UniqueID { get; } = IDGenerator.GetID(); - public bool ErroredOut { get; } = false; - public bool CanSeek { get; } = false; - public WaveFormat WaveFormat { get; } + public string UniqueID { get; private set; } = IDGenerator.GetID(); + public bool ErroredOut { get; private set; } = false; + public bool CanSeek { get; private set; } = false; + public CSCore.WaveFormat WaveFormat { get; private set; } // Special RTS mode private Random RTSR = new Random(); - private Boolean RTSMode { get; } = false; - private UInt32 EventC; - private BASS_MIDI_EVENT[] EventS; - private Double CFMin { get; } = Properties.Settings.Default.CFValue - Properties.Settings.Default.CFFluctuation; - private Double CFMax { get; } = Properties.Settings.Default.CFValue + Properties.Settings.Default.CFFluctuation; + private bool RTSMode { get; } = false; + private uint EventC; + private MidiEvent[] EventS; - public BASSMIDI(WaveFormat WF) + private int VolHandle; + private VolumeFxParameters VolParam; + + private double CFMin { get; } = Properties.Settings.Default.CFValue - Properties.Settings.Default.CFFluctuation; + private double CFMax { get; } = Properties.Settings.Default.CFValue + Properties.Settings.Default.CFFluctuation; + + public BASSMIDI(CSCore.WaveFormat WF) { lock (Lock) { WaveFormat = WF; InitializeSettings(); + Flags = BassFlags.Decode | BassFlags.Float | BassFlags.MidiDecayEnd; - Handle = BassMidi.BASS_MIDI_StreamCreate(16, Flags, WaveFormat.SampleRate); + Handle = BassMidi.CreateStream(16, Flags, WaveFormat.SampleRate); if (!CheckError(Handle, "Unable to create stream.")) { ErroredOut = true; @@ -99,7 +111,7 @@ public BASSMIDI(WaveFormat WF) } if (Handle == 0) { - BASSError ERR = Bass.BASS_ErrorGetCode(); + Errors ERR = Bass.LastError; Debug.ShowMsgBox( "BASSMIDI error", @@ -111,15 +123,23 @@ public BASSMIDI(WaveFormat WF) } Debug.PrintToConsole("ok", String.Format("{0} - Stream is open.", UniqueID)); - Int32 Tracks = BassMidi.BASS_MIDI_StreamGetTrackCount(Handle); - Debug.PrintToConsole("ok", String.Format("{0} - Total tracks = {1}", UniqueID, Tracks)); + Bass.ChannelSetAttribute(Handle, ChannelAttribute.MidiCPU, 0); + + VolHandle = Bass.ChannelSetFX(Handle, EffectType.Volume, 1); + if (!CheckError(Handle, "Unable to set volume FX.")) + { + ErroredOut = true; + return; + } + + ChangeVolume(Properties.Settings.Default.Volume); SetSoundFonts(); } } // This is a really unstable mode, touching anything in its code might break it - public BASSMIDI(Boolean RTS, WaveFormat WF) + public BASSMIDI(CSCore.WaveFormat WF, bool RTS = true) { if (!RTS) { @@ -137,10 +157,10 @@ public BASSMIDI(Boolean RTS, WaveFormat WF) InitializeSettings(); // Remove DECAYEND since it's not applicable to this type of stream - Flags &= ~BASSFlag.BASS_MIDI_DECAYEND; + Flags = BassFlags.Decode | BassFlags.Float; // Create stream which will feed the events to - Handle = BassMidi.BASS_MIDI_StreamCreate(16, Flags, WaveFormat.SampleRate); + Handle = BassMidi.CreateStream(16, Flags, WaveFormat.SampleRate); if (!CheckError(Handle, String.Format("Unable to create RTS stream ({0}).", UniqueID))) { ErroredOut = true; @@ -156,7 +176,7 @@ private bool CheckError(Int32 H, String Error) { if (H == 0) { - Error += String.Format("\n\nError encountered: {0}", Bass.BASS_ErrorGetCode()); + Error += String.Format("\n\nError encountered: {0}", Bass.LastError); Debug.ShowMsgBox("BASSMIDI error", Error, null, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; @@ -169,34 +189,37 @@ private void InitializeSettings() { Debug.PrintToConsole("ok", String.Format("Stream unique ID: {0}", UniqueID)); - Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MIDI_VOICES, Properties.Settings.Default.VoiceLimit); - Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MIDI_AUTOFONT, 0); - Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_MIDI_DEFFONT, IntPtr.Zero); - Debug.PrintToConsole("ok", String.Format("{0} - Voice limit set to {1}.", UniqueID, Properties.Settings.Default.VoiceLimit)); + Bass.Configure(Configuration.MidiVoices, Properties.Settings.Default.VoiceLimit); + Bass.Configure(Configuration.MidiAutoFont, 0); + Bass.Configure(Configuration.MidiDefaultFont, IntPtr.Zero); + Debug.PrintToConsole("ok", $"{UniqueID} - VoiceLimit = {Properties.Settings.Default.VoiceLimit}."); - Flags |= Properties.Settings.Default.SincInter ? BASSFlag.BASS_MIDI_SINCINTER : BASSFlag.BASS_DEFAULT; - Debug.PrintToConsole("ok", String.Format("{0} - SincInter = {1}", UniqueID, Properties.Settings.Default.SincInter.ToString())); + Flags |= Properties.Settings.Default.SincInter ? BassFlags.SincInterpolation : BassFlags.Default; + Debug.PrintToConsole("ok", $"{UniqueID} - SincInter = {Properties.Settings.Default.SincInter}."); - Flags |= Properties.Settings.Default.DisableEffects ? BASSFlag.BASS_MIDI_NOFX : BASSFlag.BASS_DEFAULT; - Debug.PrintToConsole("ok", String.Format("{0} - DisableEffects = {1}", UniqueID, Properties.Settings.Default.DisableEffects.ToString())); + Flags |= Properties.Settings.Default.DisableEffects ? BassFlags.MidiNoFx : BassFlags.Default; + Debug.PrintToConsole("ok", $"{UniqueID} - DisableEffects = {Properties.Settings.Default.DisableEffects}."); - Flags |= Properties.Settings.Default.NoteOff1 ? BASSFlag.BASS_MIDI_NOTEOFF1 : BASSFlag.BASS_DEFAULT; - Debug.PrintToConsole("ok", String.Format("{0} - NoteOff1 = {1}", UniqueID, Properties.Settings.Default.NoteOff1.ToString())); + Flags |= Properties.Settings.Default.NoteOff1 ? BassFlags.MidiNoteOff1 : BassFlags.Default; + Debug.PrintToConsole("ok", $"{UniqueID} - NoteOff1 = {Properties.Settings.Default.NoteOff1}."); } private void SetSoundFonts() { - BassMidi.BASS_MIDI_StreamSetFonts(Handle, Program.SFArray.BMFEArray, Program.SFArray.BMFEArray.Length); - BassMidi.BASS_MIDI_StreamLoadSamples(Handle); - Debug.PrintToConsole("ok", String.Format("{0} - Loaded {1} SoundFonts.", UniqueID, Program.SFArray.BMFEArray.Length)); + BassMidi.StreamSetFonts(Handle, Program.SFArray.BMFEArray, Program.SFArray.BMFEArray.Length); + Debug.PrintToConsole("ok", $"{UniqueID} - Loaded {Program.SFArray.BMFEArray.Length} SoundFonts."); } private void SetVSTs() { + return; + +/* foreach (VST iVST in Program.VSTArray) { // } +*/ } public unsafe int Read(float[] buffer, int offset, int count) @@ -206,18 +229,13 @@ public unsafe int Read(float[] buffer, int offset, int count) fixed (float* buff = buffer) { var obuff = buff + offset; - int ret = Bass.BASS_ChannelGetData(Handle, (IntPtr)obuff, (count * 4) | (int)BASSData.BASS_DATA_FLOAT); + int ret = Bass.ChannelGetData(Handle, (IntPtr)obuff, (count * 4) | 0x40000000); if (ret == 0) { - BASSError BE = Bass.BASS_ErrorGetCode(); - if (BE != BASSError.BASS_ERROR_ENDED) - { - Debug.ShowMsgBox( - "Data parsing error", - "An error has occured while parsing the audio data from the BASS stream.", - null, MessageBoxButtons.OK, MessageBoxIcon.Error); - } + var BE = Bass.LastError; + if (BE != Errors.Ended) + Debug.PrintToConsole("wrn", $"{UniqueID} - DataParsingError {(count * 4) | 0x40000000}"); Debug.PrintToConsole("wrn", BE.ToString()); } @@ -227,54 +245,86 @@ public unsafe int Read(float[] buffer, int offset, int count) } } + public void ChangeVolume(float volume) + { + if (VolParam == null) + VolParam = new VolumeFxParameters(); + + VolParam.fCurrent = 1.0f; + VolParam.fTarget = volume; + VolParam.fTime = 0.0f; + VolParam.lCurve = 1; + Bass.FXSetParameters(VolHandle, VolParam); + } + + public bool SetAttribute(ChannelAttribute attrib, float value) + { + return Bass.ChannelSetAttribute(Handle, attrib, value); + } + public unsafe bool SendReverbEvent(int channel, int param) { - return BassMidi.BASS_MIDI_StreamEvent(Handle, channel, BASSMIDIEvent.MIDI_EVENT_REVERB, param); + return BassMidi.StreamEvent(Handle, channel, MidiEventType.Reverb, param); } public unsafe bool SendChorusEvent(int channel, int param) { - return BassMidi.BASS_MIDI_StreamEvent(Handle, channel, BASSMIDIEvent.MIDI_EVENT_CHORUS, param); + return BassMidi.StreamEvent(Handle, channel, MidiEventType.Chorus, param); } - public int SendEventStruct(BASS_MIDI_EVENT data) + public int SendEventStruct(MidiEvent data) { - return BassMidi.BASS_MIDI_StreamEvents(Handle, BASSMIDIEventMode.BASS_MIDI_EVENTS_STRUCT, new BASS_MIDI_EVENT[] { data }); + return BassMidi.StreamEvents(Handle, MidiEventsMode.Struct, new MidiEvent[] { data }); } public unsafe int SendEventRaw(uint data, int channel) { - var mode = BASSMIDIEventMode.BASS_MIDI_EVENTS_RAW | BASSMIDIEventMode.BASS_MIDI_EVENTS_NORSTATUS; - return BassMidi.BASS_MIDI_StreamEvents(Handle, mode, channel, (IntPtr)(&data), 3); + var mode = MidiEventsMode.Raw | MidiEventsMode.NoRunningStatus; + IntPtr idata = (IntPtr)(&data); + return BassMidi.StreamEvents(Handle, mode, idata, 3); } public unsafe int SendEndEvent() { - var ev = new[] { - new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_END_TRACK, 0, 0, 0, 0), - new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_END, 0, 0, 0, 0), - }; - var mode = BASSMIDIEventMode.BASS_MIDI_EVENTS_TIME | BASSMIDIEventMode.BASS_MIDI_EVENTS_STRUCT; - return BassMidi.BASS_MIDI_StreamEvents(Handle, mode, ev); + bool a = BassMidi.StreamEvent(Handle, 0, MidiEventType.End, 0); + bool b = BassMidi.StreamEvent(Handle, 0, MidiEventType.EndTrack, 0); + return (a && b) ? 0 : -1; } public long Position { - get { return Bass.BASS_ChannelGetPosition(Handle) / 4; } + get { return Bass.ChannelGetPosition(Handle) / 4; } set { throw new NotSupportedException("Can't set position."); } } public long Length { - get { return Bass.BASS_ChannelGetLength(Handle) / 4; } + get { return Bass.ChannelGetLength(Handle) / 4; } } public void Dispose() { - lock (Lock) - Bass.BASS_StreamFree(Handle); + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + lock (Lock) + Bass.StreamFree(Handle); + } + + UniqueID = string.Empty; + ErroredOut = false; + CanSeek = false; + WaveFormat = null; - Debug.PrintToConsole("ok", String.Format("Stream {0} freed.", UniqueID)); + _disposed = true; } } } diff --git a/OmniConverter/Extensions/CommonSoundFonts.cs b/OmniConverter/Extensions/CommonSoundFonts.cs index db38154..e58f653 100644 --- a/OmniConverter/Extensions/CommonSoundFonts.cs +++ b/OmniConverter/Extensions/CommonSoundFonts.cs @@ -1,7 +1,10 @@ -using System; +using ManagedBass; +using ManagedBass.Midi; +using System; using System.Collections.Generic; using System.IO; using System.Linq; + namespace OmniConverter { class CommonSoundFonts @@ -138,11 +141,73 @@ public static bool LoadCSF() MS.Dispose(); Debug.PrintToConsole("ok", "Common SoundFonts list successfully loaded."); + + LoadSoundFonts(); + return true; } Debug.PrintToConsole("ok", "It doesn't."); return false; } + + public static void LoadSoundFonts() + { + var BMFEList = new List(); + + foreach (SoundFont SF in Program.SFArray.List) + { + if (!SF.IsEnabled) + { + Debug.PrintToConsole("ok", "SoundFont is disabled, there's no need to load it."); + continue; + } + + MidiFontEx TSF; + Debug.PrintToConsole("ok", String.Format("Preparing BASS_MIDI_FONTEX for {0}...", SF.GetSoundFontPath)); + + TSF.Handle = BassMidi.FontInit(SF.GetSoundFontPath, SF.GetXGMode ? FontInitFlags.XGDrums : (FontInitFlags)0 | FontInitFlags.Unicode); + Debug.PrintToConsole("ok", String.Format("SoundFont handle initialized. Handle = {0:X8}", TSF.Handle)); + + TSF.SoundFontPreset = SF.GetSourcePreset; + TSF.SoundFontBank = SF.GetSourceBank; + TSF.DestinationPreset = SF.GetDestinationPreset; + TSF.DestinationBank = SF.GetDestinationBank; + TSF.DestinationBankLSB = SF.GetDestinationBankLSB; + Debug.PrintToConsole("ok", + String.Format( + "spreset = {0}, sbank = {1}, dpreset = {2}, dbank = {3}, dbanklsb = {4}, xg = {5}", + TSF.SoundFontPreset, TSF.SoundFontBank, TSF.DestinationPreset, TSF.DestinationBank, TSF.DestinationBankLSB, SF.GetXGMode + ) + ); + + if (TSF.Handle != 0) + { + BassMidi.FontLoad(TSF.Handle, TSF.SoundFontPreset, TSF.SoundFontBank); + BMFEList.Add(TSF); + Debug.PrintToConsole("ok", "SoundFont loaded and added to BASS_MIDI_FONTEX array."); + } + else Debug.PrintToConsole("err", String.Format("Could not load {0}. BASSERR: {1}", SF.GetSoundFontPath, Bass.LastError)); + } + + Debug.PrintToConsole("ok", "Reversing array..."); + BMFEList.Reverse(); + + if (Program.SFArray.BMFEArray != null) + Program.SFArray.BMFEArray = null; + + Program.SFArray.BMFEArray = (MidiFontEx[])Array.CreateInstance(typeof(MidiFontEx), BMFEList.Count); + Array.Copy(BMFEList.ToArray(), Program.SFArray.BMFEArray, BMFEList.Count); + } + + public static void FreeSoundFonts() + { + Debug.PrintToConsole("ok", "Freeing SoundFont handles..."); + foreach (var SF in Program.SFArray.BMFEArray) + BassMidi.FontFree(SF.Handle); + + Debug.PrintToConsole("ok", "Handles freed."); + Program.SFArray.BMFEArray = null; + } } } diff --git a/OmniConverter/Extensions/Converter.cs b/OmniConverter/Extensions/Converter.cs index 7f7473c..d40a600 100644 --- a/OmniConverter/Extensions/Converter.cs +++ b/OmniConverter/Extensions/Converter.cs @@ -10,24 +10,22 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Midi; -using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System; -using Task = System.Threading.Tasks.Task; +using ManagedBass; +using System.Xml; namespace OmniConverter { - class MIDIsValidity + class MIDIValidation { private String CurrentMIDI; private UInt64 ValidMIDIs; private UInt64 InvalidMIDIs; private UInt64 TotalMIDIsCount; - private Int64 Tracks = 0; - private Int64 CurrentTrack = 0; + private int Tracks = 0; + private int CurrentTrack = 0; - public MIDIsValidity() + public MIDIValidation() { CurrentMIDI = ""; ValidMIDIs = 0; @@ -45,11 +43,11 @@ public MIDIsValidity() public UInt64 GetInvalidMIDIsCount() { return InvalidMIDIs; } public UInt64 GetTotalMIDIsCount() { return TotalMIDIsCount; } - public void SetTotalTracks(Int64 T) { Tracks = T; } + public void SetTotalTracks(int T) { Tracks = T; } public void AddTrack() { CurrentTrack++; } public void ResetCurrentTrack() { CurrentTrack = 0; } - public Int64 GetTotalTracks() { return Tracks; } - public Int64 GetCurrentTrack() { return CurrentTrack; } + public int GetTotalTracks() { return Tracks; } + public int GetCurrentTrack() { return CurrentTrack; } } class WaveSampleWriter : ISampleWriter, IDisposable @@ -93,20 +91,37 @@ public ConvertWorker(IEnumerable events, double length) this.length = length; } - public void Convert(ISampleWriter output, WaveFormat format, bool loudmax, CancellationToken cancel) + public void Convert(ISampleWriter output, CSCore.WaveFormat format, CancellationToken cancel) { - try + BASSMIDI bass; + + Debug.PrintToConsole("ok", $"Initializing BASSMIDI for thread..."); + + using (bass = new BASSMIDI(format)) { - using (var bass = new BASSMIDI(format)) + ISampleSource bassSource; + float[] buffer = new float[2048 * 16]; + long prevWriteTime = 0; + double time = 0; + int read; + + /*if (loudmax) bassSource = new AntiClipping(bass, 0.1); + else bassSource = bass;*/ + bassSource = bass; //Why the hell was it running loudmax twice lol + Debug.PrintToConsole("ok", $"Initialized {bass.UniqueID}."); + + // Prepare stream + if (Properties.Settings.Default.RVOverrideToggle) + { + for (int i = 0; i <= 15; i++) + { + bass.SendReverbEvent(i, Properties.Settings.Default.ReverbValue); + bass.SendChorusEvent(i, Properties.Settings.Default.ChorusValue); + } + } + + try { - ISampleSource bassSource; - /*if (loudmax) bassSource = new AntiClipping(bass, 0.1); - else bassSource = bass;*/ - bassSource = bass; //Why the hell was it running loudmax twice lol - float[] buffer = new float[2048 * 16]; - long prevWriteTime = 0; - double time = 0; - int read; foreach (MIDIEvent e in events) { cancel.ThrowIfCancellationRequested(); @@ -150,16 +165,11 @@ public void Convert(ISampleWriter output, WaveFormat format, bool loudmax, Cance } else if (e is ControlChangeEvent) { - if(Properties.Settings.Default.RVOverrideToggle) - { - for(int i = 0; i <= 15; i++) - { - bass.SendReverbEvent(i, Properties.Settings.Default.ReverbValue); - bass.SendChorusEvent(i, Properties.Settings.Default.ChorusValue); - } - } - var ev = e as ControlChangeEvent; + + if (Properties.Settings.Default.RVOverrideToggle && (ev.Controller == 0x5B || ev.Controller == 0x5D)) + continue; + bass.SendEventRaw((uint)(0xB0 | (ev.Controller << 8) | (ev.Value << 16)), ev.Channel + 1); } else if (e is ProgramChangeEvent) @@ -176,24 +186,31 @@ public void Convert(ISampleWriter output, WaveFormat format, bool loudmax, Cance { var ev = e as PitchWheelChangeEvent; var val = ev.Value + 8192; + bass.SendEventRaw((uint)(ev.Channel | 0xE0 | ((val & 0x7F) << 8) | (((val >> 7) & 0x7F) << 16)), 0); } } - bass.SendEndEvent(); - while ((read = bassSource.Read(buffer, 0, buffer.Length)) != 0) - { - output.Write(buffer, 0, read); - } + } + catch (OperationCanceledException) { } + catch (Exception ex) + { + if (bass != null) + Debug.PrintToConsole("wrn", $"{bass.UniqueID} - DataParsingError {ex}"); + } + + bass.SendEndEvent(); + while ((read = bassSource.Read(buffer, 0, buffer.Length)) != 0) + { + output.Write(buffer, 0, read); } } - catch (OperationCanceledException) { } } } class Converter { public CancellationTokenSource CTS; - public MIDIsValidity MDV; + public MIDIValidation MDV; private String Status = "prep"; private String StError = ""; @@ -204,18 +221,10 @@ class Converter public Converter(Control Form, Panel ThreadsPanel, String OPath) { - MDV = new MIDIsValidity(); + MDV = new MIDIValidation(); - if (Properties.Settings.Default.PerTrackExport) - { - CThread = new Thread(() => MIDIConversionTbT(Form, ThreadsPanel, OPath)); - Debug.PrintToConsole("ok", "CThread = MIDIConversionTbT"); - } - else - { - CThread = new Thread(() => MIDIConversion(Form, ThreadsPanel, OPath)); - Debug.PrintToConsole("ok", "CThread = MIDIConversion"); - } + CThread = new Thread(() => MIDIConversion(Form, ThreadsPanel, OPath)); + Debug.PrintToConsole("ok", "CThread allocated."); CThread.IsBackground = true; CThread.Start(); @@ -224,372 +233,285 @@ public Converter(Control Form, Panel ThreadsPanel, String OPath) public Boolean IsStillRendering() { return CThread.IsAlive; } public void RequestStop() { StopRequested = true; CTS.Cancel(); } - public void ForceStop() { CThread.Abort(); } public String GetStatus() { return Status; } public string GetError() { return StError; } - private void LoadSoundFonts() + private void PerMIDIConv(int MT, CSCore.WaveFormat WF, Panel ThreadsPanel, string OPath) { - List BMFEList = new List(); - - foreach (SoundFont SF in Program.SFArray.List) + try { - if (!SF.IsEnabled) + Debug.PrintToConsole("ok", "Preparing Parallel.ForEach loop..."); + CTS = new CancellationTokenSource(); + ParallelOptions PO = new ParallelOptions { MaxDegreeOfParallelism = MT, CancellationToken = CTS.Token }; + Debug.PrintToConsole("ok", String.Format("ParallelOptions prepared, MaxDegreeOfParallelism = {0}", MT)); + ParallelFor(0, Program.MIDIList.Count, MT, CTS.Token, T => { - Debug.PrintToConsole("ok", "SoundFont is disabled, there's no need to load it."); - continue; - } - - BASS_MIDI_FONTEX TSF; - Debug.PrintToConsole("ok", String.Format("Preparing BASS_MIDI_FONTEX for {0}...", SF.GetSoundFontPath)); - - TSF.font = BassMidi.BASS_MIDI_FontInit(SF.GetSoundFontPath, SF.GetXGMode ? BASSFlag.BASS_MIDI_FONT_XGDRUMS : BASSFlag.BASS_DEFAULT); - Debug.PrintToConsole("ok", String.Format("SoundFont handle initialized. Handle = {0:X8}", TSF.font)); - - TSF.spreset = SF.GetSourcePreset; - TSF.sbank = SF.GetSourceBank; - TSF.dpreset = SF.GetDestinationPreset; - TSF.dbank = SF.GetDestinationBank; - TSF.dbanklsb = SF.GetDestinationBankLSB; - Debug.PrintToConsole("ok", - String.Format( - "spreset = {0}, sbank = {1}, dpreset = {2}, dbank = {3}, dbanklsb = {4}, xg = {5}", - TSF.spreset, TSF.sbank, TSF.dpreset, TSF.dbank, TSF.dbanklsb, SF.GetXGMode - ) - ); - - if (TSF.font != 0) - { - BMFEList.Add(TSF); - Debug.PrintToConsole("ok", "SoundFont loaded and added to BASS_MIDI_FONTEX array."); - } - else Debug.PrintToConsole("err", String.Format("Could not load {0}. BASSERR: {1}", SF.GetSoundFontPath, Bass.BASS_ErrorGetCode())); - } + if (StopRequested) + { + Debug.PrintToConsole("ok", "Stop requested. Stopping ParallelFor..."); + throw new OperationCanceledException(); + } - Debug.PrintToConsole("ok", "Reversing array..."); - BMFEList.Reverse(); + MIDI MFile = Program.MIDIList[T]; - if (Program.SFArray.BMFEArray != null) - Program.SFArray.BMFEArray = null; + // Begin conversion + Status = "sconv"; + MDV.SetCurrentMIDI(MFile.Path); - Program.SFArray.BMFEArray = (BASS_MIDI_FONTEX[])Array.CreateInstance(typeof(BASS_MIDI_FONTEX), BMFEList.Count); - Array.Copy(BMFEList.ToArray(), Program.SFArray.BMFEArray, BMFEList.Count); - } + // Prepare the filename + String OutputDir = String.Format("{0}\\{1}.{2}", + OPath, Path.GetFileNameWithoutExtension(MFile.Name), Properties.Settings.Default.Codec); - private void FreeSoundFonts() - { - Debug.PrintToConsole("ok", "Freeing SoundFont handles..."); - foreach (BASS_MIDI_FONTEX SF in Program.SFArray.BMFEArray) - BassMidi.BASS_MIDI_FontFree(SF.font); + // Check if file already exists + if (File.Exists(OutputDir)) + OutputDir = String.Format("{0}\\{1} - {2}.{3}", + OPath, Path.GetFileNameWithoutExtension(MFile.Name), + DateTime.Now.ToString("dd-MM-yyyy HHmmsstt"), Properties.Settings.Default.Codec); - Debug.PrintToConsole("ok", "Handles freed."); - Program.SFArray.BMFEArray = null; - } + Debug.PrintToConsole("ok", String.Format("Output file: {0}", OutputDir)); - private void MIDIConversion(Control Form, Panel ThreadsPanel, String OPath) - { - try - { - Status = "prep"; - Int32 MT = Properties.Settings.Default.MultiThreadedMode ? Properties.Settings.Default.MultiThreadedLimitV : 1; - WaveFormat WF = new WaveFormat(Properties.Settings.Default.Frequency, 32, 2, AudioEncoding.IeeeFloat); + TaskStatus MIDIT = new TaskStatus(MFile.Name); + MIDIT.Dock = DockStyle.Top; + ThreadsPanel.Invoke((MethodInvoker)delegate { ThreadsPanel.Controls.Add(MIDIT); }); - Debug.PrintToConsole("ok", "Initializing BASS..."); - if (!Bass.BASS_Init(0, WF.SampleRate, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) - throw new Exception("Unable to initialize BASS!"); + ConvertWorker Worker = new ConvertWorker(MFile.GetFullMIDITimeBased(), MFile.TimeLength.TotalSeconds); - LoadSoundFonts(); + Stream FOpen = new BufferedStream(File.Open(OutputDir, FileMode.Create), 65536); + WaveWriter Destination = new WaveWriter(FOpen, WF); + ISampleWriter Writer = new WaveSampleWriter(Destination); + Debug.PrintToConsole("ok", "Output file is open."); - try - { - Debug.PrintToConsole("ok", "Preparing Parallel.ForEach loop..."); - CTS = new CancellationTokenSource(); - ParallelOptions PO = new ParallelOptions { MaxDegreeOfParallelism = MT, CancellationToken = CTS.Token }; - Debug.PrintToConsole("ok", String.Format("ParallelOptions prepared, MaxDegreeOfParallelism = {0}", MT)); + var ConvThread = Task.Run(() => Worker.Convert(Writer, WF, PO.CancellationToken)); - Parallel.ForEach(Program.MIDIList, PO, (MFile, LS) => + int ov = 0; + while (!ConvThread.IsCompleted) { - if (StopRequested) - { - Debug.PrintToConsole("ok", "Stop requested. Stopping Parallel.ForEach..."); - LS.Stop(); - return; - } - - IWaveSource Stream; - - // Begin conversion - Status = "sconv"; - MDV.SetCurrentMIDI(MFile.Path); - - // Prepare the filename - String OutputDir = String.Format("{0}\\{1}.{2}", - OPath, Path.GetFileNameWithoutExtension(MFile.Name), Properties.Settings.Default.Codec); - - // Check if file already exists - if (File.Exists(OutputDir)) - OutputDir = String.Format("{0}\\{1} - {2}.{3}", - OPath, Path.GetFileNameWithoutExtension(MFile.Name), - DateTime.Now.ToString("dd-MM-yyyy HHmmsstt"), Properties.Settings.Default.Codec); - - Debug.PrintToConsole("ok", String.Format("Output file: {0}", OutputDir)); - - MIDIThreadStatus MIDIT = new MIDIThreadStatus(MFile.Name); - MIDIT.Dock = DockStyle.Top; - ThreadsPanel.Invoke((MethodInvoker)delegate - { - Debug.PrintToConsole("ok", "Added MIDIThreadStatus control for MIDI."); - ThreadsPanel.Controls.Add(MIDIT); - }); - - ConvertWorker Worker = new ConvertWorker(MFile.GetFullMIDITimeBased(), MFile.TimeLength.TotalSeconds); - - Stream FOpen = new BufferedStream(File.Open(OutputDir, FileMode.Create), 65536); - WaveWriter Destination = new WaveWriter(FOpen, WF); - ISampleWriter Writer = new WaveSampleWriter(Destination); - Debug.PrintToConsole("ok", "Output file is open."); + var v = Convert.ToInt32(Math.Round(Worker.Progress * 100)); - var ConvThread = Task.Run(() => - { - Worker.Convert(Writer, WF, Properties.Settings.Default.LoudMax, PO.CancellationToken); - }); + if (StopRequested) + break; - while (!ConvThread.IsCompleted) + if (ov != v) { - if (StopRequested) - break; + ov = v; - MIDIT.Invoke((MethodInvoker)delegate - { - MIDIT.UpdatePB(Convert.ToInt32(Math.Round(Worker.Progress * 100))); - }); - - Thread.Sleep(1); + MIDIT.UpdateTitle($"{v}%"); + MIDIT.UpdatePB(v); } + } - ConvThread.Wait(); - - Debug.PrintToConsole("ok", String.Format("Thread for MIDI {0} is done rendering data.", OutputDir)); - - ThreadsPanel.Invoke((MethodInvoker)delegate - { - Debug.PrintToConsole("ok", "Removed MIDIThreadStatus control for MIDI."); - ThreadsPanel.Controls.Remove(MIDIT); - }); + ConvThread.Wait(); + ConvThread.Dispose(); - if (!StopRequested) MDV.AddValidMIDI(); + Debug.PrintToConsole("ok", String.Format("Thread for MIDI {0} is done rendering data.", OutputDir)); - Destination.Dispose(); - FOpen.Dispose(); - }); - } - catch (OperationCanceledException) { } - finally { CTS.Dispose(); CTS = null; } + ThreadsPanel.Invoke((MethodInvoker)delegate { MIDIT.Dispose(); }); - FreeSoundFonts(); + if (!StopRequested) MDV.AddValidMIDI(); - Debug.PrintToConsole("ok", "BASS freed."); - Bass.BASS_Free(); + if (Destination != null) Destination.Dispose(); + if (FOpen != null) FOpen.Dispose(); + }); } catch (Exception ex) { - Status = "crsh"; - StError = String.Format("The converter encountered an error during the conversion process.\nError: {0}", ex.Message.ToString()); - IsCrash = true; - Debug.PrintToConsole("err", String.Format("{0} - {1}", ex.InnerException.ToString(), ex.Message.ToString())); } - - if (!StopRequested && !IsCrash) - Form.Invoke((MethodInvoker)delegate { ((Form)Form).Close(); }); + finally { CTS.Dispose(); CTS = null; } } - private void MIDIConversionTbT(Control Form, Panel ThreadsPanel, String OPath) + private void PerTrackConv(int MT, CSCore.WaveFormat WF, Panel ThreadsPanel, string OPath) { - try + foreach (MIDI MFile in Program.MIDIList) { - Status = "prep"; - Int32 MT = Properties.Settings.Default.MultiThreadedMode ? Properties.Settings.Default.MultiThreadedLimitV : 1; - WaveFormat WF = new WaveFormat(Properties.Settings.Default.Frequency, 32, 2, AudioEncoding.IeeeFloat); + if (StopRequested) + { + Debug.PrintToConsole("ok", "Stop requested. Stopping PerTrackConv..."); + break; + } + + MultiStreamMerger MSM = new MultiStreamMerger(WF); + int t = 0; - // Initialize BASS - Debug.PrintToConsole("ok", "Initializing BASS..."); - if (!Bass.BASS_Init(0, WF.SampleRate, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) - throw new Exception("Unable to initialize BASS!"); + MDV.SetTotalTracks(MFile.Tracks); + MDV.ResetCurrentTrack(); - LoadSoundFonts(); + // Begin conversion + Status = "mconv"; - foreach (MIDI MFile in Program.MIDIList) + try { - MultiStreamMerger MSM = new MultiStreamMerger(WF); + CTS = new CancellationTokenSource(); + Debug.PrintToConsole("ok", $"PerTrackConv => MaxDegreeOfParallelism = {MT}"); - if (StopRequested) + ParallelFor(0, MFile.Tracks, MT, CTS.Token, T => { - Debug.PrintToConsole("ok", "Stop requested. Stopping foreach loop..."); - break; - } - - int t = 0; - MDV.SetTotalTracks(MFile.Tracks); - MDV.ResetCurrentTrack(); + if (StopRequested) + { + Debug.PrintToConsole("ok", "Stop requested. Stopping ParallelFor..."); + throw new OperationCanceledException(); + } - // Begin conversion - Status = "mconv"; + if (MFile.NoteCount >= 0) + { + TaskStatus Trck = new TaskStatus($"Track {T}"); + Trck.Dock = DockStyle.Top; + ThreadsPanel.Invoke((MethodInvoker)delegate { ThreadsPanel.Controls.Add(Trck); }); - try - { - CTS = new CancellationTokenSource(); - Debug.PrintToConsole("ok", String.Format("Preparing loop... MaxDegreeOfParallelism = {0}", MT)); + ConvertWorker Worker = new ConvertWorker(MFile.GetSingleTrackTimeBased(T), MFile.TimeLength.TotalSeconds); + ISampleWriter Writer; + WaveWriter SDestination = null; + FileStream SFOpen = null; + Debug.PrintToConsole("ok", $"ConvertWorker => T{T}, {MFile.TimeLength.TotalSeconds}"); - ParallelFor(0, MFile.Tracks, MT, CTS.Token, T => - { - if (StopRequested) + if (Properties.Settings.Default.PerTrackSeparateFiles) { - Debug.PrintToConsole("ok", "Stop requested. Stopping Parallel.For..."); - //LS.Stop(); - return; + // Check if we need to export each track to a file + String Folder = OPath; + if (Properties.Settings.Default.PerTrackSeparateFiles) + { + // We do, create folder + Folder += String.Format("\\{0}\\", Path.GetFileNameWithoutExtension(MFile.Name)); + + if (!Directory.Exists(Folder)) + Directory.CreateDirectory(Folder); + } + else Folder += " "; + + // Prepare the filename + String SOutputDir = String.Format("{0}Track {1}.{2}", + Folder, T, Properties.Settings.Default.Codec); + + // Check if file already exists + if (File.Exists(SOutputDir)) + SOutputDir = String.Format("{0}Track {1} - {2}.{3}", + Folder, T, DateTime.Now.ToString("dd-MM-yyyy HHmmsstt"), Properties.Settings.Default.Codec); + + Debug.PrintToConsole("ok", String.Format("{0} - Output file: {1}", T, SOutputDir)); + + SFOpen = File.Open(SOutputDir, FileMode.Create); + SDestination = new WaveWriter(SFOpen, WF); + Writer = new WaveSampleWriter(SDestination); } + else Writer = MSM.GetWriter(); - if (MFile.NoteCount > 0) + var ConvThread = Task.Run(() => Worker.Convert(Writer, WF, CTS.Token)); + Debug.PrintToConsole("ok", $"ConvThread started for T{T}"); + + int ov = 0; + while (!ConvThread.IsCompleted) { - TrackThreadStatus Trck = new TrackThreadStatus(T); - Trck.Dock = DockStyle.Top; - ThreadsPanel.Invoke((MethodInvoker)delegate - { - Debug.PrintToConsole("ok", "Added TrackThreadStatus control for MIDI."); - ThreadsPanel.Controls.Add(Trck); - }); + var v = Convert.ToInt32(Math.Round(Worker.Progress * 100)); - ConvertWorker Worker = new ConvertWorker(MFile.GetSingleTrackTimeBased((int)T), MFile.TimeLength.TotalSeconds); - ISampleWriter Writer; - WaveWriter SDestination = null; - FileStream SFOpen = null; + if (StopRequested) + break; - if (Properties.Settings.Default.PerTrackSeparateFiles) + if (ov != v) { - // Check if we need to export each track to a file - String Folder = OPath; - if (Properties.Settings.Default.PerTrackSeparateFiles) - { - // We do, create folder - Folder += String.Format("\\{0}\\", Path.GetFileNameWithoutExtension(MFile.Name)); - - if (!Directory.Exists(Folder)) - Directory.CreateDirectory(Folder); - } - else Folder += " "; - - // Prepare the filename - String SOutputDir = String.Format("{0}Track {1}.{2}", - Folder, T, Properties.Settings.Default.Codec); - - // Check if file already exists - if (File.Exists(SOutputDir)) - SOutputDir = String.Format("{0}Track {1} - {2}.{3}", - Folder, T, DateTime.Now.ToString("dd-MM-yyyy HHmmsstt"), Properties.Settings.Default.Codec); - - Debug.PrintToConsole("ok", String.Format("{0} - Output file: {1}", T, SOutputDir)); - - SFOpen = File.Open(SOutputDir, FileMode.Create); - SDestination = new WaveWriter(SFOpen, WF); - Writer = new WaveSampleWriter(SDestination); + ov = v; + + Trck.UpdateTitle($"{v}%"); + Trck.UpdatePB(v); } - else Writer = MSM.GetWriter(); + } - var ConvThread = Task.Run(() => - { - Worker.Convert(Writer, WF, false, CTS.Token); - }); + ConvThread.Wait(); + ConvThread.Dispose(); - while (!ConvThread.IsCompleted) - { - if (StopRequested) - break; + if (Writer != null) + { + if (Writer.GetType() == typeof(MultiStreamMerger)) + ((MultiStreamMerger)Writer).Dispose(); + else if (Writer.GetType() == typeof(WaveSampleWriter)) + ((WaveSampleWriter)Writer).Dispose(); + } - Trck.Invoke((MethodInvoker)delegate - { - Trck.UpdatePB(Convert.ToInt32(Math.Round(Worker.Progress * 100))); - }); + ThreadsPanel.Invoke((MethodInvoker)delegate { Trck.Dispose(); }); - Thread.Sleep(1); - } + if (SDestination != null) SDestination.Dispose(); + if (SFOpen != null) SFOpen.Dispose(); - ConvThread.Wait(); + if (!StopRequested) MDV.AddTrack(); + } + }); + } + catch (OperationCanceledException) { } + catch (Exception ex) + { + Debug.PrintToConsole("err", String.Format("{0} - {1}", ex.InnerException.ToString(), ex.Message.ToString())); + } + finally { CTS.Dispose(); CTS = null; } - if (Writer != null) - { - if (Writer.GetType() == typeof(MultiStreamMerger)) - ((MultiStreamMerger)Writer).Dispose(); - else if (Writer.GetType() == typeof(WaveSampleWriter)) - ((WaveSampleWriter)Writer).Dispose(); - } + if (StopRequested) + break; + else MDV.AddValidMIDI(); - ThreadsPanel.Invoke((MethodInvoker)delegate - { - Debug.PrintToConsole("ok", "Removed TrackThreadStatus control for MIDI."); - ThreadsPanel.Controls.Remove(Trck); - }); + // Time to save the file + String OutputDir = String.Format("{0}\\{1}.{2}", + OPath, Path.GetFileNameWithoutExtension(MFile.Name), Properties.Settings.Default.Codec); - if (SDestination != null) SDestination.Dispose(); - if (SFOpen != null) SFOpen.Dispose(); + // Check if file already exists + if (File.Exists(OutputDir)) + OutputDir = String.Format("{0}\\{1} - {2}.{3}", + OPath, Path.GetFileNameWithoutExtension(MFile.Name), + DateTime.Now.ToString("yyyyMMdd HHmmsstt"), Properties.Settings.Default.Codec); - if (!StopRequested) MDV.AddTrack(); - } - }); - } - catch (OperationCanceledException) { } - finally { CTS.Dispose(); CTS = null; } + Debug.PrintToConsole("ok", String.Format("Output file: {0}", OutputDir)); - if (StopRequested) - break; - else MDV.AddValidMIDI(); + // Reset MSM position + MSM.Position = 0; - // Time to save the file - String OutputDir = String.Format("{0}\\{1}.{2}", - OPath, Path.GetFileNameWithoutExtension(MFile.Name), Properties.Settings.Default.Codec); + // Prepare wave source + IWaveSource MStream; + if (Properties.Settings.Default.LoudMax) + { + Debug.PrintToConsole("ok", "LoudMax enabled."); + AntiClipping BAC = new AntiClipping(MSM, 0.1); + MStream = BAC.ToWaveSource(32); + } + else MStream = MSM.ToWaveSource(32); - // Check if file already exists - if (File.Exists(OutputDir)) - OutputDir = String.Format("{0}\\{1} - {2}.{3}", - OPath, Path.GetFileNameWithoutExtension(MFile.Name), - DateTime.Now.ToString("dd-MM-yyyy HHmmsstt"), Properties.Settings.Default.Codec); + FileStream FOpen = File.Open(OutputDir, FileMode.Create); + WaveWriter Destination = new WaveWriter(FOpen, WF); + Debug.PrintToConsole("ok", "Output file is open."); - Debug.PrintToConsole("ok", String.Format("Output file: {0}", OutputDir)); + Int32 FRead = 0; + byte[] FBuffer = new byte[1024 * 16]; - // Reset MSM position - MSM.Position = 0; + Status = "aout"; + Debug.PrintToConsole("ok", String.Format("Writing data for {0} to disk...", OutputDir)); + while ((FRead = MStream.Read(FBuffer, 0, FBuffer.Length)) != 0) + Destination.Write(FBuffer, 0, FRead); + Debug.PrintToConsole("ok", String.Format("Done writing {0}.", OutputDir)); - // Prepare wave source - IWaveSource MStream; - if (Properties.Settings.Default.LoudMax) - { - Debug.PrintToConsole("ok", "LoudMax enabled."); - AntiClipping BAC = new AntiClipping(MSM, 0.1); - MStream = BAC.ToWaveSource(32); - } - else MStream = MSM.ToWaveSource(32); + Destination.Dispose(); + FOpen.Dispose(); + } + } - FileStream FOpen = File.Open(OutputDir, FileMode.Create); - WaveWriter Destination = new WaveWriter(FOpen, WF); - Debug.PrintToConsole("ok", "Output file is open."); + private void MIDIConversion(Control Form, Panel ThreadsPanel, string OPath) + { + var MT = Properties.Settings.Default.MultiThreadedMode ? Properties.Settings.Default.MultiThreadedLimitV : 1; + var WF = new CSCore.WaveFormat(Properties.Settings.Default.Frequency, 32, 2, AudioEncoding.IeeeFloat); - Int32 FRead = 0; - byte[] FBuffer = new byte[1024 * 16]; + Status = "prep"; - Status = "aout"; - Debug.PrintToConsole("ok", String.Format("Writing data for {0} to disk...", OutputDir)); - while ((FRead = MStream.Read(FBuffer, 0, FBuffer.Length)) != 0) - Destination.Write(FBuffer, 0, FRead); - Debug.PrintToConsole("ok", String.Format("Done writing {0}.", OutputDir)); + Debug.PrintToConsole("ok", "Initializing BASS..."); + + if (!Bass.Init(Bass.NoSoundDevice, WF.SampleRate, DeviceInitFlags.Default)) + throw new Exception("Unable to initialize BASS!"); - Destination.Dispose(); - FOpen.Dispose(); - } + Debug.PrintToConsole("ok", $"BASS initialized. (ERR: {Bass.LastError})"); - FreeSoundFonts(); + try + { + if (Properties.Settings.Default.PerTrackExport) + PerTrackConv(MT, WF, ThreadsPanel, OPath); + else + PerMIDIConv(MT, WF, ThreadsPanel, OPath); Debug.PrintToConsole("ok", "BASS freed."); - Bass.BASS_Free(); + Bass.Free(); } catch (Exception ex) { @@ -604,21 +526,17 @@ private void MIDIConversionTbT(Control Form, Panel ThreadsPanel, String OPath) Form.Invoke((MethodInvoker)delegate { ((Form)Form).Close(); }); } - static void ParallelFor(Int32 from, Int32 to, int threads, CancellationToken cancel, Action func) + static void ParallelFor(int from, int to, int threads, CancellationToken cancel, Action func) { - Dictionary tasks = new Dictionary(); - BlockingCollection completed = new BlockingCollection(); + Dictionary tasks = new Dictionary(); + BlockingCollection completed = new BlockingCollection(); - void RunTask(Int32 i) + void RunTask(int i) { var t = new Task(() => { - try - { - func(i); - completed.Add(i); - } - catch (Exception e) { } + func(i); + completed.Add(i); }); tasks.Add(i, t); t.Start(); @@ -631,7 +549,7 @@ void TryTake() tasks.Remove(t); } - for (Int32 i = from; i < to; i++) + for (int i = from; i < to; i++) { RunTask(i); if (tasks.Count > threads) TryTake(); diff --git a/OmniConverter/Extensions/DataCheck.cs b/OmniConverter/Extensions/DataCheck.cs index f2e2db6..172f661 100644 --- a/OmniConverter/Extensions/DataCheck.cs +++ b/OmniConverter/Extensions/DataCheck.cs @@ -3,8 +3,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Midi; namespace OmniConverter { diff --git a/OmniConverter/Extensions/MIDI.cs b/OmniConverter/Extensions/MIDI.cs index e869561..b142a9e 100644 --- a/OmniConverter/Extensions/MIDI.cs +++ b/OmniConverter/Extensions/MIDI.cs @@ -13,8 +13,9 @@ public class MIDI : IDisposable { private MidiFile LoadedFile; private IEnumerable MetaEvents; + private bool _disposed = false; - private MIDI(Int64 I, String FN, String FP, MidiFile LF, IEnumerable ME, TimeSpan TL, Int32 T, Int64 NC, UInt64 S) + private MIDI(long I, string FN, string FP, MidiFile LF, IEnumerable ME, TimeSpan TL, int T, long NC, ulong S) { ID = I; Name = FN; @@ -27,8 +28,8 @@ private MIDI(Int64 I, String FN, String FP, MidiFile LF, IEnumerable MetaEvents = ME; } - public IEnumerable GetSingleTrackTimeBased(Int32 track) => - LoadedFile.GetTrack((Int32)track).MergeWith(MetaEvents).MakeTimeBased(LoadedFile.PPQ); + public IEnumerable GetSingleTrackTimeBased(int track) => + LoadedFile.GetTrack(track).MergeWith(MetaEvents).MakeTimeBased(LoadedFile.PPQ); public IEnumerable GetFullMIDITimeBased() => LoadedFile.IterateTracks().MergeAll().MakeTimeBased(LoadedFile.PPQ); @@ -36,25 +37,25 @@ public IEnumerable GetFullMIDITimeBased() => public IEnumerable> GetIterateTracksTimeBased() => LoadedFile.IterateTracks().Select(track => track.MergeWith(MetaEvents).MakeTimeBased(LoadedFile.PPQ)); - public Int64 ID { get; } - public String Name { get; } - public String Path { get; } - public TimeSpan TimeLength { get; } - public Int32 Tracks { get; } - public Int64 NoteCount { get; } - public UInt64 Size { get; } + public long ID { get; private set; } + public string Name { get; private set; } + public string Path { get; private set; } + public TimeSpan TimeLength { get; private set; } + public int Tracks { get; private set; } + public long NoteCount { get; private set; } + public ulong Size { get; private set; } - public static MIDI LoadFromFile(long id, string filepath, string name, Action progressCallback) + public static MIDI LoadFromFile(long id, string filepath, string name, Action progressCallback) { var file = new MidiFile(filepath); ulong fileSize = (ulong)new FileInfo(filepath).Length; double maxTicks = 0; - Int64 noteCount = 0; + long noteCount = 0; object l = new object(); var midiMetaEvents = new List>(); - Int64 tracksParsed = 0; + int tracksParsed = 0; // loop over all tracks in parallel Parallel.ForEach(file.IterateTracks(), ev => @@ -121,7 +122,28 @@ e is ChannelPressureEvent || public void Dispose() { - LoadedFile.Dispose(); + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + LoadedFile.Dispose(); + + MetaEvents = Enumerable.Empty(); + ID = 0; + Name = string.Empty; + Path = string.Empty; + TimeLength = TimeSpan.Zero; + Tracks = 0; + NoteCount = 0; + Size = 0; + + _disposed = true; } } } diff --git a/OmniConverter/Extensions/ManagedBass/VolumeFx.cs b/OmniConverter/Extensions/ManagedBass/VolumeFx.cs new file mode 100644 index 0000000..eed27c3 --- /dev/null +++ b/OmniConverter/Extensions/ManagedBass/VolumeFx.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ManagedBass.Fx +{ + internal class VolumeFx : Effect + { + /// + /// The new volume level... 0 = silent, 1.0 = normal, above 1.0 = amplification. The default value is 1. + /// + public float Target + { + get => Parameters.fTarget; + set + { + Parameters.fTarget = value; + OnPropertyChanged(); + } + } + + /// + /// The current volume level... -1 = leave existing current level when setting parameters. The default value is 1. + /// + public float Current + { + get => Parameters.fCurrent; + set + { + Parameters.fCurrent = value; + OnPropertyChanged(); + } + } + + /// + /// The time to take to transition from the current level to the new level, in seconds. The default value is 0. + /// + public float Time + { + get => Parameters.fTime; + set + { + Parameters.fTime = value; + OnPropertyChanged(); + } + } + + /// + /// The curve to use in the transition... False for linear, true for logarithmic. The default value is false. + /// + public bool Curve + { + get => Convert.ToBoolean(Parameters.lCurve); + set + { + Parameters.lCurve = (uint)(value == true ? 1 : 0); + OnPropertyChanged(); + } + } + + /// + /// A flag to define on which channels to apply the effect. Default: + /// + public FXChannelFlags Channels + { + get => Parameters.lChannel; + set + { + Parameters.lChannel = value; + + OnPropertyChanged(); + } + } + } +} diff --git a/OmniConverter/Extensions/ManagedBass/VolumeFxParameters.cs b/OmniConverter/Extensions/ManagedBass/VolumeFxParameters.cs new file mode 100644 index 0000000..dba656c --- /dev/null +++ b/OmniConverter/Extensions/ManagedBass/VolumeFxParameters.cs @@ -0,0 +1,38 @@ +using System.Runtime.InteropServices; + +namespace ManagedBass.Fx +{ + [StructLayout(LayoutKind.Sequential)] + internal class VolumeFxParameters : IEffectParameter + { + /// + /// The new volume level... 0 = silent, 1.0 = normal, above 1.0 = amplification. The default value is 1. + /// + public float fTarget = 1.0f; + + /// + /// The current volume level... -1 = leave existing current level when setting parameters. The default value is 1. + /// + public float fCurrent = 1.0f; + + /// + /// The time to take to transition from the current level to the new level, in seconds. The default value is 0. + /// + public float fTime = 0; + + /// + /// The curve to use in the transition... 0 = linear, 1 = logarithmic. The default value is 0. + /// + public uint lCurve = 0; + + /// + /// A flag to define on which channels to apply the effect. Default: + /// + public FXChannelFlags lChannel = FXChannelFlags.All; + + /// + /// Gets the . + /// + public EffectType FXType => EffectType.Volume; + } +} diff --git a/OmniConverter/Extensions/MandatoryClasses.cs b/OmniConverter/Extensions/MandatoryClasses.cs index 66c276b..3ff9fc2 100644 --- a/OmniConverter/Extensions/MandatoryClasses.cs +++ b/OmniConverter/Extensions/MandatoryClasses.cs @@ -1,6 +1,6 @@ -using System; +using ManagedBass.Midi; +using System; using System.Collections.Generic; -using Un4seen.Bass.AddOn.Midi; namespace OmniConverter { @@ -80,7 +80,7 @@ public VST() public class SoundFonts { public List List; - public BASS_MIDI_FONTEX[] BMFEArray; + public MidiFontEx[] BMFEArray; public SoundFonts() { diff --git a/OmniConverter/Forms/InfoWindow.Designer.cs b/OmniConverter/Forms/InfoWindow.Designer.cs index 2f40339..3826f98 100644 --- a/OmniConverter/Forms/InfoWindow.Designer.cs +++ b/OmniConverter/Forms/InfoWindow.Designer.cs @@ -28,342 +28,366 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.OCBigLogo = new System.Windows.Forms.PictureBox(); - this.VerLabel = new System.Windows.Forms.Label(); - this.OKBtn = new System.Windows.Forms.Button(); - this.CopyrightLabel = new System.Windows.Forms.Label(); - this.GitHubPage = new System.Windows.Forms.PictureBox(); - this.DIGroup = new System.Windows.Forms.GroupBox(); - this.CurBranch = new System.Windows.Forms.Label(); - this.BASSMIDIVer = new System.Windows.Forms.Label(); - this.BASSVer = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.RAMAmount = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.WinVer = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.WinName = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.BranchToolTip = new System.Windows.Forms.ToolTip(this.components); - this.ChangeBranch = new System.Windows.Forms.Button(); - this.CheckForUpdates = new System.Windows.Forms.Button(); - this.OMLicense = new System.Windows.Forms.PictureBox(); - this.DonateKep = new System.Windows.Forms.LinkLabel(); - this.DonateArd = new System.Windows.Forms.LinkLabel(); - ((System.ComponentModel.ISupportInitialize)(this.OCBigLogo)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.GitHubPage)).BeginInit(); - this.DIGroup.SuspendLayout(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.OMLicense)).BeginInit(); - this.SuspendLayout(); + components = new System.ComponentModel.Container(); + OCBigLogo = new System.Windows.Forms.PictureBox(); + VerLabel = new System.Windows.Forms.Label(); + OKBtn = new System.Windows.Forms.Button(); + CopyrightLabel = new System.Windows.Forms.Label(); + GitHubPage = new System.Windows.Forms.PictureBox(); + DIGroup = new System.Windows.Forms.GroupBox(); + CurBranch = new System.Windows.Forms.Label(); + BASSMIDIVer = new System.Windows.Forms.Label(); + BASSVer = new System.Windows.Forms.Label(); + label9 = new System.Windows.Forms.Label(); + label5 = new System.Windows.Forms.Label(); + label4 = new System.Windows.Forms.Label(); + label1 = new System.Windows.Forms.Label(); + groupBox1 = new System.Windows.Forms.GroupBox(); + RAMAmount = new System.Windows.Forms.Label(); + label11 = new System.Windows.Forms.Label(); + WinVer = new System.Windows.Forms.Label(); + label7 = new System.Windows.Forms.Label(); + WinName = new System.Windows.Forms.Label(); + label8 = new System.Windows.Forms.Label(); + BranchToolTip = new System.Windows.Forms.ToolTip(components); + ChangeBranch = new System.Windows.Forms.Button(); + CheckForUpdates = new System.Windows.Forms.Button(); + OMLicense = new System.Windows.Forms.PictureBox(); + DonateKep = new System.Windows.Forms.LinkLabel(); + DonateArd = new System.Windows.Forms.LinkLabel(); + ((System.ComponentModel.ISupportInitialize)OCBigLogo).BeginInit(); + ((System.ComponentModel.ISupportInitialize)GitHubPage).BeginInit(); + DIGroup.SuspendLayout(); + groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)OMLicense).BeginInit(); + SuspendLayout(); // // OCBigLogo // - this.OCBigLogo.Location = new System.Drawing.Point(11, 12); - this.OCBigLogo.Name = "OCBigLogo"; - this.OCBigLogo.Size = new System.Drawing.Size(256, 256); - this.OCBigLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.OCBigLogo.TabIndex = 0; - this.OCBigLogo.TabStop = false; + OCBigLogo.Location = new System.Drawing.Point(13, 14); + OCBigLogo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + OCBigLogo.Name = "OCBigLogo"; + OCBigLogo.Size = new System.Drawing.Size(299, 295); + OCBigLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + OCBigLogo.TabIndex = 0; + OCBigLogo.TabStop = false; // // VerLabel // - this.VerLabel.AutoSize = true; - this.VerLabel.Font = new System.Drawing.Font("Arial", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.VerLabel.Location = new System.Drawing.Point(273, 12); - this.VerLabel.Name = "VerLabel"; - this.VerLabel.Size = new System.Drawing.Size(101, 24); - this.VerLabel.TabIndex = 1; - this.VerLabel.Text = "Template"; - this.VerLabel.Click += new System.EventHandler(this.VerLabel_Click); + VerLabel.AutoSize = true; + VerLabel.Font = new System.Drawing.Font("Arial", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + VerLabel.Location = new System.Drawing.Point(318, 14); + VerLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + VerLabel.Name = "VerLabel"; + VerLabel.Size = new System.Drawing.Size(101, 24); + VerLabel.TabIndex = 1; + VerLabel.Text = "Template"; + VerLabel.Click += VerLabel_Click; // // OKBtn // - this.OKBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.OKBtn.Location = new System.Drawing.Point(651, 244); - this.OKBtn.Name = "OKBtn"; - this.OKBtn.Size = new System.Drawing.Size(75, 24); - this.OKBtn.TabIndex = 4; - this.OKBtn.Text = "OK"; - this.OKBtn.UseVisualStyleBackColor = true; - this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click); + OKBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + OKBtn.Location = new System.Drawing.Point(760, 282); + OKBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + OKBtn.Name = "OKBtn"; + OKBtn.Size = new System.Drawing.Size(88, 28); + OKBtn.TabIndex = 4; + OKBtn.Text = "OK"; + OKBtn.UseVisualStyleBackColor = true; + OKBtn.Click += OKBtn_Click; // // CopyrightLabel // - this.CopyrightLabel.Location = new System.Drawing.Point(274, 47); - this.CopyrightLabel.Name = "CopyrightLabel"; - this.CopyrightLabel.Size = new System.Drawing.Size(272, 26); - this.CopyrightLabel.TabIndex = 3; - this.CopyrightLabel.Text = "Copyright Ⓒ 2019-{0} Keppy\'s Software and Arduano\r\nFree MIDI converter for Window" + - "s 7 and newer"; + CopyrightLabel.Location = new System.Drawing.Point(320, 54); + CopyrightLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + CopyrightLabel.Name = "CopyrightLabel"; + CopyrightLabel.Size = new System.Drawing.Size(317, 30); + CopyrightLabel.TabIndex = 3; + CopyrightLabel.Text = "Copyright Ⓒ 2019-{0} Keppy's Software and Arduano\r\nFree MIDI converter for Windows 7 and newer"; // // GitHubPage // - this.GitHubPage.Location = new System.Drawing.Point(702, 12); - this.GitHubPage.Name = "GitHubPage"; - this.GitHubPage.Size = new System.Drawing.Size(24, 24); - this.GitHubPage.TabIndex = 5; - this.GitHubPage.TabStop = false; - this.GitHubPage.Click += new System.EventHandler(this.GitHubPage_Click); - this.GitHubPage.MouseHover += new System.EventHandler(this.GitHubPage_MouseHover); + GitHubPage.Location = new System.Drawing.Point(819, 14); + GitHubPage.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + GitHubPage.Name = "GitHubPage"; + GitHubPage.Size = new System.Drawing.Size(28, 28); + GitHubPage.TabIndex = 5; + GitHubPage.TabStop = false; + GitHubPage.Click += GitHubPage_Click; + GitHubPage.MouseHover += GitHubPage_MouseHover; // // DIGroup // - this.DIGroup.Controls.Add(this.CurBranch); - this.DIGroup.Controls.Add(this.BASSMIDIVer); - this.DIGroup.Controls.Add(this.BASSVer); - this.DIGroup.Controls.Add(this.label9); - this.DIGroup.Controls.Add(this.label5); - this.DIGroup.Controls.Add(this.label4); - this.DIGroup.Location = new System.Drawing.Point(277, 138); - this.DIGroup.Name = "DIGroup"; - this.DIGroup.Size = new System.Drawing.Size(220, 100); - this.DIGroup.TabIndex = 6; - this.DIGroup.TabStop = false; - this.DIGroup.Text = "Driver information"; + DIGroup.Controls.Add(CurBranch); + DIGroup.Controls.Add(BASSMIDIVer); + DIGroup.Controls.Add(BASSVer); + DIGroup.Controls.Add(label9); + DIGroup.Controls.Add(label5); + DIGroup.Controls.Add(label4); + DIGroup.Location = new System.Drawing.Point(323, 159); + DIGroup.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + DIGroup.Name = "DIGroup"; + DIGroup.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + DIGroup.Size = new System.Drawing.Size(257, 115); + DIGroup.TabIndex = 6; + DIGroup.TabStop = false; + DIGroup.Text = "Driver information"; // // CurBranch // - this.CurBranch.AutoSize = true; - this.CurBranch.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.CurBranch.ForeColor = System.Drawing.SystemColors.ControlText; - this.CurBranch.Location = new System.Drawing.Point(105, 76); - this.CurBranch.Name = "CurBranch"; - this.CurBranch.Size = new System.Drawing.Size(74, 13); - this.CurBranch.TabIndex = 12; - this.CurBranch.Text = "Unavailable"; + CurBranch.AutoSize = true; + CurBranch.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + CurBranch.ForeColor = System.Drawing.SystemColors.ControlText; + CurBranch.Location = new System.Drawing.Point(122, 88); + CurBranch.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + CurBranch.Name = "CurBranch"; + CurBranch.Size = new System.Drawing.Size(74, 13); + CurBranch.TabIndex = 12; + CurBranch.Text = "Unavailable"; // // BASSMIDIVer // - this.BASSMIDIVer.AutoSize = true; - this.BASSMIDIVer.Location = new System.Drawing.Point(105, 38); - this.BASSMIDIVer.Name = "BASSMIDIVer"; - this.BASSMIDIVer.Size = new System.Drawing.Size(54, 13); - this.BASSMIDIVer.TabIndex = 11; - this.BASSMIDIVer.Text = "LIB VER2"; + BASSMIDIVer.AutoSize = true; + BASSMIDIVer.Location = new System.Drawing.Point(122, 44); + BASSMIDIVer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + BASSMIDIVer.Name = "BASSMIDIVer"; + BASSMIDIVer.Size = new System.Drawing.Size(52, 15); + BASSMIDIVer.TabIndex = 11; + BASSMIDIVer.Text = "LIB VER2"; // // BASSVer // - this.BASSVer.AutoSize = true; - this.BASSVer.Location = new System.Drawing.Point(105, 19); - this.BASSVer.Name = "BASSVer"; - this.BASSVer.Size = new System.Drawing.Size(54, 13); - this.BASSVer.TabIndex = 10; - this.BASSVer.Text = "LIB VER1"; + BASSVer.AutoSize = true; + BASSVer.Location = new System.Drawing.Point(122, 22); + BASSVer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + BASSVer.Name = "BASSVer"; + BASSVer.Size = new System.Drawing.Size(52, 15); + BASSVer.TabIndex = 10; + BASSVer.Text = "LIB VER1"; // // label9 // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 76); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(81, 13); - this.label9.TabIndex = 9; - this.label9.Text = "Update branch:"; + label9.AutoSize = true; + label9.Location = new System.Drawing.Point(7, 88); + label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label9.Name = "label9"; + label9.Size = new System.Drawing.Size(88, 15); + label9.TabIndex = 9; + label9.Text = "Update branch:"; // // label5 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 38); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(98, 13); - this.label5.TabIndex = 5; - this.label5.Text = "BASSMIDI version:"; + label5.AutoSize = true; + label5.Location = new System.Drawing.Point(7, 44); + label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label5.Name = "label5"; + label5.Size = new System.Drawing.Size(103, 15); + label5.TabIndex = 5; + label5.Text = "BASSMIDI version:"; // // label4 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 19); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(75, 13); - this.label4.TabIndex = 4; - this.label4.Text = "BASS version:"; + label4.AutoSize = true; + label4.Location = new System.Drawing.Point(7, 22); + label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label4.Name = "label4"; + label4.Size = new System.Drawing.Size(78, 15); + label4.TabIndex = 4; + label4.Text = "BASS version:"; // // label1 // - this.label1.Location = new System.Drawing.Point(274, 87); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(452, 42); - this.label1.TabIndex = 7; - this.label1.Text = "This software is open-source.\r\nRedistribution and use of this code or any derivat" + - "ive works are permitted provided that specific conditions are met. Click the blu" + - "e note button to see the license.\r\n"; + label1.Location = new System.Drawing.Point(320, 100); + label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(527, 48); + label1.TabIndex = 7; + label1.Text = "This software is open-source.\r\nRedistribution and use of this code or any derivative works are permitted provided that specific conditions are met. Click the blue note button to see the license.\r\n"; // // groupBox1 // - this.groupBox1.Controls.Add(this.RAMAmount); - this.groupBox1.Controls.Add(this.label11); - this.groupBox1.Controls.Add(this.WinVer); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.WinName); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Location = new System.Drawing.Point(506, 138); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(220, 100); - this.groupBox1.TabIndex = 7; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Windows install information"; + groupBox1.Controls.Add(RAMAmount); + groupBox1.Controls.Add(label11); + groupBox1.Controls.Add(WinVer); + groupBox1.Controls.Add(label7); + groupBox1.Controls.Add(WinName); + groupBox1.Controls.Add(label8); + groupBox1.Location = new System.Drawing.Point(590, 159); + groupBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBox1.Name = "groupBox1"; + groupBox1.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBox1.Size = new System.Drawing.Size(257, 115); + groupBox1.TabIndex = 7; + groupBox1.TabStop = false; + groupBox1.Text = "Windows install information"; // // RAMAmount // - this.RAMAmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.RAMAmount.AutoSize = true; - this.RAMAmount.Location = new System.Drawing.Point(51, 76); - this.RAMAmount.Name = "RAMAmount"; - this.RAMAmount.Size = new System.Drawing.Size(81, 13); - this.RAMAmount.TabIndex = 16; - this.RAMAmount.Text = "RAM AMOUNT"; + RAMAmount.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + RAMAmount.AutoSize = true; + RAMAmount.Location = new System.Drawing.Point(59, 88); + RAMAmount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + RAMAmount.Name = "RAMAmount"; + RAMAmount.Size = new System.Drawing.Size(87, 15); + RAMAmount.TabIndex = 16; + RAMAmount.Text = "RAM AMOUNT"; // // label11 // - this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(6, 76); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(34, 13); - this.label11.TabIndex = 14; - this.label11.Text = "RAM:"; + label11.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + label11.AutoSize = true; + label11.Location = new System.Drawing.Point(7, 88); + label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label11.Name = "label11"; + label11.Size = new System.Drawing.Size(36, 15); + label11.TabIndex = 14; + label11.Text = "RAM:"; // // WinVer // - this.WinVer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.WinVer.Location = new System.Drawing.Point(51, 38); - this.WinVer.Name = "WinVer"; - this.WinVer.Size = new System.Drawing.Size(163, 32); - this.WinVer.TabIndex = 13; - this.WinVer.Text = "WIN VERS"; + WinVer.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + WinVer.Location = new System.Drawing.Point(59, 44); + WinVer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + WinVer.Name = "WinVer"; + WinVer.Size = new System.Drawing.Size(190, 37); + WinVer.TabIndex = 13; + WinVer.Text = "WIN VERS"; // // label7 // - this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 38); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(45, 13); - this.label7.TabIndex = 11; - this.label7.Text = "Version:"; + label7.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + label7.AutoSize = true; + label7.Location = new System.Drawing.Point(7, 44); + label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label7.Name = "label7"; + label7.Size = new System.Drawing.Size(48, 15); + label7.TabIndex = 11; + label7.Text = "Version:"; // // WinName // - this.WinName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.WinName.Location = new System.Drawing.Point(51, 19); - this.WinName.Name = "WinName"; - this.WinName.Size = new System.Drawing.Size(163, 13); - this.WinName.TabIndex = 12; - this.WinName.Text = "WIN NAME"; + WinName.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + WinName.Location = new System.Drawing.Point(59, 22); + WinName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + WinName.Name = "WinName"; + WinName.Size = new System.Drawing.Size(190, 15); + WinName.TabIndex = 12; + WinName.Text = "WIN NAME"; // // label8 // - this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 19); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(38, 13); - this.label8.TabIndex = 10; - this.label8.Text = "Name:"; + label8.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + label8.AutoSize = true; + label8.Location = new System.Drawing.Point(7, 22); + label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label8.Name = "label8"; + label8.Size = new System.Drawing.Size(42, 15); + label8.TabIndex = 10; + label8.Text = "Name:"; // // BranchToolTip // - this.BranchToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; - this.BranchToolTip.ToolTipTitle = "Branch info"; + BranchToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; + BranchToolTip.ToolTipTitle = "Branch info"; // // ChangeBranch // - this.ChangeBranch.Location = new System.Drawing.Point(277, 244); - this.ChangeBranch.Name = "ChangeBranch"; - this.ChangeBranch.Size = new System.Drawing.Size(101, 24); - this.ChangeBranch.TabIndex = 2; - this.ChangeBranch.Text = "Change branch"; - this.ChangeBranch.UseVisualStyleBackColor = true; - this.ChangeBranch.Click += new System.EventHandler(this.ChangeBranch_Click); + ChangeBranch.Location = new System.Drawing.Point(323, 282); + ChangeBranch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + ChangeBranch.Name = "ChangeBranch"; + ChangeBranch.Size = new System.Drawing.Size(118, 28); + ChangeBranch.TabIndex = 2; + ChangeBranch.Text = "Change branch"; + ChangeBranch.UseVisualStyleBackColor = true; + ChangeBranch.Click += ChangeBranch_Click; // // CheckForUpdates // - this.CheckForUpdates.Location = new System.Drawing.Point(538, 244); - this.CheckForUpdates.Name = "CheckForUpdates"; - this.CheckForUpdates.Size = new System.Drawing.Size(107, 24); - this.CheckForUpdates.TabIndex = 3; - this.CheckForUpdates.Text = "Check for updates"; - this.CheckForUpdates.UseVisualStyleBackColor = true; - this.CheckForUpdates.Click += new System.EventHandler(this.CheckForUpdates_Click); + CheckForUpdates.Location = new System.Drawing.Point(628, 282); + CheckForUpdates.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + CheckForUpdates.Name = "CheckForUpdates"; + CheckForUpdates.Size = new System.Drawing.Size(125, 28); + CheckForUpdates.TabIndex = 3; + CheckForUpdates.Text = "Check for updates"; + CheckForUpdates.UseVisualStyleBackColor = true; + CheckForUpdates.Click += CheckForUpdates_Click; // // OMLicense // - this.OMLicense.Cursor = System.Windows.Forms.Cursors.Hand; - this.OMLicense.Location = new System.Drawing.Point(672, 12); - this.OMLicense.Name = "OMLicense"; - this.OMLicense.Size = new System.Drawing.Size(24, 24); - this.OMLicense.TabIndex = 10; - this.OMLicense.TabStop = false; - this.OMLicense.Click += new System.EventHandler(this.OMLicense_Click); - this.OMLicense.MouseHover += new System.EventHandler(this.OMLicense_MouseHover); + OMLicense.Cursor = System.Windows.Forms.Cursors.Hand; + OMLicense.Location = new System.Drawing.Point(784, 14); + OMLicense.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + OMLicense.Name = "OMLicense"; + OMLicense.Size = new System.Drawing.Size(28, 28); + OMLicense.TabIndex = 10; + OMLicense.TabStop = false; + OMLicense.Click += OMLicense_Click; + OMLicense.MouseHover += OMLicense_MouseHover; // // DonateKep // - this.DonateKep.AutoSize = true; - this.DonateKep.LinkColor = System.Drawing.SystemColors.Highlight; - this.DonateKep.Location = new System.Drawing.Point(587, 47); - this.DonateKep.Name = "DonateKep"; - this.DonateKep.Size = new System.Drawing.Size(139, 13); - this.DonateKep.TabIndex = 11; - this.DonateKep.TabStop = true; - this.DonateKep.Text = "Donate to Keppy\'s Software"; - this.DonateKep.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DonateKep_LinkClicked); + DonateKep.AutoSize = true; + DonateKep.LinkColor = System.Drawing.SystemColors.Highlight; + DonateKep.Location = new System.Drawing.Point(696, 54); + DonateKep.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + DonateKep.Name = "DonateKep"; + DonateKep.Size = new System.Drawing.Size(152, 15); + DonateKep.TabIndex = 11; + DonateKep.TabStop = true; + DonateKep.Text = "Donate to Keppy's Software"; + DonateKep.LinkClicked += DonateKep_LinkClicked; // // DonateArd // - this.DonateArd.AutoSize = true; - this.DonateArd.LinkColor = System.Drawing.SystemColors.Highlight; - this.DonateArd.Location = new System.Drawing.Point(629, 60); - this.DonateArd.Name = "DonateArd"; - this.DonateArd.Size = new System.Drawing.Size(97, 13); - this.DonateArd.TabIndex = 12; - this.DonateArd.TabStop = true; - this.DonateArd.Text = "Donate to Arduano"; - this.DonateArd.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DonateArd_LinkClicked); + DonateArd.AutoSize = true; + DonateArd.LinkColor = System.Drawing.SystemColors.Highlight; + DonateArd.Location = new System.Drawing.Point(740, 69); + DonateArd.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + DonateArd.Name = "DonateArd"; + DonateArd.Size = new System.Drawing.Size(108, 15); + DonateArd.TabIndex = 12; + DonateArd.TabStop = true; + DonateArd.Text = "Donate to Arduano"; + DonateArd.LinkClicked += DonateArd_LinkClicked; // // InfoWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.OKBtn; - this.ClientSize = new System.Drawing.Size(738, 280); - this.Controls.Add(this.DonateArd); - this.Controls.Add(this.DonateKep); - this.Controls.Add(this.OMLicense); - this.Controls.Add(this.CheckForUpdates); - this.Controls.Add(this.ChangeBranch); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.label1); - this.Controls.Add(this.DIGroup); - this.Controls.Add(this.GitHubPage); - this.Controls.Add(this.CopyrightLabel); - this.Controls.Add(this.OKBtn); - this.Controls.Add(this.VerLabel); - this.Controls.Add(this.OCBigLogo); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "InfoWindow"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Information"; - this.Load += new System.EventHandler(this.InfoWindow_Load); - ((System.ComponentModel.ISupportInitialize)(this.OCBigLogo)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.GitHubPage)).EndInit(); - this.DIGroup.ResumeLayout(false); - this.DIGroup.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.OMLicense)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + CancelButton = OKBtn; + ClientSize = new System.Drawing.Size(861, 323); + Controls.Add(DonateArd); + Controls.Add(DonateKep); + Controls.Add(OMLicense); + Controls.Add(CheckForUpdates); + Controls.Add(ChangeBranch); + Controls.Add(groupBox1); + Controls.Add(label1); + Controls.Add(DIGroup); + Controls.Add(GitHubPage); + Controls.Add(CopyrightLabel); + Controls.Add(OKBtn); + Controls.Add(VerLabel); + Controls.Add(OCBigLogo); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + MaximizeBox = false; + MinimizeBox = false; + Name = "InfoWindow"; + ShowIcon = false; + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "Information"; + Load += InfoWindow_Load; + ((System.ComponentModel.ISupportInitialize)OCBigLogo).EndInit(); + ((System.ComponentModel.ISupportInitialize)GitHubPage).EndInit(); + DIGroup.ResumeLayout(false); + DIGroup.PerformLayout(); + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)OMLicense).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion diff --git a/OmniConverter/Forms/InfoWindow.cs b/OmniConverter/Forms/InfoWindow.cs index 4858e0f..126c53c 100644 --- a/OmniConverter/Forms/InfoWindow.cs +++ b/OmniConverter/Forms/InfoWindow.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualBasic.Devices; +using ManagedBass; +using Microsoft.VisualBasic.Devices; using Microsoft.Win32; using System; using System.Collections.Generic; @@ -19,11 +20,12 @@ namespace OmniConverter { public partial class InfoWindow : Form { - private ToolTip DynamicToolTip = new ToolTip(); + private Version Converter = new Version(0, 0, 7, 0); + private ToolTip DynamicToolTip = new ToolTip(); private RegistryKey WVerKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false); - private Version Converter = Assembly.GetExecutingAssembly().GetName().Version; - private FileVersionInfo BASS = FileVersionInfo.GetVersionInfo(Path.GetDirectoryName(Application.ExecutablePath) + "\\bass.dll"); + + private Version BASS = Bass.Version; private FileVersionInfo BASSMIDI = FileVersionInfo.GetVersionInfo(Path.GetDirectoryName(Application.ExecutablePath) + "\\bassmidi.dll"); private string ReturnDriverAssemblyVersion(String Component, String Type, Int32[] VI) @@ -42,20 +44,20 @@ public InfoWindow() InitializeComponent(); VerLabel.Text = ReturnDriverAssemblyVersion( - "OmniConverter", - "CR", + "OmniConverter", + "CR", new int[] { Converter.Major, Converter.Minor, Converter.Build, 0 } ); BASSVer.Text = ReturnDriverAssemblyVersion( null, - "U", - new int[] { BASS.FileMajorPart, BASS.FileMinorPart, BASS.FileBuildPart, BASS.FilePrivatePart } + "Rev. ", + new int[] { BASS.Major, BASS.Minor, BASS.Build, BASS.Revision } ); BASSMIDIVer.Text = ReturnDriverAssemblyVersion( null, - "U", + "Rev. ", new int[] { BASSMIDI.FileMajorPart, BASSMIDI.FileMinorPart, BASSMIDI.FileBuildPart, BASSMIDI.FilePrivatePart } ); diff --git a/OmniConverter/Forms/InfoWindow.resx b/OmniConverter/Forms/InfoWindow.resx index f04b4ae..6adbc0a 100644 --- a/OmniConverter/Forms/InfoWindow.resx +++ b/OmniConverter/Forms/InfoWindow.resx @@ -1,64 +1,4 @@ - - - + diff --git a/OmniConverter/Forms/MIDIConverter.Designer.cs b/OmniConverter/Forms/MIDIConverter.Designer.cs index 11b7d69..e3a2cb9 100644 --- a/OmniConverter/Forms/MIDIConverter.Designer.cs +++ b/OmniConverter/Forms/MIDIConverter.Designer.cs @@ -28,117 +28,109 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.LogGB = new System.Windows.Forms.GroupBox(); - this.ThreadsPanel = new System.Windows.Forms.Panel(); - this.CancelBtn = new System.Windows.Forms.Button(); - this.PB = new wyDay.Controls.Windows7ProgressBar(); - this.StatusLab = new System.Windows.Forms.Label(); - this.Check = new System.Windows.Forms.Timer(this.components); - this.TPB = new wyDay.Controls.Windows7ProgressBar(); - this.LogGB.SuspendLayout(); - this.SuspendLayout(); + components = new System.ComponentModel.Container(); + LogGB = new System.Windows.Forms.GroupBox(); + ThreadsPanel = new System.Windows.Forms.Panel(); + CancelBtn = new System.Windows.Forms.Button(); + PB = new wyDay.Controls.Windows7ProgressBar(); + StatusLab = new System.Windows.Forms.Label(); + Check = new System.Windows.Forms.Timer(components); + TPB = new wyDay.Controls.Windows7ProgressBar(); + LogGB.SuspendLayout(); + SuspendLayout(); // // LogGB // - this.LogGB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.LogGB.Controls.Add(this.ThreadsPanel); - this.LogGB.Location = new System.Drawing.Point(14, 112); - this.LogGB.Name = "LogGB"; - this.LogGB.Size = new System.Drawing.Size(454, 195); - this.LogGB.TabIndex = 7; - this.LogGB.TabStop = false; - this.LogGB.Text = "Active threads"; + LogGB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + LogGB.Controls.Add(ThreadsPanel); + LogGB.Location = new System.Drawing.Point(14, 112); + LogGB.Name = "LogGB"; + LogGB.Size = new System.Drawing.Size(454, 291); + LogGB.TabIndex = 7; + LogGB.TabStop = false; + LogGB.Text = "Active threads"; // // ThreadsPanel // - this.ThreadsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.ThreadsPanel.AutoScroll = true; - this.ThreadsPanel.Location = new System.Drawing.Point(2, 20); - this.ThreadsPanel.Name = "ThreadsPanel"; - this.ThreadsPanel.Size = new System.Drawing.Size(449, 172); - this.ThreadsPanel.TabIndex = 0; + ThreadsPanel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + ThreadsPanel.AutoScroll = true; + ThreadsPanel.Location = new System.Drawing.Point(2, 20); + ThreadsPanel.Name = "ThreadsPanel"; + ThreadsPanel.Size = new System.Drawing.Size(449, 268); + ThreadsPanel.TabIndex = 0; // // CancelBtn // - this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.CancelBtn.Location = new System.Drawing.Point(380, 78); - this.CancelBtn.Name = "CancelBtn"; - this.CancelBtn.Size = new System.Drawing.Size(87, 27); - this.CancelBtn.TabIndex = 6; - this.CancelBtn.Text = "Cancel"; - this.CancelBtn.UseVisualStyleBackColor = true; - this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); + CancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + CancelBtn.Location = new System.Drawing.Point(380, 78); + CancelBtn.Name = "CancelBtn"; + CancelBtn.Size = new System.Drawing.Size(87, 27); + CancelBtn.TabIndex = 6; + CancelBtn.Text = "Cancel"; + CancelBtn.UseVisualStyleBackColor = true; + CancelBtn.Click += CancelBtn_Click; // // PB // - this.PB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.PB.ContainerControl = this; - this.PB.Location = new System.Drawing.Point(14, 79); - this.PB.Name = "PB"; - this.PB.ShowInTaskbar = true; - this.PB.Size = new System.Drawing.Size(359, 13); - this.PB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; - this.PB.TabIndex = 5; + PB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + PB.ContainerControl = this; + PB.Location = new System.Drawing.Point(14, 79); + PB.Name = "PB"; + PB.ShowInTaskbar = true; + PB.Size = new System.Drawing.Size(359, 13); + PB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + PB.TabIndex = 5; // // StatusLab // - this.StatusLab.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.StatusLab.Location = new System.Drawing.Point(14, 10); - this.StatusLab.Name = "StatusLab"; - this.StatusLab.Size = new System.Drawing.Size(454, 65); - this.StatusLab.TabIndex = 4; - this.StatusLab.Text = "Initializing, please wait..."; - this.StatusLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + StatusLab.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + StatusLab.Location = new System.Drawing.Point(14, 10); + StatusLab.Name = "StatusLab"; + StatusLab.Size = new System.Drawing.Size(454, 65); + StatusLab.TabIndex = 4; + StatusLab.Text = "Initializing, please wait..."; + StatusLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // Check // - this.Check.Enabled = true; - this.Check.Tick += new System.EventHandler(this.Check_Tick); + Check.Enabled = true; + Check.Tick += Check_Tick; // // TPB // - this.TPB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TPB.ContainerControl = this; - this.TPB.Location = new System.Drawing.Point(14, 91); - this.TPB.Name = "TPB"; - this.TPB.ShowInTaskbar = true; - this.TPB.Size = new System.Drawing.Size(359, 13); - this.TPB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; - this.TPB.TabIndex = 8; + TPB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + TPB.ContainerControl = this; + TPB.Location = new System.Drawing.Point(14, 91); + TPB.Name = "TPB"; + TPB.ShowInTaskbar = true; + TPB.Size = new System.Drawing.Size(359, 13); + TPB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + TPB.TabIndex = 8; // // MIDIConverter // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(482, 321); - this.ControlBox = false; - this.Controls.Add(this.TPB); - this.Controls.Add(this.LogGB); - this.Controls.Add(this.CancelBtn); - this.Controls.Add(this.PB); - this.Controls.Add(this.StatusLab); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MIDIConverter"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Converting MIDIs..."; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MIDIConverter_FormClosing); - this.Load += new System.EventHandler(this.MIDIConverter_Load); - this.LogGB.ResumeLayout(false); - this.ResumeLayout(false); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(482, 417); + ControlBox = false; + Controls.Add(TPB); + Controls.Add(LogGB); + Controls.Add(CancelBtn); + Controls.Add(PB); + Controls.Add(StatusLab); + Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + Name = "MIDIConverter"; + ShowIcon = false; + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "Converting MIDIs..."; + FormClosing += MIDIConverter_FormClosing; + Load += MIDIConverter_Load; + LogGB.ResumeLayout(false); + ResumeLayout(false); } #endregion diff --git a/OmniConverter/Forms/MIDIConverter.cs b/OmniConverter/Forms/MIDIConverter.cs index 0177dfe..a62b8ee 100644 --- a/OmniConverter/Forms/MIDIConverter.cs +++ b/OmniConverter/Forms/MIDIConverter.cs @@ -5,7 +5,6 @@ using System.Threading.Tasks; using System.Threading; using System.Windows.Forms; -using Un4seen.Bass; using CSCore; using CSCore.Codecs.WAV; @@ -14,7 +13,7 @@ namespace OmniConverter public partial class MIDIConverter : Form { private Converter Cnv; - public Boolean StopRequested = false; + public bool StopRequested = false; public MIDIConverter(String OutputPath) { @@ -36,51 +35,25 @@ private void CancelBtn_Click(object sender, EventArgs e) CancelBtn.Enabled = false; new Thread(() => { - Int32 SleepCount = 0; - DialogResult DR1 = 0, DR2 = 0; + DialogResult DR1 = 0; if (Cnv.IsStillRendering()) { Debug.PrintToConsole("wrn", "CThread is still alive! Asking if user wants to quit."); - this.Invoke((MethodInvoker)delegate { - DR1 = MessageBox.Show("Are you sure you want to terminate the conversion process?", "The converter is still processing data", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + this.Invoke((MethodInvoker)delegate + { + DR1 = MessageBox.Show("Are you sure you want to terminate the conversion process?\n\nIt might take some time to terminate the background threads.", "The converter is still processing data", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }); - + switch (DR1) { case DialogResult.Yes: StopRequested = true; Cnv.RequestStop(); - while (Cnv.IsStillRendering()) - { - SleepCount++; - Thread.Sleep(10); - - if (SleepCount >= 500) break; - - Debug.PrintToConsole("wrn", "CThread is still alive! Waiting..."); - } - - if (SleepCount >= 5000) - { - Debug.PrintToConsole("err", "CThread is still alive!"); - - this.Invoke((MethodInvoker)delegate { - DR2 = MessageBox.Show("The conversion threads seem to have got stuck, are you sure you want to continue?\n\nThis could cause unexpected behavior.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - }); - - switch (DR2) - { - case DialogResult.Yes: - Cnv.ForceStop(); - break; - default: - case DialogResult.No: - return; - } - } + Debug.PrintToConsole("wrn", "Waiting for CThread to exit..."); + while (Cnv.IsStillRendering()) Thread.Sleep(1); Debug.PrintToConsole("ok", "CThread is not active anymore."); break; @@ -136,8 +109,8 @@ private void Check_Tick(object sender, EventArgs e) UInt64 InvalidFiles = Cnv.MDV.GetInvalidMIDIsCount(); UInt64 TotalFiles = Cnv.MDV.GetTotalMIDIsCount(); - Int64 Tracks = Cnv.MDV.GetTotalTracks(); - Int64 CurrentTrack = Cnv.MDV.GetCurrentTrack(); + int Tracks = Cnv.MDV.GetTotalTracks(); + int CurrentTrack = Cnv.MDV.GetCurrentTrack(); switch (Cnv.GetStatus()) { @@ -147,6 +120,7 @@ private void Check_Tick(object sender, EventArgs e) PB.Style = ProgressBarStyle.Marquee; PB.Value = 0; PB.Size = new System.Drawing.Size(PB.Size.Width, 26); + TPB.Visible = false; break; case "mconv": @@ -158,27 +132,30 @@ private void Check_Tick(object sender, EventArgs e) PB.Style = ProgressBarStyle.Blocks; PB.Value = Convert.ToInt32(Math.Round((ValidFiles + InvalidFiles) * 100.0 / TotalFiles)); PB.Size = new System.Drawing.Size(PB.Size.Width, 13); + TPB.Visible = true; TPB.Style = ProgressBarStyle.Blocks; TPB.Value = Convert.ToInt32(Math.Round(CurrentTrack * 100.0 / Tracks)); break; + case "sconv": StatusLab.Text = String.Format("{0} file(s) out of {1} have been converted.\n\nPlease wait...", (ValidFiles + InvalidFiles).ToString("N0", new CultureInfo("is-IS")), - TotalFiles.ToString("N0", new CultureInfo("is-IS")), - CurrentTrack.ToString("N0", new CultureInfo("is-IS")), Tracks.ToString("N0", new CultureInfo("is-IS"))); + TotalFiles.ToString("N0", new CultureInfo("is-IS"))); PB.Style = ProgressBarStyle.Blocks; PB.Value = Convert.ToInt32(Math.Round((ValidFiles + InvalidFiles) * 100.0 / TotalFiles)); PB.Size = new System.Drawing.Size(PB.Size.Width, 26); + TPB.Visible = false; break; + case "aout": StatusLab.Text = "Writing final audio file to disk.\n\nPlease do not turn off the computer during the process..."; PB.Style = ProgressBarStyle.Blocks; PB.Value = Convert.ToInt32(Math.Round((ValidFiles + InvalidFiles) * 100.0 / TotalFiles)); - TPB.Style = ProgressBarStyle.Blocks; - TPB.Value = Convert.ToInt32(Math.Round(CurrentTrack * 100.0 / Tracks)); + PB.Size = new System.Drawing.Size(PB.Size.Width, 26); + TPB.Visible = false; break; } } diff --git a/OmniConverter/Forms/MIDIConverter.resx b/OmniConverter/Forms/MIDIConverter.resx index 70a41c1..7fd19d3 100644 --- a/OmniConverter/Forms/MIDIConverter.resx +++ b/OmniConverter/Forms/MIDIConverter.resx @@ -1,64 +1,4 @@ - - - + diff --git a/OmniConverter/Forms/MIDIImporter.Designer.cs b/OmniConverter/Forms/MIDIImporter.Designer.cs index 7ef991d..b2dee0c 100644 --- a/OmniConverter/Forms/MIDIImporter.Designer.cs +++ b/OmniConverter/Forms/MIDIImporter.Designer.cs @@ -28,107 +28,103 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.StatusLab = new System.Windows.Forms.Label(); - this.PB = new wyDay.Controls.Windows7ProgressBar(); - this.CancelBtn = new System.Windows.Forms.Button(); - this.LogGB = new System.Windows.Forms.GroupBox(); - this.LogPanel = new System.Windows.Forms.Panel(); - this.Check = new System.Windows.Forms.Timer(this.components); - this.LogGB.SuspendLayout(); - this.SuspendLayout(); + components = new System.ComponentModel.Container(); + StatusLab = new System.Windows.Forms.Label(); + CancelBtn = new System.Windows.Forms.Button(); + LogGB = new System.Windows.Forms.GroupBox(); + LogPanel = new System.Windows.Forms.Panel(); + Check = new System.Windows.Forms.Timer(components); + PB = new wyDay.Controls.Windows7ProgressBar(); + LogGB.SuspendLayout(); + SuspendLayout(); // // StatusLab // - this.StatusLab.Location = new System.Drawing.Point(14, 10); - this.StatusLab.Name = "StatusLab"; - this.StatusLab.Size = new System.Drawing.Size(454, 65); - this.StatusLab.TabIndex = 0; - this.StatusLab.Text = "Initializing, please wait..."; - this.StatusLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // PB - // - this.PB.ContainerControl = this; - this.PB.Location = new System.Drawing.Point(14, 78); - this.PB.Name = "PB"; - this.PB.ShowInTaskbar = true; - this.PB.Size = new System.Drawing.Size(359, 27); - this.PB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; - this.PB.TabIndex = 1; + StatusLab.Location = new System.Drawing.Point(14, 10); + StatusLab.Name = "StatusLab"; + StatusLab.Size = new System.Drawing.Size(454, 65); + StatusLab.TabIndex = 0; + StatusLab.Text = "Initializing, please wait..."; + StatusLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // CancelBtn // - this.CancelBtn.Location = new System.Drawing.Point(380, 78); - this.CancelBtn.Name = "CancelBtn"; - this.CancelBtn.Size = new System.Drawing.Size(87, 27); - this.CancelBtn.TabIndex = 2; - this.CancelBtn.Text = "Cancel"; - this.CancelBtn.UseVisualStyleBackColor = true; - this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); + CancelBtn.Location = new System.Drawing.Point(380, 78); + CancelBtn.Name = "CancelBtn"; + CancelBtn.Size = new System.Drawing.Size(87, 27); + CancelBtn.TabIndex = 2; + CancelBtn.Text = "Cancel"; + CancelBtn.UseVisualStyleBackColor = true; + CancelBtn.Click += CancelBtn_Click; // // LogGB // - this.LogGB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.LogGB.Controls.Add(this.LogPanel); - this.LogGB.Location = new System.Drawing.Point(14, 112); - this.LogGB.Name = "LogGB"; - this.LogGB.Size = new System.Drawing.Size(454, 194); - this.LogGB.TabIndex = 3; - this.LogGB.TabStop = false; - this.LogGB.Text = "Log"; + LogGB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + LogGB.Controls.Add(LogPanel); + LogGB.Location = new System.Drawing.Point(14, 112); + LogGB.Name = "LogGB"; + LogGB.Size = new System.Drawing.Size(454, 194); + LogGB.TabIndex = 3; + LogGB.TabStop = false; + LogGB.Text = "Log"; // // LogPanel // - this.LogPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.LogPanel.AutoScroll = true; - this.LogPanel.Location = new System.Drawing.Point(3, 19); - this.LogPanel.Name = "LogPanel"; - this.LogPanel.Size = new System.Drawing.Size(449, 172); - this.LogPanel.TabIndex = 1; + LogPanel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + LogPanel.AutoScroll = true; + LogPanel.Location = new System.Drawing.Point(3, 19); + LogPanel.Name = "LogPanel"; + LogPanel.Size = new System.Drawing.Size(449, 172); + LogPanel.TabIndex = 1; // // Check // - this.Check.Enabled = true; - this.Check.Tick += new System.EventHandler(this.Check_Tick); + Check.Enabled = true; + Check.Tick += Check_Tick; + // + // PB + // + PB.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + PB.ContainerControl = this; + PB.Location = new System.Drawing.Point(14, 79); + PB.Name = "PB"; + PB.ShowInTaskbar = true; + PB.Size = new System.Drawing.Size(359, 25); + PB.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + PB.TabIndex = 9; // // MIDIImporter // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(482, 320); - this.ControlBox = false; - this.Controls.Add(this.LogGB); - this.Controls.Add(this.CancelBtn); - this.Controls.Add(this.PB); - this.Controls.Add(this.StatusLab); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MIDIImporter"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Importing MIDIs..."; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MIDIImporter_FormClosing); - this.Load += new System.EventHandler(this.MIDIImporter_Load); - this.LogGB.ResumeLayout(false); - this.ResumeLayout(false); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(482, 320); + ControlBox = false; + Controls.Add(PB); + Controls.Add(LogGB); + Controls.Add(CancelBtn); + Controls.Add(StatusLab); + Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + Name = "MIDIImporter"; + ShowIcon = false; + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "Importing MIDIs..."; + FormClosing += MIDIImporter_FormClosing; + Load += MIDIImporter_Load; + LogGB.ResumeLayout(false); + ResumeLayout(false); } #endregion private System.Windows.Forms.Label StatusLab; - private wyDay.Controls.Windows7ProgressBar PB; private System.Windows.Forms.Button CancelBtn; private System.Windows.Forms.GroupBox LogGB; private System.Windows.Forms.Timer Check; private System.Windows.Forms.Panel LogPanel; + private wyDay.Controls.Windows7ProgressBar PB; } } \ No newline at end of file diff --git a/OmniConverter/Forms/MIDIImporter.cs b/OmniConverter/Forms/MIDIImporter.cs index 5d85904..d984f02 100644 --- a/OmniConverter/Forms/MIDIImporter.cs +++ b/OmniConverter/Forms/MIDIImporter.cs @@ -8,8 +8,8 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Midi; +using static System.Net.WebRequestMethods; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; namespace OmniConverter { @@ -17,15 +17,14 @@ public partial class MIDIImporter : Form { private Boolean CheckStop = false; private Boolean IgnoreInvalidMIDIs = false; - private String[] MIDIsToLoad; + private string[] MIDIsToLoad; private Thread MIDIAnalyzerT, MIDIPathChecker; - private UInt64 ValidFiles = 0; - private UInt64 InvalidFiles = 0; - private UInt64 TotalFiles = 0; + private ulong ValidFiles = 0; + private ulong InvalidFiles = 0; + private ulong TotalFiles = 0; private CancellationTokenSource CTS = null; - public ArrayList ValidMIDIs { get; set; } public DialogResult Result { get; set; } public MIDIImporter(String[] MIDIs, Boolean StartUp) @@ -83,37 +82,34 @@ private void MIDIAnalyzerF() CTS = new CancellationTokenSource(); ParallelOptions PO = new ParallelOptions { MaxDegreeOfParallelism = MT, CancellationToken = CTS.Token }; - if (Bass.BASS_Init(0, 4000, BASSInit.BASS_DEVICE_NOSPEAKER, IntPtr.Zero)) + try { - try + Parallel.ForEach(MIDIsToLoad, PO, (str, LS) => { - Parallel.ForEach(MIDIsToLoad, PO, (str, LS) => + try { - try - { - CheckDirectory(ref CurrentMaxIndex, str); - - PO.CancellationToken.ThrowIfCancellationRequested(); - } - catch (OperationCanceledException) { } - catch (Exception EX) - { - Debug.ShowMsgBox( - "Error while checking MIDIs", - "An error has occured while checking the imported MIDIs.", - EX.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); - } - }); - } - catch (OperationCanceledException) { } - finally { CTS.Dispose(); CTS = null; } + CheckDirectory(ref CurrentMaxIndex, str); - Bass.BASS_Free(); + PO.CancellationToken.ThrowIfCancellationRequested(); + } + catch (OperationCanceledException) { } + catch (Exception EX) + { + Debug.ShowMsgBox( + "Error while checking MIDIs", + "An error has occured while checking the imported MIDIs.", + EX.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); + } + }); } + catch (OperationCanceledException) { } + finally { CTS.Dispose(); CTS = null; } + if (InvalidFiles > 0 && !IgnoreInvalidMIDIs && !CheckStop) { - this.Invoke((MethodInvoker)delegate { + this.Invoke((MethodInvoker)delegate + { Check.Enabled = false; PB.State = wyDay.Controls.ProgressBarState.Error; PB.Value = 100; @@ -129,7 +125,6 @@ private void MIDIAnalyzerF() private void CancelBtn_Click(object sender, EventArgs e) { - CancelBtn.Enabled = false; new Thread(() => { Int32 SleepCount = 0; @@ -139,7 +134,9 @@ private void CancelBtn_Click(object sender, EventArgs e) { Debug.PrintToConsole("wrn", "MIDIAnalyzerT is still alive! Asking if user wants to quit."); - this.Invoke((MethodInvoker)delegate { + this.Invoke((MethodInvoker)delegate + { + CancelBtn.Enabled = false; DR1 = MessageBox.Show("Are you sure you want to terminate the analysis process?", "The converter is still analyzing data", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }); @@ -163,8 +160,9 @@ private void CancelBtn_Click(object sender, EventArgs e) { Debug.PrintToConsole("err", "CThread is still alive!"); - this.Invoke((MethodInvoker)delegate { - DR2 = MessageBox.Show("The conversion threads seem to have got stuck, are you sure you want to continue?\n\nThis could cause unexpected behavior.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + this.Invoke((MethodInvoker)delegate + { + DR2 = MessageBox.Show("The analysis threads seem to have got stuck, are you sure you want to continue?\n\nThis could cause unexpected behavior.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }); switch (DR2) @@ -174,6 +172,7 @@ private void CancelBtn_Click(object sender, EventArgs e) break; default: case DialogResult.No: + this.Invoke((MethodInvoker)delegate { CancelBtn.Enabled = true; }); return; } } @@ -200,8 +199,8 @@ private void CheckCount(String Target) catch (Exception EX) { Debug.ShowMsgBox( - "Error while checking MIDIs", - "An error has occured while checking the imported MIDIs.", + "Error while checking MIDIs", + "An error has occured while checking the imported MIDIs.", EX.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); @@ -209,7 +208,7 @@ private void CheckCount(String Target) } // Check if file is valid - private String GetInfoMIDI(ref Int64 CMI, string str, out MIDI MIDIStruct) + private String GetInfoMIDI(ref long CMI, string str, out MIDI MIDIStruct) { // Set MIDIStruct as null first String ID = IDGenerator.GetID(); @@ -219,13 +218,41 @@ private String GetInfoMIDI(ref Int64 CMI, string str, out MIDI MIDIStruct) try { - MIDIStruct = MIDI.LoadFromFile(CMI, str, Path.GetFileName(str), (p, t) => Console.WriteLine(p + "/" + t)); + TaskStatus MIDIT = new TaskStatus(Path.GetFileName(str)); + MIDIT.Dock = DockStyle.Top; + LogPanel.Invoke((MethodInvoker)delegate + { + Debug.PrintToConsole("ok", "Added MIDIThreadStatus control for MIDI."); + LogPanel.Controls.Add(MIDIT); + }); + + MIDIT.Invoke((MethodInvoker)delegate + { + MIDIT.UpdateTitle($"Loading..."); + MIDIT.UpdatePBStyle(ProgressBarStyle.Marquee); + }); + + MIDIStruct = MIDI.LoadFromFile(CMI, str, Path.GetFileName(str), (p, t) => + { + MIDIT.Invoke((MethodInvoker)delegate + { + MIDIT.UpdateTitle($"{p}/{t}"); + MIDIT.UpdatePBStyle(ProgressBarStyle.Blocks); + MIDIT.UpdatePB((100 * p) / t); + }); + }); + + LogPanel.Invoke((MethodInvoker)delegate + { + Debug.PrintToConsole("ok", "Removed MIDIThreadStatus control for MIDI."); + LogPanel.Controls.Remove(MIDIT); + }); Debug.PrintToConsole("ok", String.Format("{0} - Analysis finished for MIDI {1}.", ID, str)); return "No error."; } catch (Exception ex) - { + { return String.Format("A {0} exception has occured while loading the file.", ex.InnerException.ToString()); } } @@ -273,7 +300,8 @@ private void CheckFile(ref Int64 CMI, String str) } else ErrorReason = "Unrecognized file extension."; - this.Invoke((MethodInvoker)delegate { + this.Invoke((MethodInvoker)delegate + { InvalidMIDI MIDIT = new InvalidMIDI(str, ErrorReason, Program.Error); MIDIT.Dock = DockStyle.Top; LogPanel.Controls.Add(MIDIT); @@ -328,7 +356,7 @@ IEnumerable GetFiles(String Target) } // If the queued item is actually a direct path to the file, return it to the foreach loop - if (File.Exists(Target)) yield return Target; + if (System.IO.File.Exists(Target)) yield return Target; } } @@ -347,5 +375,7 @@ private void Check_Tick(object sender, EventArgs e) } catch { } } + + public ulong TotalValidFiles() { return ValidFiles; } } } diff --git a/OmniConverter/Forms/MIDIImporter.resx b/OmniConverter/Forms/MIDIImporter.resx index 70a41c1..7fd19d3 100644 --- a/OmniConverter/Forms/MIDIImporter.resx +++ b/OmniConverter/Forms/MIDIImporter.resx @@ -1,64 +1,4 @@ - - - + diff --git a/OmniConverter/Forms/MainWindow.Designer.cs b/OmniConverter/Forms/MainWindow.Designer.cs index c914ebc..394da5f 100644 --- a/OmniConverter/Forms/MainWindow.Designer.cs +++ b/OmniConverter/Forms/MainWindow.Designer.cs @@ -31,21 +31,23 @@ private void InitializeComponent() components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); OCMenu = new System.Windows.Forms.MenuStrip(); - menuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + Files = new System.Windows.Forms.ToolStripMenuItem(); AddMIDIsToQueue = new System.Windows.Forms.ToolStripMenuItem(); RemoveMIDIsFromQueue = new System.Windows.Forms.ToolStripMenuItem(); ClearQueue = new System.Windows.Forms.ToolStripMenuItem(); toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); ExitFromConverter = new System.Windows.Forms.ToolStripMenuItem(); - menuItem7 = new System.Windows.Forms.ToolStripMenuItem(); + Help = new System.Windows.Forms.ToolStripMenuItem(); InfoAboutConverter = new System.Windows.Forms.ToolStripMenuItem(); toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); CreateIssueGitHub = new System.Windows.Forms.ToolStripMenuItem(); CheckForUpdates = new System.Windows.Forms.ToolStripMenuItem(); toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); DownloadConvSrc = new System.Windows.Forms.ToolStripMenuItem(); - groupBox1 = new System.Windows.Forms.GroupBox(); - TMIDIs = new System.Windows.Forms.Label(); + InfoBox = new System.Windows.Forms.GroupBox(); + VolLab = new System.Windows.Forms.Label(); + label1 = new System.Windows.Forms.Label(); + VolBar = new System.Windows.Forms.TrackBar(); FNVal = new System.Windows.Forms.RichTextBox(); CMIDIs = new System.Windows.Forms.Button(); FPVal = new System.Windows.Forms.RichTextBox(); @@ -67,24 +69,25 @@ private void InitializeComponent() RemoveMIDIsFromQueueRC = new System.Windows.Forms.ToolStripMenuItem(); ClearQueueRC = new System.Windows.Forms.ToolStripMenuItem(); OCMenu.SuspendLayout(); - groupBox1.SuspendLayout(); + InfoBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)VolBar).BeginInit(); OCContextMenu.SuspendLayout(); SuspendLayout(); // // OCMenu // - OCMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { menuItem1, menuItem7 }); + OCMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { Files, Help }); OCMenu.Location = new System.Drawing.Point(0, 0); OCMenu.Name = "OCMenu"; OCMenu.Size = new System.Drawing.Size(784, 24); - OCMenu.TabIndex = 2; + OCMenu.TabIndex = 1; // - // menuItem1 + // Files // - menuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { AddMIDIsToQueue, RemoveMIDIsFromQueue, ClearQueue, toolStripMenuItem1, ExitFromConverter }); - menuItem1.Name = "menuItem1"; - menuItem1.Size = new System.Drawing.Size(37, 20); - menuItem1.Text = "File"; + Files.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { AddMIDIsToQueue, RemoveMIDIsFromQueue, ClearQueue, toolStripMenuItem1, ExitFromConverter }); + Files.Name = "Files"; + Files.Size = new System.Drawing.Size(37, 20); + Files.Text = "File"; // // AddMIDIsToQueue // @@ -119,12 +122,12 @@ private void InitializeComponent() ExitFromConverter.Text = "Exit"; ExitFromConverter.Click += ExitFromConverter_Click; // - // menuItem7 + // Help // - menuItem7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { InfoAboutConverter, toolStripMenuItem3, CreateIssueGitHub, CheckForUpdates, toolStripMenuItem2, DownloadConvSrc }); - menuItem7.Name = "menuItem7"; - menuItem7.Size = new System.Drawing.Size(24, 20); - menuItem7.Text = "?"; + Help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { InfoAboutConverter, toolStripMenuItem3, CreateIssueGitHub, CheckForUpdates, toolStripMenuItem2, DownloadConvSrc }); + Help.Name = "Help"; + Help.Size = new System.Drawing.Size(24, 20); + Help.Text = "?"; // // InfoAboutConverter // @@ -162,41 +165,66 @@ private void InitializeComponent() DownloadConvSrc.Size = new System.Drawing.Size(276, 22); DownloadConvSrc.Text = "Download the converter's source code"; // - // groupBox1 - // - groupBox1.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - groupBox1.Controls.Add(TMIDIs); - groupBox1.Controls.Add(FNVal); - groupBox1.Controls.Add(CMIDIs); - groupBox1.Controls.Add(FPVal); - groupBox1.Controls.Add(COS); - groupBox1.Controls.Add(TLVal); - groupBox1.Controls.Add(ESFL); - groupBox1.Controls.Add(TLLab); - groupBox1.Controls.Add(SVal); - groupBox1.Controls.Add(SLab); - groupBox1.Controls.Add(TVal); - groupBox1.Controls.Add(TLab); - groupBox1.Controls.Add(NCVal); - groupBox1.Controls.Add(NCLab); - groupBox1.Controls.Add(FPLab); - groupBox1.Controls.Add(FNLab); - groupBox1.Location = new System.Drawing.Point(12, 394); - groupBox1.Name = "groupBox1"; - groupBox1.Size = new System.Drawing.Size(760, 134); - groupBox1.TabIndex = 1; - groupBox1.TabStop = false; - groupBox1.Text = "Information"; - // - // TMIDIs - // - TMIDIs.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; - TMIDIs.Location = new System.Drawing.Point(595, 60); - TMIDIs.Name = "TMIDIs"; - TMIDIs.Size = new System.Drawing.Size(160, 19); - TMIDIs.TabIndex = 7; - TMIDIs.Text = "Total MIDIs: 0"; - TMIDIs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // InfoBox + // + InfoBox.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + InfoBox.Controls.Add(VolLab); + InfoBox.Controls.Add(label1); + InfoBox.Controls.Add(VolBar); + InfoBox.Controls.Add(FNVal); + InfoBox.Controls.Add(CMIDIs); + InfoBox.Controls.Add(FPVal); + InfoBox.Controls.Add(COS); + InfoBox.Controls.Add(TLVal); + InfoBox.Controls.Add(ESFL); + InfoBox.Controls.Add(TLLab); + InfoBox.Controls.Add(SVal); + InfoBox.Controls.Add(SLab); + InfoBox.Controls.Add(TVal); + InfoBox.Controls.Add(TLab); + InfoBox.Controls.Add(NCVal); + InfoBox.Controls.Add(NCLab); + InfoBox.Controls.Add(FPLab); + InfoBox.Controls.Add(FNLab); + InfoBox.Location = new System.Drawing.Point(12, 394); + InfoBox.Name = "InfoBox"; + InfoBox.Size = new System.Drawing.Size(760, 134); + InfoBox.TabIndex = 1; + InfoBox.TabStop = false; + InfoBox.Text = "Information"; + // + // VolLab + // + VolLab.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + VolLab.Location = new System.Drawing.Point(645, 43); + VolLab.Name = "VolLab"; + VolLab.Size = new System.Drawing.Size(109, 15); + VolLab.TabIndex = 14; + VolLab.Text = "0% (-∞dB)"; + VolLab.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label1 + // + label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + label1.Location = new System.Drawing.Point(595, 43); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(53, 15); + label1.TabIndex = 13; + label1.Text = "Volume:"; + label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // VolBar + // + VolBar.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + VolBar.AutoSize = false; + VolBar.Location = new System.Drawing.Point(595, 59); + VolBar.Maximum = 10000; + VolBar.Name = "VolBar"; + VolBar.Size = new System.Drawing.Size(160, 23); + VolBar.TabIndex = 5; + VolBar.TickFrequency = 100; + VolBar.TickStyle = System.Windows.Forms.TickStyle.None; + VolBar.Scroll += VolBar_Scroll; // // FNVal // @@ -360,7 +388,7 @@ private void InitializeComponent() MIDIQueue.Name = "MIDIQueue"; MIDIQueue.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; MIDIQueue.Size = new System.Drawing.Size(760, 361); - MIDIQueue.TabIndex = 1; + MIDIQueue.TabIndex = 2; MIDIQueue.SelectedIndexChanged += MIDIQueue_SelectedIndexChanged; MIDIQueue.DragDrop += MIDIQueue_DragDrop; MIDIQueue.DragEnter += MIDIQueue_DragEnter; @@ -400,7 +428,7 @@ private void InitializeComponent() ClientSize = new System.Drawing.Size(784, 540); ContextMenuStrip = OCContextMenu; Controls.Add(MIDIQueue); - Controls.Add(groupBox1); + Controls.Add(InfoBox); Controls.Add(OCMenu); Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); @@ -410,8 +438,9 @@ private void InitializeComponent() Load += MainWindow_Load; OCMenu.ResumeLayout(false); OCMenu.PerformLayout(); - groupBox1.ResumeLayout(false); - groupBox1.PerformLayout(); + InfoBox.ResumeLayout(false); + InfoBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)VolBar).EndInit(); OCContextMenu.ResumeLayout(false); ResumeLayout(false); PerformLayout(); @@ -420,9 +449,9 @@ private void InitializeComponent() #endregion private System.Windows.Forms.MenuStrip OCMenu; - private System.Windows.Forms.ToolStripMenuItem menuItem1; + private System.Windows.Forms.ToolStripMenuItem Files; private System.Windows.Forms.ToolStripMenuItem AddMIDIsToQueue; - private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox InfoBox; private System.Windows.Forms.ListBox MIDIQueue; private System.Windows.Forms.Label FPLab; private System.Windows.Forms.Label FNLab; @@ -435,7 +464,6 @@ private void InitializeComponent() private System.Windows.Forms.Button CMIDIs; private System.Windows.Forms.Button COS; private System.Windows.Forms.Button ESFL; - private System.Windows.Forms.Label TMIDIs; private System.Windows.Forms.Label TLVal; private System.Windows.Forms.Label TLLab; private System.Windows.Forms.RichTextBox FPVal; @@ -443,7 +471,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem RemoveMIDIsFromQueue; private System.Windows.Forms.ToolStripMenuItem ClearQueue; private System.Windows.Forms.ToolStripMenuItem ExitFromConverter; - private System.Windows.Forms.ToolStripMenuItem menuItem7; + private System.Windows.Forms.ToolStripMenuItem Help; private System.Windows.Forms.ToolStripMenuItem InfoAboutConverter; private System.Windows.Forms.ToolStripMenuItem CreateIssueGitHub; private System.Windows.Forms.ToolStripMenuItem CheckForUpdates; @@ -455,6 +483,9 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TrackBar VolBar; + private System.Windows.Forms.Label VolLab; } } diff --git a/OmniConverter/Forms/MainWindow.cs b/OmniConverter/Forms/MainWindow.cs index e7f490e..2ef0210 100644 --- a/OmniConverter/Forms/MainWindow.cs +++ b/OmniConverter/Forms/MainWindow.cs @@ -1,9 +1,11 @@ using Microsoft.WindowsAPICodePack.Dialogs; +using Octokit; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Windows.Forms; +using Application = System.Windows.Forms.Application; namespace OmniConverter { @@ -15,6 +17,8 @@ public MainWindow(String[] MIDIs) this.MainMenuStrip = OCMenu; MIDIQueue.ContextMenuStrip = OCContextMenu; + VolBar.Value = (int)(Properties.Settings.Default.Volume * 10000); + VolBar_Scroll(null, null); if (MIDIs.Length > 0) new MIDIImporter(MIDIs, true).ShowDialog(); @@ -43,7 +47,7 @@ private void GetSelectedMIDIInfo() { Boolean AtLeastOne = MIDIQueue.SelectedItems.Count > 0, MultiSelect = MIDIQueue.SelectedItems.Count > 1, TooMany = MIDIQueue.SelectedItems.Count > 4; - TMIDIs.Text = String.Format("Total MIDIs in queue: {0}", MIDIQueue.Items.Count.ToString("N0", new CultureInfo("is-IS"))); + InfoBox.Text = String.Format("Information (Total MIDIs in queue: {0})", MIDIQueue.Items.Count.ToString("N0", new CultureInfo("is-IS"))); Debug.PrintToConsole("ok", "GetSelectedMIDIInfo() called."); while (AtLeastOne) @@ -215,9 +219,9 @@ private void CMIDIs_Click(object sender, EventArgs e) { System.Diagnostics.ProcessStartInfo PSI; Version OSVer = Environment.OSVersion.Version; - String HybridShutdown = ""; + string HybridShutdown = ""; - if (OSVer.Major == 6 && OSVer.Minor >= 2 || OSVer.Major >= 10) + if (OSVer.Major == 6 && OSVer.Minor >= 2 || OSVer.Major >= 6) HybridShutdown = " /hybrid"; switch (Properties.Settings.Default.DoActionAfterRenderV) @@ -229,13 +233,13 @@ private void CMIDIs_Click(object sender, EventArgs e) Application.SetSuspendState(PowerState.Hibernate, true, false); break; case 2: - PSI = new System.Diagnostics.ProcessStartInfo("shutdown", String.Format("/s{0} /t 15 /c \"Automatic shutdown through OmniProgram.\"", HybridShutdown)); + PSI = new System.Diagnostics.ProcessStartInfo("shutdown", String.Format("/s{0} /t 15 /c \"Automatic shutdown through OmniConverter.\"", HybridShutdown)); PSI.CreateNoWindow = true; PSI.UseShellExecute = false; System.Diagnostics.Process.Start(PSI); break; case 3: - PSI = new System.Diagnostics.ProcessStartInfo("shutdown", "/r /t 0"); + PSI = new System.Diagnostics.ProcessStartInfo("shutdown", "/r /t 15 /c \"Automatic restart through OmniConverter.\""); PSI.CreateNoWindow = true; PSI.UseShellExecute = false; System.Diagnostics.Process.Start(PSI); @@ -247,6 +251,17 @@ private void CMIDIs_Click(object sender, EventArgs e) } } + private void VolBar_Scroll(object sender, EventArgs e) + { + if (sender != null && e != null) + { + Properties.Settings.Default.Volume = (float)Convert.ToDouble(VolBar.Value / 10000.0f); + Properties.Settings.Default.Save(); + } + + VolLab.Text = $"({20 * Math.Log10(Properties.Settings.Default.Volume / 1.0f):0.00}dB) {VolBar.Value / 100.0f:000.00}%"; + } + private void MIDIQueue_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) @@ -261,10 +276,21 @@ private void MIDIQueue_DragEnter(object sender, DragEventArgs e) private void MIDIQueue_DragDrop(object sender, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); - new MIDIImporter(files, false).ShowDialog(); - RebindList(); - GetSelectedMIDIInfo(); + Debug.PrintToConsole("ok", $"DragDrop detected, {files.Length} files."); + + if (files.Length > 0) + { + var t = new MIDIImporter(files, false); + + t.ShowDialog(); + + if (t.TotalValidFiles() > 0) + { + RebindList(); + GetSelectedMIDIInfo(); + } + } } private void COS_Click(object sender, EventArgs e) diff --git a/OmniConverter/Forms/Settings.Designer.cs b/OmniConverter/Forms/Settings.Designer.cs index 8efb5e9..1df091f 100644 --- a/OmniConverter/Forms/Settings.Designer.cs +++ b/OmniConverter/Forms/Settings.Designer.cs @@ -28,504 +28,455 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.AudioSettings = new System.Windows.Forms.GroupBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.EnableRCOverride = new System.Windows.Forms.CheckBox(); - this.EnableLoudMax = new System.Windows.Forms.CheckBox(); - this.NoteOff1 = new System.Windows.Forms.CheckBox(); - this.FXDisable = new System.Windows.Forms.CheckBox(); - this.SincInter = new System.Windows.Forms.CheckBox(); - this.MaxVoicesLabel = new System.Windows.Forms.Label(); - this.MaxVoices = new System.Windows.Forms.NumericUpDown(); - this.AudioFreqLabel = new System.Windows.Forms.Label(); - this.FrequencyBox = new System.Windows.Forms.ComboBox(); - this.Label6 = new System.Windows.Forms.Label(); - this.EventsSettings = new System.Windows.Forms.GroupBox(); - this.MTLimitVal = new System.Windows.Forms.NumericUpDown(); - this.MTLimitLab = new System.Windows.Forms.Label(); - this.MTLimit = new System.Windows.Forms.CheckBox(); - this.PerTrackMode = new System.Windows.Forms.CheckBox(); - this.AOFBrowse = new System.Windows.Forms.Button(); - this.AOFPath = new System.Windows.Forms.TextBox(); - this.AutoOutputFolder = new System.Windows.Forms.CheckBox(); - this.PerTrackStorage = new System.Windows.Forms.CheckBox(); - this.PerTrackExportEach = new System.Windows.Forms.CheckBox(); - this.MTMode = new System.Windows.Forms.CheckBox(); - this.OkBtn = new System.Windows.Forms.Button(); - this.PostConvSettings = new System.Windows.Forms.GroupBox(); - this.DoActionAfterRenderVal = new System.Windows.Forms.ComboBox(); - this.DoActionAfterRender = new System.Windows.Forms.CheckBox(); - this.ReverbL = new System.Windows.Forms.Label(); - this.ReverbV = new System.Windows.Forms.NumericUpDown(); - this.ChorusV = new System.Windows.Forms.NumericUpDown(); - this.ChorusL = new System.Windows.Forms.Label(); - this.AudioSettings.SuspendLayout(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MaxVoices)).BeginInit(); - this.EventsSettings.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MTLimitVal)).BeginInit(); - this.PostConvSettings.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ReverbV)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.ChorusV)).BeginInit(); - this.SuspendLayout(); - // - // AudioSettings - // - this.AudioSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.AudioSettings.Controls.Add(this.groupBox1); - this.AudioSettings.Controls.Add(this.EnableLoudMax); - this.AudioSettings.Controls.Add(this.NoteOff1); - this.AudioSettings.Controls.Add(this.FXDisable); - this.AudioSettings.Controls.Add(this.SincInter); - this.AudioSettings.Controls.Add(this.MaxVoicesLabel); - this.AudioSettings.Controls.Add(this.MaxVoices); - this.AudioSettings.Controls.Add(this.AudioFreqLabel); - this.AudioSettings.Controls.Add(this.FrequencyBox); - this.AudioSettings.Controls.Add(this.Label6); - this.AudioSettings.Location = new System.Drawing.Point(14, 14); - this.AudioSettings.Name = "AudioSettings"; - this.AudioSettings.Size = new System.Drawing.Size(430, 266); - this.AudioSettings.TabIndex = 0; - this.AudioSettings.TabStop = false; - this.AudioSettings.Text = "Audio settings"; + groupBox1 = new System.Windows.Forms.GroupBox(); + ChorusV = new System.Windows.Forms.NumericUpDown(); + ChorusL = new System.Windows.Forms.Label(); + ReverbV = new System.Windows.Forms.NumericUpDown(); + ReverbL = new System.Windows.Forms.Label(); + EnableRCOverride = new System.Windows.Forms.CheckBox(); + EnableLoudMax = new System.Windows.Forms.CheckBox(); + NoteOff1 = new System.Windows.Forms.CheckBox(); + FXDisable = new System.Windows.Forms.CheckBox(); + SincInter = new System.Windows.Forms.CheckBox(); + MaxVoicesLabel = new System.Windows.Forms.Label(); + MaxVoices = new System.Windows.Forms.NumericUpDown(); + AudioFreqLabel = new System.Windows.Forms.Label(); + FrequencyBox = new System.Windows.Forms.ComboBox(); + Label6 = new System.Windows.Forms.Label(); + MTLimitVal = new System.Windows.Forms.NumericUpDown(); + MTLimitLab = new System.Windows.Forms.Label(); + MTLimit = new System.Windows.Forms.CheckBox(); + PerTrackMode = new System.Windows.Forms.CheckBox(); + AOFPath = new System.Windows.Forms.TextBox(); + AutoOutputFolder = new System.Windows.Forms.CheckBox(); + PerTrackStorage = new System.Windows.Forms.CheckBox(); + PerTrackExportEach = new System.Windows.Forms.CheckBox(); + MTMode = new System.Windows.Forms.CheckBox(); + OkBtn = new System.Windows.Forms.Button(); + DoActionAfterRenderVal = new System.Windows.Forms.ComboBox(); + DoActionAfterRender = new System.Windows.Forms.CheckBox(); + tabControl1 = new System.Windows.Forms.TabControl(); + ASet = new System.Windows.Forms.TabPage(); + ESet = new System.Windows.Forms.TabPage(); + AOFBrowse = new System.Windows.Forms.Button(); + PCSet = new System.Windows.Forms.TabPage(); + groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)ChorusV).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ReverbV).BeginInit(); + ((System.ComponentModel.ISupportInitialize)MaxVoices).BeginInit(); + ((System.ComponentModel.ISupportInitialize)MTLimitVal).BeginInit(); + tabControl1.SuspendLayout(); + ASet.SuspendLayout(); + ESet.SuspendLayout(); + PCSet.SuspendLayout(); + SuspendLayout(); // // groupBox1 // - this.groupBox1.Controls.Add(this.ChorusV); - this.groupBox1.Controls.Add(this.ChorusL); - this.groupBox1.Controls.Add(this.ReverbV); - this.groupBox1.Controls.Add(this.ReverbL); - this.groupBox1.Controls.Add(this.EnableRCOverride); - this.groupBox1.Location = new System.Drawing.Point(6, 185); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(415, 73); - this.groupBox1.TabIndex = 46; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Control Event Override"; + groupBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + groupBox1.Controls.Add(ChorusV); + groupBox1.Controls.Add(ChorusL); + groupBox1.Controls.Add(ReverbV); + groupBox1.Controls.Add(ReverbL); + groupBox1.Controls.Add(EnableRCOverride); + groupBox1.Location = new System.Drawing.Point(6, 156); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new System.Drawing.Size(442, 81); + groupBox1.TabIndex = 46; + groupBox1.TabStop = false; + groupBox1.Text = "Control Event Override"; + // + // ChorusV + // + ChorusV.Enabled = false; + ChorusV.Location = new System.Drawing.Point(218, 46); + ChorusV.Maximum = new decimal(new int[] { 127, 0, 0, 0 }); + ChorusV.Name = "ChorusV"; + ChorusV.Size = new System.Drawing.Size(39, 23); + ChorusV.TabIndex = 49; + // + // ChorusL + // + ChorusL.AutoSize = true; + ChorusL.Enabled = false; + ChorusL.Location = new System.Drawing.Point(131, 49); + ChorusL.Name = "ChorusL"; + ChorusL.Size = new System.Drawing.Size(85, 15); + ChorusL.TabIndex = 48; + ChorusL.Text = "Chorus (0-127)"; + // + // ReverbV + // + ReverbV.Enabled = false; + ReverbV.Location = new System.Drawing.Point(91, 46); + ReverbV.Maximum = new decimal(new int[] { 127, 0, 0, 0 }); + ReverbV.Name = "ReverbV"; + ReverbV.Size = new System.Drawing.Size(39, 23); + ReverbV.TabIndex = 47; + // + // ReverbL + // + ReverbL.AutoSize = true; + ReverbL.BackColor = System.Drawing.Color.Transparent; + ReverbL.Enabled = false; + ReverbL.Location = new System.Drawing.Point(4, 49); + ReverbL.Name = "ReverbL"; + ReverbL.Size = new System.Drawing.Size(83, 15); + ReverbL.TabIndex = 46; + ReverbL.Text = "Reverb (0-127)"; // // EnableRCOverride // - this.EnableRCOverride.AutoSize = true; - this.EnableRCOverride.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.EnableRCOverride.Location = new System.Drawing.Point(6, 22); - this.EnableRCOverride.Name = "EnableRCOverride"; - this.EnableRCOverride.Size = new System.Drawing.Size(240, 20); - this.EnableRCOverride.TabIndex = 45; - this.EnableRCOverride.Text = "Override MIDI reverb and chrous events"; - this.EnableRCOverride.UseVisualStyleBackColor = true; - this.EnableRCOverride.CheckedChanged += new System.EventHandler(this.EnableRCOverride_CheckedChanged); + EnableRCOverride.AutoSize = true; + EnableRCOverride.FlatStyle = System.Windows.Forms.FlatStyle.System; + EnableRCOverride.Location = new System.Drawing.Point(6, 22); + EnableRCOverride.Name = "EnableRCOverride"; + EnableRCOverride.Size = new System.Drawing.Size(248, 20); + EnableRCOverride.TabIndex = 45; + EnableRCOverride.Text = "Override reverb and chorus in the render:"; + EnableRCOverride.UseVisualStyleBackColor = true; + EnableRCOverride.CheckedChanged += EnableRCOverride_CheckedChanged; // // EnableLoudMax // - this.EnableLoudMax.AutoSize = true; - this.EnableLoudMax.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.EnableLoudMax.Location = new System.Drawing.Point(10, 159); - this.EnableLoudMax.Name = "EnableLoudMax"; - this.EnableLoudMax.Size = new System.Drawing.Size(276, 20); - this.EnableLoudMax.TabIndex = 44; - this.EnableLoudMax.Text = "Enable audio limiter, to prevent audio clipping"; - this.EnableLoudMax.UseVisualStyleBackColor = true; + EnableLoudMax.AutoSize = true; + EnableLoudMax.FlatStyle = System.Windows.Forms.FlatStyle.System; + EnableLoudMax.Location = new System.Drawing.Point(6, 126); + EnableLoudMax.Name = "EnableLoudMax"; + EnableLoudMax.Size = new System.Drawing.Size(235, 20); + EnableLoudMax.TabIndex = 44; + EnableLoudMax.Text = "Limit audio to 0dB, to prevent clipping"; + EnableLoudMax.UseVisualStyleBackColor = true; // // NoteOff1 // - this.NoteOff1.AutoSize = true; - this.NoteOff1.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.NoteOff1.Location = new System.Drawing.Point(10, 137); - this.NoteOff1.Name = "NoteOff1"; - this.NoteOff1.Size = new System.Drawing.Size(358, 20); - this.NoteOff1.TabIndex = 43; - this.NoteOff1.Text = "Only release the oldest instance of a note upon note-off event"; - this.NoteOff1.UseVisualStyleBackColor = true; + NoteOff1.AutoSize = true; + NoteOff1.FlatStyle = System.Windows.Forms.FlatStyle.System; + NoteOff1.Location = new System.Drawing.Point(6, 104); + NoteOff1.Name = "NoteOff1"; + NoteOff1.Size = new System.Drawing.Size(358, 20); + NoteOff1.TabIndex = 43; + NoteOff1.Text = "Only release the oldest instance of a note upon note-off event"; + NoteOff1.UseVisualStyleBackColor = true; // // FXDisable // - this.FXDisable.AutoSize = true; - this.FXDisable.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.FXDisable.Location = new System.Drawing.Point(10, 115); - this.FXDisable.Name = "FXDisable"; - this.FXDisable.Size = new System.Drawing.Size(255, 20); - this.FXDisable.TabIndex = 42; - this.FXDisable.Text = "Disable sound effects (Reverb, chorus etc.)"; - this.FXDisable.UseVisualStyleBackColor = true; + FXDisable.AutoSize = true; + FXDisable.FlatStyle = System.Windows.Forms.FlatStyle.System; + FXDisable.Location = new System.Drawing.Point(6, 82); + FXDisable.Name = "FXDisable"; + FXDisable.Size = new System.Drawing.Size(241, 20); + FXDisable.TabIndex = 42; + FXDisable.Text = "Disable Sound FXs (Reverb, Chorus etc.)"; + FXDisable.UseVisualStyleBackColor = true; // // SincInter // - this.SincInter.AutoSize = true; - this.SincInter.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.SincInter.Location = new System.Drawing.Point(10, 93); - this.SincInter.Name = "SincInter"; - this.SincInter.Size = new System.Drawing.Size(162, 20); - this.SincInter.TabIndex = 41; - this.SincInter.Text = "Enable sinc interpolation"; - this.SincInter.UseVisualStyleBackColor = true; + SincInter.AutoSize = true; + SincInter.FlatStyle = System.Windows.Forms.FlatStyle.System; + SincInter.Location = new System.Drawing.Point(6, 60); + SincInter.Name = "SincInter"; + SincInter.Size = new System.Drawing.Size(341, 20); + SincInter.TabIndex = 41; + SincInter.Text = "Enable Whittaker–Shannon audio interpolation (Sinc inter.)"; + SincInter.UseVisualStyleBackColor = true; // // MaxVoicesLabel // - this.MaxVoicesLabel.AutoSize = true; - this.MaxVoicesLabel.Location = new System.Drawing.Point(7, 25); - this.MaxVoicesLabel.Name = "MaxVoicesLabel"; - this.MaxVoicesLabel.Size = new System.Drawing.Size(103, 15); - this.MaxVoicesLabel.TabIndex = 40; - this.MaxVoicesLabel.Text = "Active voices limit"; + MaxVoicesLabel.AutoSize = true; + MaxVoicesLabel.Location = new System.Drawing.Point(6, 8); + MaxVoicesLabel.Name = "MaxVoicesLabel"; + MaxVoicesLabel.Size = new System.Drawing.Size(62, 15); + MaxVoicesLabel.TabIndex = 40; + MaxVoicesLabel.Text = "Voice limit"; // // MaxVoices // - this.MaxVoices.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.MaxVoices.Location = new System.Drawing.Point(354, 23); - this.MaxVoices.Maximum = new decimal(new int[] { - 100000, - 0, - 0, - 0}); - this.MaxVoices.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.MaxVoices.Name = "MaxVoices"; - this.MaxVoices.Size = new System.Drawing.Size(64, 23); - this.MaxVoices.TabIndex = 39; - this.MaxVoices.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MaxVoices.Value = new decimal(new int[] { - 100000, - 0, - 0, - 0}); + MaxVoices.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + MaxVoices.Location = new System.Drawing.Point(384, 6); + MaxVoices.Maximum = new decimal(new int[] { 100000, 0, 0, 0 }); + MaxVoices.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + MaxVoices.Name = "MaxVoices"; + MaxVoices.Size = new System.Drawing.Size(64, 23); + MaxVoices.TabIndex = 39; + MaxVoices.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + MaxVoices.Value = new decimal(new int[] { 100000, 0, 0, 0 }); // // AudioFreqLabel // - this.AudioFreqLabel.AutoSize = true; - this.AudioFreqLabel.Location = new System.Drawing.Point(7, 60); - this.AudioFreqLabel.Name = "AudioFreqLabel"; - this.AudioFreqLabel.Size = new System.Drawing.Size(134, 15); - this.AudioFreqLabel.TabIndex = 37; - this.AudioFreqLabel.Text = "Output audio frequency"; + AudioFreqLabel.AutoSize = true; + AudioFreqLabel.Location = new System.Drawing.Point(6, 35); + AudioFreqLabel.Name = "AudioFreqLabel"; + AudioFreqLabel.Size = new System.Drawing.Size(133, 15); + AudioFreqLabel.TabIndex = 37; + AudioFreqLabel.Text = "Render audio frequency"; // // FrequencyBox // - this.FrequencyBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.FrequencyBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.FrequencyBox.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.FrequencyBox.FormattingEnabled = true; - this.FrequencyBox.Items.AddRange(new object[] { - "192000", - "176400", - "142180", - "96000", - "88200", - "74750", - "66150", - "50400", - "50000", - "48000", - "47250", - "44100", - "44056", - "37800", - "32000", - "22050", - "16000", - "11025", - "8000", - "4000"}); - this.FrequencyBox.Location = new System.Drawing.Point(333, 55); - this.FrequencyBox.Name = "FrequencyBox"; - this.FrequencyBox.Size = new System.Drawing.Size(68, 23); - this.FrequencyBox.TabIndex = 36; + FrequencyBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + FrequencyBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + FrequencyBox.FlatStyle = System.Windows.Forms.FlatStyle.System; + FrequencyBox.FormattingEnabled = true; + FrequencyBox.Items.AddRange(new object[] { "192000", "176400", "142180", "96000", "88200", "74750", "66150", "50400", "50000", "48000", "47250", "44100", "44056", "37800", "32000", "22050", "16000", "11025", "8000", "4000" }); + FrequencyBox.Location = new System.Drawing.Point(361, 32); + FrequencyBox.Name = "FrequencyBox"; + FrequencyBox.Size = new System.Drawing.Size(68, 23); + FrequencyBox.TabIndex = 36; // // Label6 // - this.Label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.Label6.AutoSize = true; - this.Label6.Location = new System.Drawing.Point(400, 60); - this.Label6.Name = "Label6"; - this.Label6.Size = new System.Drawing.Size(21, 15); - this.Label6.TabIndex = 38; - this.Label6.Text = "Hz"; - // - // EventsSettings - // - this.EventsSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.EventsSettings.Controls.Add(this.MTLimitVal); - this.EventsSettings.Controls.Add(this.MTLimitLab); - this.EventsSettings.Controls.Add(this.MTLimit); - this.EventsSettings.Controls.Add(this.PerTrackMode); - this.EventsSettings.Controls.Add(this.AOFBrowse); - this.EventsSettings.Controls.Add(this.AOFPath); - this.EventsSettings.Controls.Add(this.AutoOutputFolder); - this.EventsSettings.Controls.Add(this.PerTrackStorage); - this.EventsSettings.Controls.Add(this.PerTrackExportEach); - this.EventsSettings.Controls.Add(this.MTMode); - this.EventsSettings.Location = new System.Drawing.Point(14, 286); - this.EventsSettings.Name = "EventsSettings"; - this.EventsSettings.Size = new System.Drawing.Size(430, 205); - this.EventsSettings.TabIndex = 1; - this.EventsSettings.TabStop = false; - this.EventsSettings.Text = "Export settings"; + Label6.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + Label6.AutoSize = true; + Label6.Location = new System.Drawing.Point(429, 35); + Label6.Name = "Label6"; + Label6.Size = new System.Drawing.Size(21, 15); + Label6.TabIndex = 38; + Label6.Text = "Hz"; // // MTLimitVal // - this.MTLimitVal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.MTLimitVal.Location = new System.Drawing.Point(370, 118); - this.MTLimitVal.Maximum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.MTLimitVal.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.MTLimitVal.Name = "MTLimitVal"; - this.MTLimitVal.Size = new System.Drawing.Size(48, 23); - this.MTLimitVal.TabIndex = 45; - this.MTLimitVal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MTLimitVal.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); + MTLimitVal.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + MTLimitVal.Location = new System.Drawing.Point(400, 102); + MTLimitVal.Maximum = new decimal(new int[] { 1, 0, 0, 0 }); + MTLimitVal.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + MTLimitVal.Name = "MTLimitVal"; + MTLimitVal.Size = new System.Drawing.Size(48, 23); + MTLimitVal.TabIndex = 45; + MTLimitVal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + MTLimitVal.Value = new decimal(new int[] { 1, 0, 0, 0 }); // // MTLimitLab // - this.MTLimitLab.AutoSize = true; - this.MTLimitLab.Location = new System.Drawing.Point(319, 120); - this.MTLimitLab.Name = "MTLimitLab"; - this.MTLimitLab.Size = new System.Drawing.Size(51, 15); - this.MTLimitLab.TabIndex = 52; - this.MTLimitLab.Text = "Threads:"; + MTLimitLab.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + MTLimitLab.AutoSize = true; + MTLimitLab.Location = new System.Drawing.Point(350, 104); + MTLimitLab.Name = "MTLimitLab"; + MTLimitLab.Size = new System.Drawing.Size(51, 15); + MTLimitLab.TabIndex = 52; + MTLimitLab.Text = "Threads:"; // // MTLimit // - this.MTLimit.AutoSize = true; - this.MTLimit.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.MTLimit.Location = new System.Drawing.Point(10, 118); - this.MTLimit.Name = "MTLimit"; - this.MTLimit.Size = new System.Drawing.Size(247, 20); - this.MTLimit.TabIndex = 51; - this.MTLimit.Text = "Use a custom threads limit for the export"; - this.MTLimit.UseVisualStyleBackColor = true; - this.MTLimit.CheckedChanged += new System.EventHandler(this.MTLimit_CheckedChanged); + MTLimit.AutoSize = true; + MTLimit.FlatStyle = System.Windows.Forms.FlatStyle.System; + MTLimit.Location = new System.Drawing.Point(6, 102); + MTLimit.Name = "MTLimit"; + MTLimit.Size = new System.Drawing.Size(326, 20); + MTLimit.TabIndex = 51; + MTLimit.Text = "Limit the amount of system threads available to the app"; + MTLimit.UseVisualStyleBackColor = true; + MTLimit.CheckedChanged += MTLimit_CheckedChanged; // // PerTrackMode // - this.PerTrackMode.AutoSize = true; - this.PerTrackMode.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.PerTrackMode.Location = new System.Drawing.Point(10, 44); - this.PerTrackMode.Name = "PerTrackMode"; - this.PerTrackMode.Size = new System.Drawing.Size(423, 20); - this.PerTrackMode.TabIndex = 50; - this.PerTrackMode.Text = "Render each track of a MIDI separately and merge them into one audio file"; - this.PerTrackMode.UseVisualStyleBackColor = true; - this.PerTrackMode.CheckedChanged += new System.EventHandler(this.PerTrackMode_CheckedChanged); - // - // AOFBrowse - // - this.AOFBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.AOFBrowse.Location = new System.Drawing.Point(333, 170); - this.AOFBrowse.Name = "AOFBrowse"; - this.AOFBrowse.Size = new System.Drawing.Size(87, 25); - this.AOFBrowse.TabIndex = 49; - this.AOFBrowse.Text = "Browse..."; - this.AOFBrowse.UseVisualStyleBackColor = true; - this.AOFBrowse.Click += new System.EventHandler(this.AOFBrowse_Click); + PerTrackMode.AutoSize = true; + PerTrackMode.FlatStyle = System.Windows.Forms.FlatStyle.System; + PerTrackMode.Location = new System.Drawing.Point(6, 28); + PerTrackMode.Name = "PerTrackMode"; + PerTrackMode.Size = new System.Drawing.Size(443, 20); + PerTrackMode.TabIndex = 50; + PerTrackMode.Text = "Render instead each track on a separate thread, and merge all in one audio file"; + PerTrackMode.UseVisualStyleBackColor = true; + PerTrackMode.CheckedChanged += PerTrackMode_CheckedChanged; // // AOFPath // - this.AOFPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.AOFPath.Location = new System.Drawing.Point(10, 171); - this.AOFPath.Name = "AOFPath"; - this.AOFPath.Size = new System.Drawing.Size(317, 23); - this.AOFPath.TabIndex = 48; + AOFPath.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + AOFPath.Location = new System.Drawing.Point(6, 155); + AOFPath.Name = "AOFPath"; + AOFPath.Size = new System.Drawing.Size(361, 23); + AOFPath.TabIndex = 48; // // AutoOutputFolder // - this.AutoOutputFolder.AutoSize = true; - this.AutoOutputFolder.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.AutoOutputFolder.Location = new System.Drawing.Point(10, 148); - this.AutoOutputFolder.Name = "AutoOutputFolder"; - this.AutoOutputFolder.Size = new System.Drawing.Size(358, 20); - this.AutoOutputFolder.TabIndex = 47; - this.AutoOutputFolder.Text = "Export MIDIs directly to this folder instead of asking everytime"; - this.AutoOutputFolder.UseVisualStyleBackColor = true; - this.AutoOutputFolder.CheckedChanged += new System.EventHandler(this.AutoOutputFolder_CheckedChanged); + AutoOutputFolder.AutoSize = true; + AutoOutputFolder.FlatStyle = System.Windows.Forms.FlatStyle.System; + AutoOutputFolder.Location = new System.Drawing.Point(6, 132); + AutoOutputFolder.Name = "AutoOutputFolder"; + AutoOutputFolder.Size = new System.Drawing.Size(429, 20); + AutoOutputFolder.TabIndex = 47; + AutoOutputFolder.Text = "Export final audios directly to a specified folder instead of asking every time"; + AutoOutputFolder.UseVisualStyleBackColor = true; + AutoOutputFolder.CheckedChanged += AutoOutputFolder_CheckedChanged; // // PerTrackStorage // - this.PerTrackStorage.AutoSize = true; - this.PerTrackStorage.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.PerTrackStorage.Location = new System.Drawing.Point(10, 88); - this.PerTrackStorage.Name = "PerTrackStorage"; - this.PerTrackStorage.Size = new System.Drawing.Size(405, 20); - this.PerTrackStorage.TabIndex = 46; - this.PerTrackStorage.Text = "Store each exported track into a folder with the same name as the MIDI"; - this.PerTrackStorage.UseVisualStyleBackColor = true; + PerTrackStorage.AutoSize = true; + PerTrackStorage.FlatStyle = System.Windows.Forms.FlatStyle.System; + PerTrackStorage.Location = new System.Drawing.Point(6, 72); + PerTrackStorage.Name = "PerTrackStorage"; + PerTrackStorage.Size = new System.Drawing.Size(405, 20); + PerTrackStorage.TabIndex = 46; + PerTrackStorage.Text = "Store each exported track into a folder with the same name as the MIDI"; + PerTrackStorage.UseVisualStyleBackColor = true; // // PerTrackExportEach // - this.PerTrackExportEach.AutoSize = true; - this.PerTrackExportEach.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.PerTrackExportEach.Location = new System.Drawing.Point(10, 66); - this.PerTrackExportEach.Name = "PerTrackExportEach"; - this.PerTrackExportEach.Size = new System.Drawing.Size(388, 20); - this.PerTrackExportEach.TabIndex = 45; - this.PerTrackExportEach.Text = "Export each track separately instead of merging them automatically"; - this.PerTrackExportEach.UseVisualStyleBackColor = true; - this.PerTrackExportEach.CheckedChanged += new System.EventHandler(this.PerTrackExportEach_CheckedChanged); + PerTrackExportEach.AutoSize = true; + PerTrackExportEach.FlatStyle = System.Windows.Forms.FlatStyle.System; + PerTrackExportEach.Location = new System.Drawing.Point(6, 50); + PerTrackExportEach.Name = "PerTrackExportEach"; + PerTrackExportEach.Size = new System.Drawing.Size(408, 20); + PerTrackExportEach.TabIndex = 45; + PerTrackExportEach.Text = "Disable automatic merging of the tracks, and export them all separately"; + PerTrackExportEach.UseVisualStyleBackColor = true; + PerTrackExportEach.CheckedChanged += PerTrackExportEach_CheckedChanged; // // MTMode // - this.MTMode.AutoSize = true; - this.MTMode.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.MTMode.Location = new System.Drawing.Point(10, 22); - this.MTMode.Name = "MTMode"; - this.MTMode.Size = new System.Drawing.Size(215, 20); - this.MTMode.TabIndex = 44; - this.MTMode.Text = "Enable multi-threaded MIDI export"; - this.MTMode.UseVisualStyleBackColor = true; - this.MTMode.CheckedChanged += new System.EventHandler(this.MTMode_CheckedChanged); + MTMode.AutoSize = true; + MTMode.FlatStyle = System.Windows.Forms.FlatStyle.System; + MTMode.Location = new System.Drawing.Point(6, 6); + MTMode.Name = "MTMode"; + MTMode.Size = new System.Drawing.Size(409, 20); + MTMode.TabIndex = 44; + MTMode.Text = "Enable multi-threaded rendering mode, and render one MIDI per thread"; + MTMode.UseVisualStyleBackColor = true; + MTMode.CheckedChanged += MTMode_CheckedChanged; // // OkBtn // - this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OkBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.OkBtn.Location = new System.Drawing.Point(370, 582); - this.OkBtn.Name = "OkBtn"; - this.OkBtn.Size = new System.Drawing.Size(75, 23); - this.OkBtn.TabIndex = 3; - this.OkBtn.Text = "OK"; - this.OkBtn.UseVisualStyleBackColor = true; - this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click); - // - // PostConvSettings - // - this.PostConvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.PostConvSettings.Controls.Add(this.DoActionAfterRenderVal); - this.PostConvSettings.Controls.Add(this.DoActionAfterRender); - this.PostConvSettings.Location = new System.Drawing.Point(14, 497); - this.PostConvSettings.Name = "PostConvSettings"; - this.PostConvSettings.Size = new System.Drawing.Size(430, 79); - this.PostConvSettings.TabIndex = 4; - this.PostConvSettings.TabStop = false; - this.PostConvSettings.Text = "Post-conversion settings"; + OkBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + OkBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + OkBtn.Location = new System.Drawing.Point(395, 356); + OkBtn.Name = "OkBtn"; + OkBtn.Size = new System.Drawing.Size(75, 23); + OkBtn.TabIndex = 3; + OkBtn.Text = "OK"; + OkBtn.UseVisualStyleBackColor = true; + OkBtn.Click += OkBtn_Click; // // DoActionAfterRenderVal // - this.DoActionAfterRenderVal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.DoActionAfterRenderVal.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.DoActionAfterRenderVal.FormattingEnabled = true; - this.DoActionAfterRenderVal.Items.AddRange(new object[] { - "Put the computer into sleep mode", - "Put the computer into hibernation mode", - "Turn the computer off", - "Restart the computer"}); - this.DoActionAfterRenderVal.Location = new System.Drawing.Point(10, 45); - this.DoActionAfterRenderVal.Name = "DoActionAfterRenderVal"; - this.DoActionAfterRenderVal.Size = new System.Drawing.Size(410, 23); - this.DoActionAfterRenderVal.TabIndex = 1; + DoActionAfterRenderVal.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + DoActionAfterRenderVal.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + DoActionAfterRenderVal.FormattingEnabled = true; + DoActionAfterRenderVal.Items.AddRange(new object[] { "Put the computer into sleep mode", "Put the computer into hibernation mode", "Turn the computer off", "Restart the computer" }); + DoActionAfterRenderVal.Location = new System.Drawing.Point(6, 29); + DoActionAfterRenderVal.Name = "DoActionAfterRenderVal"; + DoActionAfterRenderVal.Size = new System.Drawing.Size(255, 23); + DoActionAfterRenderVal.TabIndex = 1; // // DoActionAfterRender // - this.DoActionAfterRender.AutoSize = true; - this.DoActionAfterRender.Location = new System.Drawing.Point(10, 22); - this.DoActionAfterRender.Name = "DoActionAfterRender"; - this.DoActionAfterRender.Size = new System.Drawing.Size(391, 19); - this.DoActionAfterRender.TabIndex = 0; - this.DoActionAfterRender.Text = "Do one of the following actions once the computer is done rendering"; - this.DoActionAfterRender.UseVisualStyleBackColor = true; - this.DoActionAfterRender.CheckedChanged += new System.EventHandler(this.DoActionAfterRender_CheckedChanged); + DoActionAfterRender.AutoSize = true; + DoActionAfterRender.FlatStyle = System.Windows.Forms.FlatStyle.System; + DoActionAfterRender.Location = new System.Drawing.Point(6, 6); + DoActionAfterRender.Name = "DoActionAfterRender"; + DoActionAfterRender.Size = new System.Drawing.Size(397, 20); + DoActionAfterRender.TabIndex = 0; + DoActionAfterRender.Text = "Do one of the following actions once the computer is done rendering"; + DoActionAfterRender.UseVisualStyleBackColor = true; + DoActionAfterRender.CheckedChanged += DoActionAfterRender_CheckedChanged; + // + // tabControl1 + // + tabControl1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + tabControl1.Controls.Add(ASet); + tabControl1.Controls.Add(ESet); + tabControl1.Controls.Add(PCSet); + tabControl1.Location = new System.Drawing.Point(12, 12); + tabControl1.Name = "tabControl1"; + tabControl1.SelectedIndex = 0; + tabControl1.Size = new System.Drawing.Size(462, 336); + tabControl1.TabIndex = 5; + // + // ASet + // + ASet.Controls.Add(groupBox1); + ASet.Controls.Add(MaxVoicesLabel); + ASet.Controls.Add(EnableLoudMax); + ASet.Controls.Add(Label6); + ASet.Controls.Add(NoteOff1); + ASet.Controls.Add(FrequencyBox); + ASet.Controls.Add(FXDisable); + ASet.Controls.Add(AudioFreqLabel); + ASet.Controls.Add(SincInter); + ASet.Controls.Add(MaxVoices); + ASet.Location = new System.Drawing.Point(4, 24); + ASet.Name = "ASet"; + ASet.Padding = new System.Windows.Forms.Padding(3); + ASet.Size = new System.Drawing.Size(454, 308); + ASet.TabIndex = 0; + ASet.Text = "Audio Settings"; + ASet.UseVisualStyleBackColor = true; + // + // ESet + // + ESet.Controls.Add(MTLimitVal); + ESet.Controls.Add(MTMode); + ESet.Controls.Add(MTLimitLab); + ESet.Controls.Add(PerTrackExportEach); + ESet.Controls.Add(MTLimit); + ESet.Controls.Add(PerTrackStorage); + ESet.Controls.Add(PerTrackMode); + ESet.Controls.Add(AutoOutputFolder); + ESet.Controls.Add(AOFBrowse); + ESet.Controls.Add(AOFPath); + ESet.Location = new System.Drawing.Point(4, 24); + ESet.Name = "ESet"; + ESet.Padding = new System.Windows.Forms.Padding(3); + ESet.Size = new System.Drawing.Size(454, 308); + ESet.TabIndex = 1; + ESet.Text = "Export Settings"; + ESet.UseVisualStyleBackColor = true; // - // ReverbL - // - this.ReverbL.AutoSize = true; - this.ReverbL.BackColor = System.Drawing.SystemColors.Control; - this.ReverbL.Enabled = false; - this.ReverbL.Location = new System.Drawing.Point(4, 49); - this.ReverbL.Name = "ReverbL"; - this.ReverbL.Size = new System.Drawing.Size(83, 15); - this.ReverbL.TabIndex = 46; - this.ReverbL.Text = "Reverb (0-127)"; - // - // ReverbV - // - this.ReverbV.Enabled = false; - this.ReverbV.Location = new System.Drawing.Point(91, 46); - this.ReverbV.Maximum = new decimal(new int[] { - 127, - 0, - 0, - 0}); - this.ReverbV.Name = "ReverbV"; - this.ReverbV.Size = new System.Drawing.Size(39, 23); - this.ReverbV.TabIndex = 47; - // - // ChorusV - // - this.ChorusV.Enabled = false; - this.ChorusV.Location = new System.Drawing.Point(218, 46); - this.ChorusV.Maximum = new decimal(new int[] { - 127, - 0, - 0, - 0}); - this.ChorusV.Name = "ChorusV"; - this.ChorusV.Size = new System.Drawing.Size(39, 23); - this.ChorusV.TabIndex = 49; - // - // ChorusL + // AOFBrowse // - this.ChorusL.AutoSize = true; - this.ChorusL.Enabled = false; - this.ChorusL.Location = new System.Drawing.Point(131, 49); - this.ChorusL.Name = "ChorusL"; - this.ChorusL.Size = new System.Drawing.Size(85, 15); - this.ChorusL.TabIndex = 48; - this.ChorusL.Text = "Chorus (0-127)"; + AOFBrowse.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + AOFBrowse.Location = new System.Drawing.Point(373, 154); + AOFBrowse.Name = "AOFBrowse"; + AOFBrowse.Size = new System.Drawing.Size(75, 25); + AOFBrowse.TabIndex = 49; + AOFBrowse.Text = "Browse..."; + AOFBrowse.UseVisualStyleBackColor = true; + AOFBrowse.Click += AOFBrowse_Click; + // + // PCSet + // + PCSet.Controls.Add(DoActionAfterRenderVal); + PCSet.Controls.Add(DoActionAfterRender); + PCSet.Location = new System.Drawing.Point(4, 24); + PCSet.Name = "PCSet"; + PCSet.Size = new System.Drawing.Size(454, 308); + PCSet.TabIndex = 2; + PCSet.Text = "Post-Conversion Settings"; + PCSet.UseVisualStyleBackColor = true; // // Settings // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(458, 618); - this.ControlBox = false; - this.Controls.Add(this.PostConvSettings); - this.Controls.Add(this.OkBtn); - this.Controls.Add(this.EventsSettings); - this.Controls.Add(this.AudioSettings); - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Settings"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Settings"; - this.Load += new System.EventHandler(this.Settings_Load); - this.AudioSettings.ResumeLayout(false); - this.AudioSettings.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MaxVoices)).EndInit(); - this.EventsSettings.ResumeLayout(false); - this.EventsSettings.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MTLimitVal)).EndInit(); - this.PostConvSettings.ResumeLayout(false); - this.PostConvSettings.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ReverbV)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.ChorusV)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(487, 393); + ControlBox = false; + Controls.Add(tabControl1); + Controls.Add(OkBtn); + Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + MaximizeBox = false; + MinimizeBox = false; + Name = "Settings"; + ShowIcon = false; + ShowInTaskbar = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + Text = "Settings"; + Load += Settings_Load; + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)ChorusV).EndInit(); + ((System.ComponentModel.ISupportInitialize)ReverbV).EndInit(); + ((System.ComponentModel.ISupportInitialize)MaxVoices).EndInit(); + ((System.ComponentModel.ISupportInitialize)MTLimitVal).EndInit(); + tabControl1.ResumeLayout(false); + ASet.ResumeLayout(false); + ASet.PerformLayout(); + ESet.ResumeLayout(false); + ESet.PerformLayout(); + PCSet.ResumeLayout(false); + PCSet.PerformLayout(); + ResumeLayout(false); } #endregion - - private System.Windows.Forms.GroupBox AudioSettings; internal System.Windows.Forms.CheckBox SincInter; internal System.Windows.Forms.Label MaxVoicesLabel; public System.Windows.Forms.NumericUpDown MaxVoices; @@ -535,8 +486,6 @@ private void InitializeComponent() internal System.Windows.Forms.CheckBox EnableLoudMax; internal System.Windows.Forms.CheckBox NoteOff1; internal System.Windows.Forms.CheckBox FXDisable; - private System.Windows.Forms.GroupBox EventsSettings; - private System.Windows.Forms.Button AOFBrowse; private System.Windows.Forms.TextBox AOFPath; internal System.Windows.Forms.CheckBox AutoOutputFolder; internal System.Windows.Forms.CheckBox PerTrackStorage; @@ -547,7 +496,6 @@ private void InitializeComponent() public System.Windows.Forms.NumericUpDown MTLimitVal; private System.Windows.Forms.Label MTLimitLab; internal System.Windows.Forms.CheckBox MTLimit; - private System.Windows.Forms.GroupBox PostConvSettings; private System.Windows.Forms.ComboBox DoActionAfterRenderVal; private System.Windows.Forms.CheckBox DoActionAfterRender; private System.Windows.Forms.GroupBox groupBox1; @@ -556,5 +504,10 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown ChorusV; private System.Windows.Forms.Label ChorusL; private System.Windows.Forms.NumericUpDown ReverbV; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage ASet; + private System.Windows.Forms.TabPage ESet; + private System.Windows.Forms.Button AOFBrowse; + private System.Windows.Forms.TabPage PCSet; } } \ No newline at end of file diff --git a/OmniConverter/Forms/Settings.cs b/OmniConverter/Forms/Settings.cs index c377a38..c330708 100644 --- a/OmniConverter/Forms/Settings.cs +++ b/OmniConverter/Forms/Settings.cs @@ -35,8 +35,8 @@ private void Settings_Load(object sender, EventArgs e) MTLimitVal.Value = Properties.Settings.Default.MultiThreadedLimitV.LimitToRange(1, Environment.ProcessorCount); AutoOutputFolder.Checked = Properties.Settings.Default.AutoOutputFolder; - AOFPath.Text = - (Properties.Settings.Default.AOFPath.ToLowerInvariant() == "null" ? + AOFPath.Text = + (Properties.Settings.Default.AOFPath.ToLowerInvariant() == "null" ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : Properties.Settings.Default.AOFPath); DoActionAfterRender.Checked = Properties.Settings.Default.DoActionAfterRender; diff --git a/OmniConverter/Forms/Settings.resx b/OmniConverter/Forms/Settings.resx index 1af7de1..f298a7b 100644 --- a/OmniConverter/Forms/Settings.resx +++ b/OmniConverter/Forms/Settings.resx @@ -1,64 +1,4 @@ - - - + diff --git a/OmniConverter/Forms/SoundFontsList.cs b/OmniConverter/Forms/SoundFontsList.cs index 2c8d8a1..68a85e0 100644 --- a/OmniConverter/Forms/SoundFontsList.cs +++ b/OmniConverter/Forms/SoundFontsList.cs @@ -9,8 +9,8 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Midi; +using ManagedBass; +using ManagedBass.Midi; namespace OmniConverter { @@ -27,9 +27,11 @@ private void RebindList() { Debug.PrintToConsole("ok", "Rebinding Program.SFArray.List to SFList..."); + CommonSoundFonts.FreeSoundFonts(); SFList.DataSource = null; SFList.DataSource = Program.SFArray.List; SFList.DisplayMember = "GetSoundFontPath"; + CommonSoundFonts.LoadSoundFonts(); Debug.PrintToConsole("ok", "SFList bound successfully."); } @@ -99,8 +101,8 @@ private void AddSF_Click(object sender, EventArgs e) Debug.PrintToConsole("ok", String.Format("Current SoundFont = {0}", SF)); // Check if valid - int SFH = BassMidi.BASS_MIDI_FontInit(SF, BASSFlag.BASS_DEFAULT); - BASSError Err = Bass.BASS_ErrorGetCode(); + int SFH = BassMidi.FontInit(SF, FontInitFlags.Unicode); + Errors Err = Bass.LastError; if (Err == 0) { @@ -108,7 +110,7 @@ private void AddSF_Click(object sender, EventArgs e) Int32 NotSFZ = (Path.GetExtension(SF) != ".sfz") ? -1 : 0; int[] TV = new int[] { NotSFZ, NotSFZ, 0, NotSFZ, 0, 0 }; - BassMidi.BASS_MIDI_FontFree(SFH); + BassMidi.FontFree(SFH); // Split filename in case of automatic preset/bank assign values Match match = Regex.Match(Path.GetFileNameWithoutExtension(SF), @"\d{3}\.\d{3}\.\d{3}\.\d{3}\.\d{1}", RegexOptions.Compiled | RegexOptions.IgnoreCase); diff --git a/OmniConverter/OmniConverter.csproj b/OmniConverter/OmniConverter.csproj index aaf6567..ab5c197 100644 --- a/OmniConverter/OmniConverter.csproj +++ b/OmniConverter/OmniConverter.csproj @@ -27,10 +27,10 @@ Keppy's Software OmniConverter Copyright Ⓒ 2023 Keppy's Software - 0.0.3.0 - 0.0.3.0 + 0.0.6 + 0.0.6 True - 0.0.5 + 0.0.6 True @@ -39,9 +39,6 @@ False - - .\Bass.Net.dll - ..\libs\CSCore.dll @@ -65,11 +62,13 @@ UserControl - + UserControl - - UserControl + + True + True + Settings.settings @@ -98,6 +97,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + @@ -105,4 +107,10 @@ + + + SettingsSingleFileGenerator + Settings.Designer.cs + + \ No newline at end of file diff --git a/OmniConverter/Program.cs b/OmniConverter/Program.cs index 0968f82..fdbd9a1 100644 --- a/OmniConverter/Program.cs +++ b/OmniConverter/Program.cs @@ -11,8 +11,6 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Serialization; -using Un4seen.Bass; -using Un4seen.Bass.AddOn.Midi; namespace OmniConverter { @@ -54,9 +52,9 @@ static void Main(String[] Arguments) Debug.PrintToConsole("ok", "Restored settings from old version."); } - if (Properties.Settings.Default.MultiThreadedLimitV == -1) + if (!Properties.Settings.Default.MultiThreadedLimit || Properties.Settings.Default.MultiThreadedLimitV == -1) { - Properties.Settings.Default.MultiThreadedLimitV = Environment.ProcessorCount; + Properties.Settings.Default.MultiThreadedLimitV = Environment.ProcessorCount - 1; Properties.Settings.Default.Save(); Debug.PrintToConsole("ok", String.Format("MTL = {0}", Properties.Settings.Default.MultiThreadedLimit)); } @@ -77,7 +75,6 @@ static void Main(String[] Arguments) case "/debug": case "/mode": Debug.EnableConsole(); - Debug.PrintToConsole("ok", "Restored settings from old version."); break; case "/reset": if (MessageBox.Show("Are you sure you want to reset OmniConverter's settings?") == DialogResult.Yes) @@ -85,12 +82,17 @@ static void Main(String[] Arguments) Properties.Settings.Default.Reset(); Properties.Settings.Default.SUP = false; Properties.Settings.Default.Save(); + Debug.PrintToConsole("ok", "Restored settings from old version."); break; } else return; } } +#if DEBUG + Debug.EnableConsole(); +#endif + CommonSoundFonts.LoadCSF(); Application.Run(new MainWindow(Arguments)); diff --git a/OmniConverter/Properties/Settings.Designer.cs b/OmniConverter/Properties/Settings.Designer.cs index 60990f4..2ac311c 100644 --- a/OmniConverter/Properties/Settings.Designer.cs +++ b/OmniConverter/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace OmniConverter.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -370,5 +370,17 @@ public int ChorusValue { this["ChorusValue"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1")] + public float Volume { + get { + return ((float)(this["Volume"])); + } + set { + this["Volume"] = value; + } + } } } diff --git a/OmniConverter/Properties/Settings.settings b/OmniConverter/Properties/Settings.settings index 6fff024..97a13ac 100644 --- a/OmniConverter/Properties/Settings.settings +++ b/OmniConverter/Properties/Settings.settings @@ -92,5 +92,8 @@ 0 + + 1 + \ No newline at end of file diff --git a/OmniConverter/VistaMenu.dll b/OmniConverter/VistaMenu.dll deleted file mode 100644 index f4a4f1f..0000000 Binary files a/OmniConverter/VistaMenu.dll and /dev/null differ