Skip to content

Commit

Permalink
Version 18.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
KaleidonKep99 committed Oct 21, 2018
1 parent 0c967b9 commit 53231f7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 38 deletions.
9 changes: 8 additions & 1 deletion KeppyMIDIConverter/Forms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public partial class MainWindow : Form
public static MainWindow Delegate;
public static Random FPSSimulator = new Random();

public static class KMCConstants
{
public const int IDLE = 0;
public const int CANCELLED_BY_USER = 1;
public const int CONVERSION_ENDED = 2;
}

public static class KMCDialogs
{
public static AdvancedVoices AdvVoices = new AdvancedVoices();
Expand Down Expand Up @@ -374,7 +381,7 @@ private void PreviewFiles_Click(object sender, EventArgs e)

private void AbortConversion_Click(object sender, EventArgs e)
{
KMCGlobals.CancellationPendingValue = 1;
KMCGlobals.CancellationPendingValue = KMCConstants.CANCELLED_BY_USER;
KMCGlobals.AutoShutDownEnabled = false;
}

Expand Down
19 changes: 6 additions & 13 deletions KeppyMIDIConverter/Functions/BASSControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void BASSCloseStream(string message, string title, int type)
}

// Last stuff then BOOPERS
MainWindow.KMCGlobals.CancellationPendingValue = 0;
MainWindow.KMCGlobals.CancellationPendingValue = MainWindow.KMCConstants.IDLE;
MainWindow.KMCGlobals.CurrentStatusTextString = null;
BasicFunctions.PlayConversionStop();
}
Expand Down Expand Up @@ -314,7 +314,7 @@ public static int MyWasapiProc(IntPtr buffer, Int32 length, IntPtr user)
}
else Data1 = Bass.BASS_ChannelGetData(MainWindow.KMCGlobals._recHandle, buffer, length);

if (Data1 < 0) MainWindow.KMCGlobals.CancellationPendingValue = 2;
if (Data1 < 0) MainWindow.KMCGlobals.CancellationPendingValue = MainWindow.KMCConstants.CONVERSION_ENDED;
return (MainWindow.VSTs.VSTInfo[0].isInstrument) ? Data2 : Data1;
}
catch { return 0; }
Expand Down Expand Up @@ -751,16 +751,13 @@ public static bool BASSEncodingEngine(Int64 pos, Int64 length)
BassMidi.BASS_MIDI_StreamEvent(MainWindow.KMCGlobals._recHandle, i, BASSMIDIEvent.MIDI_EVENT_MIXLEVEL, MainWindow.KMCStatus.ChannelsVolume[i]);

if (MainWindow.VSTs.VSTInfo[0].isInstrument)
{
Bass.BASS_ChannelGetData(MainWindow.VSTs._VSTiHandle, buffer, (Int32)length);
BASSCheckError();
}

int got = Bass.BASS_ChannelGetData(MainWindow.KMCGlobals._recHandle, buffer, (Int32)length);
BASSCheckError();

if (got < 0)
{
MainWindow.KMCGlobals.CancellationPendingValue = 2;
MainWindow.KMCGlobals.CancellationPendingValue = MainWindow.KMCConstants.CONVERSION_ENDED;
return false;
}

Expand All @@ -783,16 +780,12 @@ public static bool BASSEncodingEngineRT(Double[] CustomFramerates, ref Int64 pos
}

if (MainWindow.VSTs.VSTInfo[0].isInstrument)
{
Bass.BASS_ChannelGetData(MainWindow.VSTs._VSTiHandle, buffer, (Int32)length);
BASSCheckError();
}
int got = Bass.BASS_ChannelGetData(MainWindow.KMCGlobals._recHandle, buffer, (Int32)length);
BASSCheckError();

if (got < 0)
{
MainWindow.KMCGlobals.CancellationPendingValue = 2;
MainWindow.KMCGlobals.CancellationPendingValue = MainWindow.KMCConstants.CONVERSION_ENDED;
return false;
}

