diff --git a/CMakeLists.txt b/CMakeLists.txt
index 162618ebe..b18114ea7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,8 @@ project(furnace)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_PROJECT_VERSION_MAJOR 0)
-set(CMAKE_PROJECT_VERSION_MINOR 4)
-set(CMAKE_PROJECT_VERSION_PATCH 6)
+set(CMAKE_PROJECT_VERSION_MINOR 5)
+set(CMAKE_PROJECT_VERSION_PATCH 0)
if (ANDROID)
set(BUILD_GUI OFF)
diff --git a/res/Info.plist b/res/Info.plist
index 621a4df23..f6db613d5 100644
--- a/res/Info.plist
+++ b/res/Info.plist
@@ -15,17 +15,17 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- 0.4.6
+ 0.5
CFBundleName
Furnace
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.4.6
+ 0.5
CFBundleSignature
????
CFBundleVersion
- 0.4.6
+ 0.5
NSHumanReadableCopyright
NSHighResolutionCapable
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp
index d8bbaf039..6c6714c7c 100644
--- a/src/engine/engine.cpp
+++ b/src/engine/engine.cpp
@@ -2287,25 +2287,40 @@ SafeWriter* DivEngine::saveVGM() {
if (memPos>=16777216) break;
sample->rendOffP=memPos;
unsigned int alignedSize=(sample->rendLength+0xff)&(~0xff);
+ unsigned int readPos=0;
if (alignedSize>65536) alignedSize=65536;
if (sample->depth==8) {
for (unsigned int j=0; j=sample->rendLength) {
- pcmMem[memPos++]=0x80;
+ if (readPos>=sample->rendLength) {
+ if (sample->loopStart>=0 && sample->loopStart<(int)sample->rendLength) {
+ readPos=sample->loopStart;
+ pcmMem[memPos++]=((unsigned char)sample->rendData[readPos]+0x80);
+ } else {
+ pcmMem[memPos++]=0x80;
+ }
} else {
- pcmMem[memPos++]=((unsigned char)sample->rendData[j]+0x80);
+ pcmMem[memPos++]=((unsigned char)sample->rendData[readPos]+0x80);
}
+ readPos++;
if (memPos>=16777216) break;
}
+ sample->loopOffP=readPos-sample->loopStart;
} else {
for (unsigned int j=0; j=sample->rendLength) {
- pcmMem[memPos++]=0x80;
+ if (readPos>=sample->rendLength) {
+ if (sample->loopStart>=0 && sample->loopStart<(int)sample->rendLength) {
+ readPos=sample->loopStart;
+ pcmMem[memPos++]=(((unsigned short)sample->rendData[readPos]+0x8000)>>8);
+ } else {
+ pcmMem[memPos++]=0x80;
+ }
} else {
- pcmMem[memPos++]=(((unsigned short)sample->rendData[j]+0x8000)>>8);
+ pcmMem[memPos++]=(((unsigned short)sample->rendData[readPos]+0x8000)>>8);
}
+ readPos++;
if (memPos>=16777216) break;
}
+ sample->loopOffP=readPos-sample->loopStart;
}
if (memPos>=16777216) break;
}
@@ -3896,6 +3911,7 @@ bool DivEngine::moveSampleDown(int which) {
}
void DivEngine::noteOn(int chan, int ins, int note, int vol) {
+ if (chan<0 || chan>=chans) return;
isBusy.lock();
pendingNotes.push(DivNoteEvent(chan,ins,note,vol,true));
if (!playing) {
@@ -3907,6 +3923,7 @@ void DivEngine::noteOn(int chan, int ins, int note, int vol) {
}
void DivEngine::noteOff(int chan) {
+ if (chan<0 || chan>=chans) return;
isBusy.lock();
pendingNotes.push(DivNoteEvent(chan,-1,-1,-1,false));
if (!playing) {
diff --git a/src/engine/engine.h b/src/engine/engine.h
index ccd72f775..220bbf442 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -11,8 +11,8 @@
#include