Created
December 29, 2024 17:48
-
-
Save coderofsalvation/57d08a54e045f3e914ebe5145ed502ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/milkyplay/PlayerBase.h b/src/milkyplay/PlayerBase.h | |
index 5f48517..b14013b 100644 | |
--- a/src/milkyplay/PlayerBase.h | |
+++ b/src/milkyplay/PlayerBase.h | |
@@ -196,7 +196,9 @@ public: | |
virtual mp_sint32 adjustFrequency(mp_uint32 frequency); | |
virtual mp_sint32 setBufferSize(mp_uint32 bufferSize); | |
- | |
+ | |
+ mp_uint32 getAdder(){ return adder; } // needed for wav-writer | |
+ | |
void setPlayMode(PlayModes mode) { playMode = mode; } | |
PlayModes getPlayMode() const { return playMode; } | |
diff --git a/src/milkyplay/PlayerGeneric.cpp b/src/milkyplay/PlayerGeneric.cpp | |
index f745649..9e5dc8a 100644 | |
--- a/src/milkyplay/PlayerGeneric.cpp | |
+++ b/src/milkyplay/PlayerGeneric.cpp | |
@@ -37,6 +37,7 @@ | |
* | |
*/ | |
#include "PlayerGeneric.h" | |
+#include "ChannelMixer.h" | |
#include "MasterMixer.h" | |
#include "XModule.h" | |
#include "AudioDriver_WAVWriter.h" | |
@@ -1026,9 +1027,20 @@ mp_sint32 PlayerGeneric::exportToWAV(const SYSCHAR* fileName, XModule* module, | |
filter.calculateMasterVolume(); | |
masterVolume = filter.masterVolume; | |
- delete player; | |
- | |
mp_sint32 numWrittenSamples = wavWriter->getNumPlayedSamples(); | |
+ | |
+ // like FT2, milkytracker is one tick delayed in the way it handled the ticks | |
+ // so we trim the last tick from the render | |
+ if (player->getAdder() != 0) | |
+ { | |
+ const mp_sint32 lastSamplesPerTick = (mp_sint32)((0x100000000ULL * (mp_sint32)(ChannelMixer::MP_BEATLENGTH)) / player->getAdder()); | |
+ | |
+ if (numWrittenSamples >= lastSamplesPerTick) | |
+ numWrittenSamples -= lastSamplesPerTick; | |
+ } | |
+ | |
+ | |
+ delete player; | |
if (isWAVWriterDriver) | |
delete wavWriter; | |
diff --git a/src/milkyplay/PlayerSTD.cpp b/src/milkyplay/PlayerSTD.cpp | |
index 4099521..e54c386 100644 | |
--- a/src/milkyplay/PlayerSTD.cpp | |
+++ b/src/milkyplay/PlayerSTD.cpp | |
@@ -402,6 +402,7 @@ void PlayerSTD::reset() | |
for (mp_sint32 i = 0; i < initialNumChannels; i++) | |
chninfo[i].clear(); | |
+ BPMCounter = BPMCounter = 0xFFFFFFFF; // make the first replayer tick happen instantlyUINT32_MAX; | |
RESET_ALL_LOOPING | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment