Renamed cwMidiPort.h/cpp to cwMidiDevice.h/cpp.
cwMidiDecls.h midi::msg_t now breaks out MIDI channel from status and has a new user 'uid' field to link the msg to an external entity. Renamed midi::packet_t. cbDataPtr to cbArg. midi::packet_t.cbFunc_t is now included in cwMidiDecls.h. Other files effected: cwIo.cpp,cwIoAudioMidi.cpp,cwIoPresetSelApp.cpp
This commit is contained in:
parent
5bfc19ba70
commit
742fc05e81
19
cwIo.cpp
19
cwIo.cpp
@ -9,7 +9,7 @@
|
||||
#include "cwIo.h"
|
||||
|
||||
#include "cwMidi.h"
|
||||
#include "cwMidiPort.h"
|
||||
#include "cwMidiDevice.h"
|
||||
|
||||
|
||||
#include "cwObject.h"
|
||||
@ -609,7 +609,7 @@ namespace cw
|
||||
msg_t m;
|
||||
midi_msg_t mm;
|
||||
const midi::packet_t* pkt = pktArray + i;
|
||||
io_t* p = reinterpret_cast<io_t*>(pkt->cbDataPtr);
|
||||
io_t* p = reinterpret_cast<io_t*>(pkt->cbArg);
|
||||
rc_t rc = kOkRC;
|
||||
|
||||
|
||||
@ -633,7 +633,6 @@ namespace cw
|
||||
rc_t _midiPortCreate( io_t* p, const object_t* c )
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
unsigned parserBufByteN = 1024;
|
||||
const object_t* cfg = nullptr;
|
||||
|
||||
// get the MIDI port cfg
|
||||
@ -643,14 +642,12 @@ namespace cw
|
||||
return kOkRC;
|
||||
}
|
||||
|
||||
if((rc = cfg->getv("parserBufByteN", parserBufByteN,
|
||||
"asyncFl", p->midiAsyncFl )) != kOkRC )
|
||||
if((rc = cfg->getv("asyncFl", p->midiAsyncFl )) != kOkRC )
|
||||
{
|
||||
rc = cwLogError(kSyntaxErrorRC,"MIDI configuration parse failed.");
|
||||
}
|
||||
|
||||
// initialie the MIDI system
|
||||
if((rc = create(p->midiH, _midiCallback, p, parserBufByteN, "app")) != kOkRC )
|
||||
if((rc = create(p->midiH, _midiCallback, p, cfg)) != kOkRC )
|
||||
return rc;
|
||||
|
||||
|
||||
@ -3807,7 +3804,7 @@ void cw::io::latency_measure_setup(handle_t h)
|
||||
p->latency_meas_result.audio_out_rms_max = 0;
|
||||
|
||||
if( p->midiH.isValid() )
|
||||
latency_measure_setup(p->midiH);
|
||||
latency_measure_reset(p->midiH);
|
||||
}
|
||||
|
||||
cw::io::latency_meas_result_t cw::io::latency_measure_result(handle_t h)
|
||||
@ -3816,10 +3813,10 @@ cw::io::latency_meas_result_t cw::io::latency_measure_result(handle_t h)
|
||||
|
||||
if( p->midiH.isValid() )
|
||||
{
|
||||
midi::device::latency_meas_result_t r = latency_measure_result(p->midiH);
|
||||
midi::device::latency_meas_combined_result_t r = latency_measure_result(p->midiH);
|
||||
|
||||
p->latency_meas_result.note_on_input_ts = r.note_on_input_ts;
|
||||
p->latency_meas_result.note_on_output_ts = r.note_on_output_ts;
|
||||
p->latency_meas_result.note_on_input_ts = r.alsa_dev.note_on_input_ts;
|
||||
p->latency_meas_result.note_on_output_ts = r.alsa_dev.note_on_output_ts;
|
||||
}
|
||||
|
||||
return p->latency_meas_result;
|
||||
|
@ -870,8 +870,8 @@ namespace cw
|
||||
am->devIdx = pkt->devIdx;
|
||||
am->portIdx = pkt->portIdx;
|
||||
am->timestamp = mm->timeStamp;
|
||||
am->ch = mm->status & 0x0f;
|
||||
am->status = mm->status & 0xf0;
|
||||
am->ch = mm->ch;
|
||||
am->status = mm->status;
|
||||
am->d0 = mm->d0;
|
||||
am->d1 = mm->d1;
|
||||
|
||||
|
@ -1355,7 +1355,7 @@ namespace cw
|
||||
{
|
||||
//printf("R:%i %i %i\n",mm->status, mm->d0, mm->d1);
|
||||
|
||||
const am_midi_msg_t* am = _midi_store( p, pkt->devIdx, pkt->portIdx, mm->timeStamp, mm->status & 0x0f, mm->status & 0xf0, mm->d0, mm->d1 );
|
||||
const am_midi_msg_t* am = _midi_store( p, pkt->devIdx, pkt->portIdx, mm->timeStamp, mm->ch, mm->status, mm->d0, mm->d1 );
|
||||
|
||||
if( p->thruFl && am != nullptr )
|
||||
_transmit_msg( p, am, false );
|
||||
|
@ -1142,8 +1142,8 @@ namespace cw
|
||||
|
||||
if( midi::isChStatus(mm->status) )
|
||||
{
|
||||
if(midi_record_play::send_midi_msg( app->mrpH, midi_record_play::kSampler_MRP_DevIdx, mm->status & 0x0f, mm->status & 0xf0, mm->d0, mm->d1 ) == kOkRC )
|
||||
_midi_play_callback( app, midi_record_play::kMidiEventActionId, id, timestamp, loc, nullptr, mm->status & 0x0f, mm->status & 0xf0, mm->d0, mm->d1 );
|
||||
if(midi_record_play::send_midi_msg( app->mrpH, midi_record_play::kSampler_MRP_DevIdx, mm->ch, mm->status, mm->d0, mm->d1 ) == kOkRC )
|
||||
_midi_play_callback( app, midi_record_play::kMidiEventActionId, id, timestamp, loc, nullptr, mm->ch, mm->status, mm->d0, mm->d1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,21 +8,25 @@ namespace cw
|
||||
typedef struct msg_str
|
||||
{
|
||||
time::spec_t timeStamp;
|
||||
uint8_t status; // midi status byte
|
||||
uint8_t d0; // midi data byte 0
|
||||
uint8_t d1; // midi data byte 1
|
||||
uint8_t pad;
|
||||
unsigned uid; // application specified id
|
||||
uint8_t ch; // midi channel
|
||||
uint8_t status; // midi status byte (channel has been removed)
|
||||
uint8_t d0; // midi data byte 0
|
||||
uint8_t d1; // midi data byte 1
|
||||
} msg_t;
|
||||
|
||||
typedef struct packet_str
|
||||
{
|
||||
void* cbDataPtr; // Application supplied reference value
|
||||
void* cbArg; // Application supplied reference value
|
||||
unsigned devIdx; // The device the msg originated from
|
||||
unsigned portIdx; // The port index on the source device
|
||||
msg_t* msgArray; // Pointer to an array of 'msgCnt' mdMsg records or NULL if sysExMsg is non-NULL
|
||||
uint8_t* sysExMsg; // Pointer to a sys-ex msg or NULL if msgArray is non-NULL (see note below)
|
||||
unsigned msgCnt; // Count of mdMsg records or sys-ex bytes
|
||||
} packet_t;
|
||||
|
||||
typedef void (*cbFunc_t)( const packet_t* pktArray, unsigned pktCnt );
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user