cwIoMidiRecordPlay.h/cpp : Added dev_count() and vel_table_???() to support vel. table tuner.

This commit is contained in:
kevin 2023-03-17 18:16:25 -04:00
parent 5b3299dea3
commit 1386e6db02
2 changed files with 52 additions and 0 deletions

View File

@ -1809,3 +1809,40 @@ void cw::midi_record_play::report( handle_t h )
midi_record_play_t* p = _handleToPtr(h);
_report_midi(p);
}
unsigned cw::midi_record_play::dev_count( handle_t h )
{
midi_record_play_t* p = _handleToPtr(h);
return p->midiDevN;
}
unsigned cw::midi_record_play::vel_table_count( handle_t h, unsigned devIdx )
{
midi_record_play_t* p = _handleToPtr(h);
return p->midiDevA[ devIdx ].velTableN;
}
const uint8_t* cw::midi_record_play::vel_table( handle_t h, unsigned devIdx )
{
midi_record_play_t* p = _handleToPtr(h);
return p->midiDevA[ devIdx ].velTableArray;
}
cw::rc_t cw::midi_record_play::vel_table_set( handle_t h, unsigned devIdx, const uint8_t* tbl, unsigned tblN )
{
midi_record_play_t* p = _handleToPtr(h);
midi_device_t* dev = p->midiDevA + devIdx;
if( tblN != dev->velTableN )
{
dev->velTableArray = mem::resize<uint8_t>(dev->velTableArray,tblN);
dev->velTableN = tblN;
}
for(unsigned i=0; i<tblN; ++i)
dev->velTableArray[i] = tbl[i];
return kOkRC;
}

View File

@ -27,6 +27,13 @@ namespace cw
typedef void (*event_callback_t)( void* arg, unsigned actionId, unsigned id, const time::spec_t timestamp, unsigned loc, uint8_t ch, uint8_t status, uint8_t d0, uint8_t d1 );
enum
{
kPiano_MRP_DevIdx = 1,
kSampler_MRP_DevIdx = 0
};
rc_t create( handle_t& hRef, io::handle_t ioH, const object_t& cfg, event_callback_t cb=nullptr, void* cb_arg=nullptr );
rc_t destroy( handle_t& hRef );
@ -77,7 +84,15 @@ namespace cw
rc_t am_to_midi_dir( const char* inDir );
rc_t am_to_midi_file( const object_t* cfg );
unsigned dev_count( handle_t h );
unsigned vel_table_count( handle_t h, unsigned devIdx );
const uint8_t* vel_table( handle_t h, unsigned devIdx );
rc_t vel_table_set( handle_t h, unsigned devIdx, const uint8_t* tbl, unsigned tblN );
void report( handle_t h );
}
}