implemented Tempo Change event

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2933 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
mahlzeit 2003-03-17 22:28:13 +00:00
parent 38c7401ebe
commit a06c9b684a
2 changed files with 27 additions and 2 deletions

View File

@ -243,7 +243,6 @@ void BMidiLocalConsumer::Data(
case B_CONTINUE:
case B_STOP:
case B_ACTIVE_SENSING:
case B_SYSTEM_RESET:
{
if (length == 1)
{
@ -251,6 +250,22 @@ void BMidiLocalConsumer::Data(
}
break;
}
case B_SYSTEM_RESET:
{
if (length == 1)
{
SystemRealTime(data[0], time);
}
else if ((length == 6) && (data[1] == 0x51)
&& (data[2] == 0x03))
{
int32 tempo =
(data[3] << 16) | (data[4] << 8) | data[5];
TempoChange(60000000/tempo, time);
}
}
}
break;
}

View File

@ -277,7 +277,17 @@ void BMidiLocalProducer::SpraySystemRealTime(
void BMidiLocalProducer::SprayTempoChange(
int32 beatsPerMinute, bigtime_t time) const
{
// This method does nothing, just like the BeOS R5 Midi Kit.
int32 tempo = 60000000 / beatsPerMinute;
uchar data[6];
data[0] = 0xFF;
data[1] = 0x51;
data[2] = 0x03;
data[3] = tempo >> 16;
data[4] = tempo >> 8;
data[5] = tempo;
SprayEvent(&data, 6, true, time);
}
//------------------------------------------------------------------------------