Expand Down Expand Up @@ -854,7 +847,7 @@ public static bool BASSPlayBackEngineRT(Double[] CustomFramerates, ref Int64 pos

if (got < 0)
{
MainWindow.KMCGlobals.CancellationPendingValue = 2;
MainWindow.KMCGlobals.CancellationPendingValue = MainWindow.KMCConstants.CONVERSION_ENDED;
return false;
}

Expand Down
51 changes: 31 additions & 20 deletions KeppyMIDIConverter/Functions/ConverterFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,26 @@ public static void CPWork(object sender, DoWorkEventArgs e)
MainWindow.KMCStatus.IsKMCNowExporting = true;
while (BASSControl.BASSEncodingEngine(pos, length))
{
if (MainWindow.KMCGlobals.CancellationPendingValue == 1)
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
break;
}

BASSControl.ReleaseResources((MainWindow.KMCGlobals.CancellationPendingValue != 1), (MainWindow.KMCGlobals.CancellationPendingValue == 1));
if (MainWindow.KMCGlobals.CancellationPendingValue == 1) break;
BASSControl.ReleaseResources(
(MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER),
(MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
);
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) break;
}

MainWindow.KMCStatus.RenderingMode = false;
MainWindow.KMCStatus.IsKMCBusy = false;
MainWindow.KMCStatus.IsKMCNowExporting = false;
MainWindow.KMCGlobals.VSTSkipSettings = false;

String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == 1) ? "ConversionAborted" : "ConversionCompleted";
String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) ? "ConversionAborted" : "ConversionCompleted";
BASSControl.BASSCloseStream(Languages.Parse(Msg), Languages.Parse(Msg), 0);

if (MainWindow.KMCGlobals.CancellationPendingValue != 1)
if (MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER)
{
if (MainWindow.KMCGlobals.AutoShutDownEnabled == true)
Process.Start(new ProcessStartInfo("shutdown", "/s /t 0") { CreateNoWindow = true, UseShellExecute = false });
Expand All @@ -207,8 +210,7 @@ public static void CPWork(object sender, DoWorkEventArgs e)
}
catch (Exception exception)
{
BasicFunctions.WriteToConsole(exception);
BASSControl.ReleaseResources(false, true);
BASSControl.BASSCloseStreamException(exception);
}
}
catch (Exception exception2)
Expand Down Expand Up @@ -251,26 +253,29 @@ public static void CPRWork(object sender, DoWorkEventArgs e)
MainWindow.KMCStatus.IsKMCNowExporting = true;
for (pos = 0, es = 0; ;)
{
if (MainWindow.KMCGlobals.CancellationPendingValue != 1)
if (MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER)
{
if (!BASSControl.BASSEncodingEngineRT(CustomFramerates, ref pos, ref es)) break;
}
else break;
}

BASSControl.ReleaseResources((MainWindow.KMCGlobals.CancellationPendingValue != 1), (MainWindow.KMCGlobals.CancellationPendingValue == 1));
if (MainWindow.KMCGlobals.CancellationPendingValue == 1) break;
BASSControl.ReleaseResources(
(MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER),
(MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
);
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) break;
}

MainWindow.KMCStatus.RenderingMode = false;
MainWindow.KMCStatus.IsKMCBusy = false;
MainWindow.KMCStatus.IsKMCNowExporting = false;
MainWindow.KMCGlobals.VSTSkipSettings = false;

String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == 1) ? "ConversionAborted" : "ConversionCompleted";
String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) ? "ConversionAborted" : "ConversionCompleted";
BASSControl.BASSCloseStream(Languages.Parse(Msg), Languages.Parse(Msg), 0);

