Fixed MIDI looping
parent
00c13ec061
commit
b28705d5d9
|
@ -66,6 +66,11 @@ bool MIDIPlayer::Load(const midi_container & midi_file, unsigned subsong, unsign
|
||||||
uLoopMode |= loop_mode_force;
|
uLoopMode |= loop_mode_force;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( uTimeLoopStart == ~0UL )
|
||||||
|
uTimeLoopStart = 0;
|
||||||
|
if ( uTimeLoopEnd == ~0UL )
|
||||||
|
uTimeLoopEnd = uTimeEnd - 1000;
|
||||||
|
|
||||||
if ((uLoopMode & loop_mode_force))
|
if ((uLoopMode & loop_mode_force))
|
||||||
{
|
{
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
|
@ -84,8 +89,9 @@ bool MIDIPlayer::Load(const midi_container & midi_file, unsigned subsong, unsign
|
||||||
note_on [ ch * 128 + note ] = ( note_on [ ch * 128 + note ] & ~bit ) | ( bit * on );
|
note_on [ ch * 128 + note ] = ( note_on [ ch * 128 + note ] & ~bit ) | ( bit * on );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned long uSavedEndTime = ( i < mStream.size() ) ? mStream[ i ].m_timestamp : mStream[ mStream.size() - 1 ].m_timestamp + 1;
|
|
||||||
mStream.resize( i );
|
mStream.resize( i );
|
||||||
|
uTimeEnd = uTimeLoopEnd - 1;
|
||||||
|
if ( uTimeEnd < mStream[ i - 1 ].m_timestamp )
|
||||||
uTimeEnd = mStream[ i - 1 ].m_timestamp;
|
uTimeEnd = mStream[ i - 1 ].m_timestamp;
|
||||||
for ( unsigned long j = 0; j < 128 * 16; j++ )
|
for ( unsigned long j = 0; j < 128 * 16; j++ )
|
||||||
{
|
{
|
||||||
|
@ -100,7 +106,7 @@ bool MIDIPlayer::Load(const midi_container & midi_file, unsigned subsong, unsign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uTimeEnd = uSavedEndTime;
|
uTimeEnd = uTimeLoopEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue