Properly handle efx and rev/delay preset names. Tweak tests
This commit is contained in:
parent
06ea5cc6de
commit
a43240727f
3 changed files with 25 additions and 9 deletions
24
mustang.cpp
24
mustang.cpp
|
|
@ -121,16 +121,30 @@ Mustang::handleInput( void ) {
|
||||||
}
|
}
|
||||||
case 0x04:
|
case 0x04:
|
||||||
{
|
{
|
||||||
// Preset name
|
// PRESET NAME
|
||||||
|
// 0 = Amp preset, 1 = Mod preset, 2 = Delay/Reverb preset
|
||||||
|
int preset_category = read_buf[3];
|
||||||
|
|
||||||
|
// Rank within preset category
|
||||||
int idx = read_buf[4];
|
int idx = read_buf[4];
|
||||||
|
|
||||||
|
// Mod
|
||||||
|
if ( 1 == preset_category ) idx += 100;
|
||||||
|
// Rev/Delay
|
||||||
|
else if ( 2 == preset_category ) idx += 112;
|
||||||
|
|
||||||
|
// Preset name
|
||||||
pthread_mutex_lock( &preset_names_sync.lock );
|
pthread_mutex_lock( &preset_names_sync.lock );
|
||||||
|
|
||||||
strncpy( preset_names[idx], (const char *)read_buf+16, 32 );
|
strncpy( preset_names[idx], (const char *)read_buf+16, 32 );
|
||||||
preset_names[idx][32] = '\0';
|
preset_names[idx][32] = '\0';
|
||||||
// Always take the most recent one as the current preset. This
|
|
||||||
// will properly account for its appearance at the end of a complete
|
// Always take the most recent amp preset name as
|
||||||
// parm dump or when manual patch change occurs.
|
// current. This will properly account for its appearance at
|
||||||
curr_preset_idx = idx;
|
// the end of a complete parm dump or when manual patch
|
||||||
|
// change occurs. Not clear if or how current EFX preset
|
||||||
|
// is reported.
|
||||||
|
if ( 0 == preset_category ) curr_preset_idx = idx;
|
||||||
|
|
||||||
pthread_mutex_unlock( &preset_names_sync.lock );
|
pthread_mutex_unlock( &preset_names_sync.lock );
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,11 @@ class Mustang {
|
||||||
|
|
||||||
// Synchronize access to preset names
|
// Synchronize access to preset names
|
||||||
Condition<bool> preset_names_sync;
|
Condition<bool> preset_names_sync;
|
||||||
char preset_names[100][33];
|
|
||||||
|
|
||||||
// Index to current preset
|
// 0-99 = amp preset, 100-111 = mod preset, 112-123 = rev/delay preset
|
||||||
|
char preset_names[124][33];
|
||||||
|
|
||||||
|
// Index to current amp preset
|
||||||
unsigned curr_preset_idx;
|
unsigned curr_preset_idx;
|
||||||
|
|
||||||
// Manage access to each DSP data block and/or associated object.
|
// Manage access to each DSP data block and/or associated object.
|
||||||
|
|
|
||||||
4
test.py
4
test.py
|
|
@ -21,13 +21,13 @@ cc = mido.Message('control_change')
|
||||||
type = 0
|
type = 0
|
||||||
|
|
||||||
def analog_send( outport, sleeptime=0.25 ):
|
def analog_send( outport, sleeptime=0.25 ):
|
||||||
for value in [ 0, 32, 64, 96, 127, 96, 64, 32, 0 ]:
|
for value in [ 0, 32, 64, 96, 127, 0 ]:
|
||||||
cc.value = value
|
cc.value = value
|
||||||
outport.send( cc )
|
outport.send( cc )
|
||||||
sleep( sleeptime )
|
sleep( sleeptime )
|
||||||
|
|
||||||
def discrete_send( outport, max ):
|
def discrete_send( outport, max ):
|
||||||
for value in it.chain( range(0,max+1), range(max,-1,-1) ):
|
for value in it.chain( range(0,max+1), range(0,1) ):
|
||||||
cc.value = value
|
cc.value = value
|
||||||
outport.send( cc )
|
outport.send( cc )
|
||||||
sleep( 0.25 )
|
sleep( 0.25 )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue