Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 5be7110

Browse files
committed
Version 18.2.4
1 parent 66d627f commit 5be7110

File tree

5 files changed

+52
-42
lines changed

5 files changed

+52
-42
lines changed

KeppyMIDIConverter/Forms/MainWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static class KMCGlobals
5454
public static string[] MIDIs = null;
5555

5656
public static BASS_MIDI_EVENT[] events;
57+
public static BASS_MIDI_FONTEX[] SoundFonts;
5758
public static DSPPROC _myDSP;
5859
public static SYNCPROC _mySync;
5960
public static SYNCPROC _myVSTSync;

KeppyMIDIConverter/Functions/BASSControl.cs

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@ class BASSControl
2424
{
2525
public static void ReleaseResources(bool StillRendering, bool Closing)
2626
{
27-
foreach (Int32 Stream in MainWindow.VSTs._DummyVSTHandles) BassVst.BASS_VST_ChannelRemoveDSP(0, Stream);
27+
foreach (Int32 Stream in MainWindow.VSTs._DummyVSTHandles)
28+
BassVst.BASS_VST_ChannelRemoveDSP(0, Stream);
29+
30+
foreach (BASS_MIDI_FONTEX pr in MainWindow.KMCGlobals.SoundFonts)
31+
BassMidi.BASS_MIDI_FontFree(pr.font);
32+
2833
BassVst.BASS_VST_ChannelRemoveDSP(0, MainWindow.VSTs._DummyLoudMaxHan);
2934
MainWindow.KMCGlobals.DoNotCountNotes = false;
3035
BassWasapi.BASS_WASAPI_Stop(true);
3136
BassWasapi.BASS_WASAPI_Free();
3237
Bass.BASS_StreamFree(MainWindow.KMCGlobals._recHandle);
38+
BassVst.BASS_VST_ChannelFree(MainWindow.VSTs._VSTHandles[0]);
3339
MainWindow.KMCStatus.IsKMCBusy = StillRendering;
3440
MainWindow.KMCStatus.IsKMCNowExporting = false;
3541
MainWindow.KMCGlobals.eventc = 0;
3642
MainWindow.KMCGlobals.events = null;
3743

3844
if (Closing)
3945
{
46+
Bass.BASS_Free();
4047
MainWindow.KMCGlobals.ActiveVoicesInt = 0;
48+
MainWindow.KMCStatus.IsKMCBusy = false;
4149
MainWindow.KMCGlobals.NewWindowName = null;
4250
MainWindow.KMCStatus.RenderingMode = false;
4351
RTF.CPUUsage = 0.0f;
@@ -196,7 +204,7 @@ public static void InitializeDummyVSTs()
196204
MainWindow.VSTs._DummyVSTHandles[i] = BassVst.BASS_VST_ChannelSetDSP(0, MainWindow.VSTs.VSTDLLs[i], BASSVSTDsp.BASS_VST_DEFAULT, 0);
197205
int vstParams = BassVst.BASS_VST_GetParamCount(MainWindow.VSTs._DummyVSTHandles[i]);
198206

199-
if (MainWindow.VSTs.VSTInfo[i].hasEditor)
207+
if (BassVst.BASS_VST_GetInfo(MainWindow.VSTs._LoudMaxHan, MainWindow.VSTs.VSTInfo[i]) && MainWindow.VSTs.VSTInfo[i].hasEditor)
200208
BASSVSTShowDialog(false, 0, MainWindow.VSTs._DummyVSTHandles[i], MainWindow.VSTs.VSTInfo[i]);
201209
}
202210
}
@@ -239,12 +247,9 @@ public static void BASSInitVSTiIfNeeded(Boolean PreviewMode)
239247
{
240248
try
241249
{
242-
if (MainWindow.VSTs._VSTHandles[0] == 0 && MainWindow.VSTs.VSTInfo[0].isInstrument)
250+
if (MainWindow.VSTs.VSTInfo[0].isInstrument)
243251
{
244252
MainWindow.VSTs._VSTHandles[0] = BassVst.BASS_VST_ChannelCreate((MainWindow.KMCStatus.RenderingMode ? Properties.Settings.Default.AudioFreq : MainWindow.KMCGlobals.RealTimeFreq), 2, MainWindow.VSTs.VSTDLLs[0], BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | (PreviewMode ? 0 : BASSFlag.BASS_MIDI_SINCINTER));
245-
int vstParams = BassVst.BASS_VST_GetParamCount(MainWindow.VSTs._VSTHandles[0]);
246-
BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO();
247-
248253
if (Bass.BASS_ErrorGetCode() != BASSError.BASS_OK) throw new Exception(String.Format("{0} is not a valid VST instrument!", MainWindow.VSTs.VSTDLLs[0]));
249254

250255
MainWindow.KMCGlobals._plm = new Un4seen.Bass.Misc.DSP_PeakLevelMeter(MainWindow.VSTs._VSTHandles[0], 0);
@@ -319,18 +324,20 @@ public static bool MidiFilterProc(int handle, int track, BASS_MIDI_EVENT midieve
319324
}
320325

321326
// SF system
322-
static BASS_MIDI_FONTEX[] Presets;
323327
private static bool LoadSpecificSoundFont(string path, ref int sfnum)
324328
{
325329
if (File.Exists(path))
326330
{
327-
Presets[sfnum].font = BassMidi.BASS_MIDI_FontInit(path);
328-
Presets[sfnum].dpreset = -1;
329-
Presets[sfnum].dbank = 0;
330-
Presets[sfnum].spreset = -1;
331-
Presets[sfnum].sbank = -1;
332-
Presets[sfnum].dbanklsb = 0;
333-
if (!Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_FontLoad(Presets[sfnum].font, -1, -1);
331+
MainWindow.KMCGlobals.SoundFonts[sfnum].font = BassMidi.BASS_MIDI_FontInit(path, BASSFlag.BASS_MIDI_FONT_XGDRUMS);
332+
MainWindow.KMCGlobals.SoundFonts[sfnum].dpreset = -1;
333+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbank = 0;
334+
MainWindow.KMCGlobals.SoundFonts[sfnum].spreset = -1;
335+
MainWindow.KMCGlobals.SoundFonts[sfnum].sbank = -1;
336+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbanklsb = 0;
337+
338+
if (!Properties.Settings.Default.PreloadSamplesNotSF)
339+
BassMidi.BASS_MIDI_FontLoad(MainWindow.KMCGlobals.SoundFonts[sfnum].font, -1, -1);
340+
334341
sfnum++;
335342
return true;
336343
}
@@ -348,20 +355,20 @@ public static void BASSLoadSoundFonts(String str)
348355
DirectoryInfo PathToGenericSF = Directory.GetParent(Assembly.GetExecutingAssembly().Location);
349356
String FullPath = String.Format("{0}\\GMGeneric.sf2", PathToGenericSF.Parent.FullName);
350357

351-
Presets = new BASS_MIDI_FONTEX[1];
358+
MainWindow.KMCGlobals.SoundFonts = new BASS_MIDI_FONTEX[1];
352359
if (LoadSpecificSoundFont(FullPath, ref sfnum) != true) BASSCloseStreamCrash(new InvalidSoundFont("No SoundFonts available!"));
353-
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, Presets, sfnum);
360+
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, MainWindow.KMCGlobals.SoundFonts, sfnum);
354361
if (Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_StreamLoadSamples(MainWindow.KMCGlobals._recHandle);
355362
}
356363
else
357364
{
358365
if (Properties.Settings.Default.PreloadSFOfMIDI)
359366
{
360367
String SFToLoad = String.Format("{0}\\{1}.sf2", Path.GetDirectoryName(str), Path.GetFileNameWithoutExtension(str));
361-
Presets = new BASS_MIDI_FONTEX[1];
368+
MainWindow.KMCGlobals.SoundFonts = new BASS_MIDI_FONTEX[1];
362369
if (LoadSpecificSoundFont(SFToLoad, ref sfnum))
363370
{
364-
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, Presets, sfnum);
371+
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, MainWindow.KMCGlobals.SoundFonts, sfnum);
365372
if (Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_StreamLoadSamples(MainWindow.KMCGlobals._recHandle);
366373
}
367374
else BASSLoadSoundFonts2(ref sfnum);
@@ -372,9 +379,9 @@ public static void BASSLoadSoundFonts(String str)
372379
}
373380

374381
public static void BASSLoadSoundFonts2(ref int sfnum)
375-
{
382+
{
376383
// Prepare SoundFonts list
377-
Presets = new BASS_MIDI_FONTEX[MainWindow.SoundFontChain.SoundFonts.Length + 1];
384+
MainWindow.KMCGlobals.SoundFonts = new BASS_MIDI_FONTEX[MainWindow.SoundFontChain.SoundFonts.Length + 1];
378385
String[] SoundFontsReverse = MainWindow.SoundFontChain.SoundFonts.Reverse().ToArray();
379386

380387
try
@@ -385,26 +392,27 @@ public static void BASSLoadSoundFonts2(ref int sfnum)
385392
if (s.ToLower().IndexOf('=') != -1)
386393
{
387394
var matches = System.Text.RegularExpressions.Regex.Matches(s, "[0-9]+");
388-
Presets[sfnum].font = BassMidi.BASS_MIDI_FontInit(s.Substring(s.LastIndexOf('|') + 1));
389-
Presets[sfnum].dbank = Convert.ToInt32(matches[0].ToString());
390-
Presets[sfnum].dpreset = Convert.ToInt32(matches[1].ToString());
391-
Presets[sfnum].sbank = Convert.ToInt32(matches[2].ToString());
392-
Presets[sfnum].spreset = Convert.ToInt32(matches[3].ToString());
393-
Presets[sfnum].dbanklsb = 0;
394-
if (!Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_FontLoad(Presets[sfnum].font, Presets[sfnum].spreset, Presets[sfnum].sbank);
395-
sfnum++;
395+
MainWindow.KMCGlobals.SoundFonts[sfnum].font = BassMidi.BASS_MIDI_FontInit(s.Substring(s.LastIndexOf('|') + 1), BASSFlag.BASS_MIDI_FONT_XGDRUMS);
396+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbank = Convert.ToInt32(matches[0].ToString());
397+
MainWindow.KMCGlobals.SoundFonts[sfnum].dpreset = Convert.ToInt32(matches[1].ToString());
398+
MainWindow.KMCGlobals.SoundFonts[sfnum].sbank = Convert.ToInt32(matches[2].ToString());
399+
MainWindow.KMCGlobals.SoundFonts[sfnum].spreset = Convert.ToInt32(matches[3].ToString());
400+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbanklsb = 0;
396401
}
397402
else
398403
{
399-
Presets[sfnum].font = BassMidi.BASS_MIDI_FontInit(s);
400-
Presets[sfnum].dpreset = -1;
401-
Presets[sfnum].dbank = 0;
402-
Presets[sfnum].spreset = -1;
403-
Presets[sfnum].sbank = -1;
404-
Presets[sfnum].dbanklsb = 0;
405-
if (!Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_FontLoad(Presets[sfnum].font, Presets[sfnum].spreset, Presets[sfnum].sbank);
406-
sfnum++;
404+
MainWindow.KMCGlobals.SoundFonts[sfnum].font = BassMidi.BASS_MIDI_FontInit(s);
405+
MainWindow.KMCGlobals.SoundFonts[sfnum].dpreset = -1;
406+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbank = 0;
407+
MainWindow.KMCGlobals.SoundFonts[sfnum].spreset = -1;
408+
MainWindow.KMCGlobals.SoundFonts[sfnum].sbank = -1;
409+
MainWindow.KMCGlobals.SoundFonts[sfnum].dbanklsb = 0;
407410
}
411+
412+
if (!Properties.Settings.Default.PreloadSamplesNotSF)
413+
BassMidi.BASS_MIDI_FontLoad(MainWindow.KMCGlobals.SoundFonts[sfnum].font, MainWindow.KMCGlobals.SoundFonts[sfnum].spreset, MainWindow.KMCGlobals.SoundFonts[sfnum].sbank);
414+
415+
sfnum++;
408416
}
409417
}
410418
catch { BASSCloseStreamCrash(new InvalidSoundFont("Invalid SoundFont chain.")); }
@@ -419,8 +427,9 @@ public static void BASSLoadSoundFonts2(ref int sfnum)
419427
LoadSpecificSoundFont(FullPath, ref sfnum);
420428
}
421429

422-
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, Presets, sfnum);
423-
if (Properties.Settings.Default.PreloadSamplesNotSF) BassMidi.BASS_MIDI_StreamLoadSamples(MainWindow.KMCGlobals._recHandle);
430+
BassMidi.BASS_MIDI_StreamSetFonts(MainWindow.KMCGlobals._recHandle, MainWindow.KMCGlobals.SoundFonts, sfnum);
431+
if (Properties.Settings.Default.PreloadSamplesNotSF)
432+
BassMidi.BASS_MIDI_StreamLoadSamples(MainWindow.KMCGlobals._recHandle);
424433
}
425434
}
426435

KeppyMIDIConverter/Languages/Lang.en-US.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ Leave Src. Bank and Src. Preset to 0 for SFZ files.</value>
693693
<comment>Self-explanatory.</comment>
694694
</data>
695695
<data name="0Translators0" xml:space="preserve">
696-
<value>KaleidonKep99</value>
696+
<value>Riccardo Loi</value>
697697
<comment>You translated it! I think... If it says "KaleidonKep99", then you didn't.</comment>
698698
</data>
699699
<data name="AdvancedVoicesChannel" xml:space="preserve">

KeppyMIDIConverter/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
3333
// usando l'asterisco '*' come illustrato di seguito:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("18.2.3")]
36-
[assembly: AssemblyFileVersion("18.2.3")]
35+
[assembly: AssemblyVersion("18.2.4")]
36+
[assembly: AssemblyFileVersion("18.2.4")]

KeppyMIDIConverter/kmcupdate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.2.3
1+
18.2.4

0 commit comments

Comments
 (0)