From d8e4109baf0f3e082c2deabeb7319d4095141cac Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 26 Oct 2022 08:47:54 -0400 Subject: [PATCH] cwIoMidiRecordPlay.h/cpp :Added send_midi_msg(). --- cwIoMidiRecordPlay.cpp | 15 +++++++++++++++ cwIoMidiRecordPlay.h | 1 + 2 files changed, 16 insertions(+) diff --git a/cwIoMidiRecordPlay.cpp b/cwIoMidiRecordPlay.cpp index 4816321..917ee23 100644 --- a/cwIoMidiRecordPlay.cpp +++ b/cwIoMidiRecordPlay.cpp @@ -382,6 +382,7 @@ namespace cw return rc; } + rc_t _transmit_msg( midi_record_play_t* p, const am_midi_msg_t* am, bool log_fl=true ) { return _event_callback( p, am->id, am->timestamp, am->loc, am->ch, am->status, am->d0, am->d1, log_fl ); @@ -1408,6 +1409,20 @@ void cw::midi_record_play::enable_device( handle_t h, unsigned devIdx, bool enab } } +cw::rc_t cw::midi_record_play::send_midi_msg( handle_t h, unsigned devIdx, uint8_t ch, uint8_t status, uint8_t d0, uint8_t d1 ) +{ + midi_record_play_t* p = _handleToPtr(h); + + if( devIdx >= p->midiDevN ) + return cwLogError(kInvalidArgRC,"The MIDI record-play device index '%i' is invalid.",devIdx ); + + if( p->midiDevA[devIdx].enableFl ) + io::midiDeviceSend( p->ioH, p->midiDevA[devIdx].midiOutDevIdx, p->midiDevA[devIdx].midiOutPortIdx, status + ch, d0, d1 ); + + return kOkRC; +} + + void cw::midi_record_play::half_pedal_params( handle_t h, unsigned noteDelayMs, unsigned pitch, unsigned vel, unsigned pedal_vel, unsigned noteDurMs, unsigned downDelayMs ) { midi_record_play_t* p = _handleToPtr(h); diff --git a/cwIoMidiRecordPlay.h b/cwIoMidiRecordPlay.h index d785384..a6f494d 100644 --- a/cwIoMidiRecordPlay.h +++ b/cwIoMidiRecordPlay.h @@ -63,6 +63,7 @@ namespace cw unsigned device_count( handle_t h ); bool is_device_enabled( handle_t h, unsigned devIdx ); void enable_device( handle_t h, unsigned devIdx, bool enableFl ); + rc_t send_midi_msg( handle_t h, unsigned devIdx, uint8_t ch, uint8_t status, uint8_t d0, uint8_t d1 ); void half_pedal_params( handle_t h, unsigned noteDelayMs, unsigned pitch, unsigned vel, unsigned pedal_vel, unsigned noteDurMs, unsigned downDelayMs );