if (MainWindow.KMCGlobals.CancellationPendingValue == 1)
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
{
if (MainWindow.KMCGlobals.AutoShutDownEnabled == true)
Process.Start(new ProcessStartInfo("shutdown", "/s /t 0") { CreateNoWindow = true, UseShellExecute = false });
Expand Down Expand Up @@ -341,23 +346,26 @@ public static void PBWork(object sender, DoWorkEventArgs e)
BassWasapi.BASS_WASAPI_Start();
while (CheckStreamStatus() != BASSActive.BASS_ACTIVE_STOPPED)
{
if (MainWindow.KMCGlobals.CancellationPendingValue != 1)
if (MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER)
BASSControl.BASSPlayBackEngine(Length, Position);
else break;

TimerFuncs.MicroSleep(-1);
}

BASSControl.ReleaseResources((MainWindow.KMCGlobals.CancellationPendingValue != 1), (MainWindow.KMCGlobals.CancellationPendingValue == 1));
if (MainWindow.KMCGlobals.CancellationPendingValue == 1) break;
BASSControl.ReleaseResources(
(MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER),
(MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
);
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) break;
}

MainWindow.KMCStatus.RenderingMode = false;
MainWindow.KMCStatus.IsKMCBusy = false;
MainWindow.KMCStatus.IsKMCNowExporting = false;
MainWindow.KMCGlobals.VSTSkipSettings = false;

String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == 1) ? "PlaybackAborted" : "PlaybackCompleted";
String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) ? "PlaybackAborted" : "PlaybackCompleted";
BASSControl.BASSCloseStream(Languages.Parse(Msg), Languages.Parse(Msg), 0);

BasicFunctions.PlayConversionStop();
Expand Down Expand Up @@ -426,23 +434,26 @@ public static void PBRWork(object sender, DoWorkEventArgs e)
BassWasapi.BASS_WASAPI_Start();
while (CheckStreamStatus() != BASSActive.BASS_ACTIVE_STOPPED)
{
if (MainWindow.KMCGlobals.CancellationPendingValue != 1)
if (MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER)
BASSControl.BASSPlayBackEngineRT(CustomFramerates, ref pos, ref es);
else break;

TimerFuncs.MicroSleep(-1);
}

BASSControl.ReleaseResources((MainWindow.KMCGlobals.CancellationPendingValue != 1), (MainWindow.KMCGlobals.CancellationPendingValue == 1));
if (MainWindow.KMCGlobals.CancellationPendingValue == 1) break;
BASSControl.ReleaseResources(
(MainWindow.KMCGlobals.CancellationPendingValue != MainWindow.KMCConstants.CANCELLED_BY_USER),
(MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER)
);
if (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) break;
}

MainWindow.KMCStatus.RenderingMode = false;
MainWindow.KMCStatus.IsKMCBusy = false;
MainWindow.KMCStatus.IsKMCNowExporting = false;
MainWindow.KMCGlobals.VSTSkipSettings = false;

String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == 1) ? "PlaybackAborted" : "PlaybackCompleted";
String Msg = (MainWindow.KMCGlobals.CancellationPendingValue == MainWindow.KMCConstants.CANCELLED_BY_USER) ? "PlaybackAborted" : "PlaybackCompleted";
BASSControl.BASSCloseStream(Languages.Parse(Msg), Languages.Parse(Msg), 0);

BasicFunctions.PlayConversionStop();
Expand Down
4 changes: 2 additions & 2 deletions KeppyMIDIConverter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("18.2.5")]
[assembly: AssemblyFileVersion("18.2.5")]
[assembly: AssemblyVersion("18.2.6")]
[assembly: AssemblyFileVersion("18.2.6")]
2 changes: 1 addition & 1 deletion KeppyMIDIConverter/kmcsetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define vc

#define MyAppSetupName "Keppy's MIDI Converter"
#define MyAppVersion '18.2.3'
#define MyAppVersion '18.2.6'

[Setup]
AllowCancelDuringInstall=False
Expand Down
2 changes: 1 addition & 1 deletion KeppyMIDIConverter/kmcupdate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.2.5
18.2.6

0 comments on commit 53231f7

Please sign in to comment.