Mask out high bit on Tempo changes

This commit is contained in:
Jack Andersen 2016-07-07 09:17:30 -10:00
parent 83a2bf0b4e
commit 3a7b43a63a
2 changed files with 3 additions and 3 deletions

View File

@ -675,7 +675,7 @@ std::vector<uint8_t> SongConverter::SongToMIDI(const unsigned char* data, int& v
encoder.getResult().push_back(0x51);
encoder.getResult().push_back(3);
uint32_t tempo24 = SBig(60000000 / change.m_tempo);
uint32_t tempo24 = SBig(60000000 / (change.m_tempo & 0x7fffffff));
for (int i=1 ; i<4 ; ++i)
encoder.getResult().push_back(reinterpret_cast<uint8_t*>(&tempo24)[i]);

View File

@ -354,7 +354,7 @@ bool SongState::initialize(const unsigned char* ptr)
else
m_tempoPtr = nullptr;
m_tempo = m_header.m_initialTempo;
m_tempo = m_header.m_initialTempo & 0x7fffffff;
m_curTick = 0;
m_songState = SongPlayState::Playing;
@ -604,7 +604,7 @@ bool SongState::advance(Sequencer& seq, double dt)
if (remTicks <= 0)
{
/* Turn over tempo */
m_tempo = change.m_tempo;
m_tempo = change.m_tempo & 0x7fffffff;
seq.setTempo(m_tempo * 384 / 60);
++m_tempoPtr;
continue;