Exemple #1
0
/**
 * @brief Process outgoing MIDI messages.
 * This is called by the generic driver interface to pass messages to this driver implementation.
 * The driver may queue outgoing messages to reduce package overhead, trading of latency for throughput.
 * @public @memberof MIDIDriverAppleMIDI
 * @param driver The driver.
 * @param message The message that should be sent.
 * @retval 0 on success.
 * @retval >0 if the message could not be processed.
 */
int MIDIDriverAppleMIDISendMessage( struct MIDIDriverAppleMIDI * driver, struct MIDIMessage * message ) {
/**
 * @todo: when midi messages get timestamped by global clock, do something different:
 * - if we use the global clock (driver->clock == global_clock) do nothing
 * - otherwise: convert timestamp between clocks
 */
  MIDITimestamp timestamp;
  MIDIClockGetNow( driver->base.clock, &timestamp );
  MIDIMessageSetTimestamp( message, timestamp );
  MIDIMessageQueuePush( driver->out_queue, message );
  return MIDIDriverAppleMIDISend( driver );
}
Exemple #2
0
/**
 * @brief Process outgoing MIDI messages.
 * This is called by the generic driver interface to pass messages to this driver implementation.
 * The driver may queue outgoing messages to reduce package overhead, trading of latency for throughput.
 * @public @memberof MIDIDriverAppleMIDI
 * @param driver The driver.
 * @param message The message that should be sent.
 * @retval 0 on success.
 * @retval >0 if the message could not be processed.
 */
int MIDIDriverAppleMIDISendMessage( struct MIDIDriverAppleMIDI * driver, struct MIDIMessage * message ) {
/**
 * @todo: when midi messages get timestamped by global clock, do something different:
 * - if we use the global clock (driver->clock == global_clock) do nothing
 * - otherwise: convert timestamp between clocks
 */
  MIDITimestamp timestamp;
  MIDIClockGetNow( driver->base.clock, &timestamp );
  MIDIMessageSetTimestamp( message, timestamp );
  MIDIMessageQueuePush( driver->out_queue, message );
/**
 * @todo: instead of sending directly, set a minimal timeout, just long enough so that
 * multiple messages that are queued together will be sent together.
 */
  return MIDIDriverAppleMIDISend( driver );
}