void BMidiLocalProducer::SpraySystemCommon(uchar status, uchar data1, uchar data2, bigtime_t time) const { size_t len; uchar data[3]; data[0] = status; data[1] = data1; data[2] = data2; switch (status) { case B_TUNE_REQUEST: case B_SYS_EX_END: len = 1; break; case B_CABLE_MESSAGE: case B_MIDI_TIME_CODE: case B_SONG_SELECT: len = 2; break; case B_SONG_POSITION: len = 3; break; default: debugger("invalid system common status"); len = 0; } SprayEvent(&data, len, true, time); }
void BMidiLocalProducer::SpraySystemRealTime(uchar status, bigtime_t time) const { if (status >= B_TIMING_CLOCK) SprayEvent(&status, 1, true, time); else debugger("invalid real time status"); }
void BMidiLocalProducer::SprayChannelPressure(uchar channel, uchar pressure, bigtime_t time) const { if (channel < 16) { uchar data[2]; data[0] = B_CHANNEL_PRESSURE + channel; data[1] = pressure; SprayEvent(&data, 2, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayProgramChange(uchar channel, uchar programNumber, bigtime_t time) const { if (channel < 16) { uchar data[2]; data[0] = B_PROGRAM_CHANGE + channel; data[1] = programNumber; SprayEvent(&data, 2, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayNoteOn(uchar channel, uchar note, uchar velocity, bigtime_t time) const { if (channel < 16) { uchar data[3]; data[0] = B_NOTE_ON + channel; data[1] = note; data[2] = velocity; SprayEvent(&data, 3, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayPitchBend(uchar channel, uchar lsb, uchar msb, bigtime_t time) const { if (channel < 16) { uchar data[3]; data[0] = B_PITCH_BEND + channel; data[1] = lsb; data[2] = msb; SprayEvent(&data, 3, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayControlChange(uchar channel, uchar controlNumber, uchar controlValue, bigtime_t time) const { if (channel < 16) { uchar data[3]; data[0] = B_CONTROL_CHANGE + channel; data[1] = controlNumber; data[2] = controlValue; SprayEvent(&data, 3, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayKeyPressure(uchar channel, uchar note, uchar pressure, bigtime_t time) const { if (channel < 16) { uchar data[3]; data[0] = B_KEY_PRESSURE + channel; data[1] = note; data[2] = pressure; SprayEvent(&data, 3, true, time); } else { debugger("invalid MIDI channel"); } }
void BMidiLocalProducer::SprayTempoChange(int32 beatsPerMinute, bigtime_t time) const { 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); }
virtual void Run() { fPlaying = true; fPos = 0; MIDIEvent *ev = fEvs; uint32 startTime = B_NOW; while (KeepRunning()) { if (!ev) { if (fLoops && fEvs) { --fLoops; fPos = 0; ev = fEvs; } else break; } SprayEvent(ev, ev->time + startTime); ev = ev->next; fPos++; } fPos = fTotal; fPlaying = false; }
void BMidiLocalProducer::SprayData(void* data, size_t length, bool atomic, bigtime_t time) const { SprayEvent(data, length, atomic, time); }
void BMidiLocalProducer::SpraySystemExclusive(void* data, size_t length, bigtime_t time) const { SprayEvent(data, length, true, time, true); }