@ -284,7 +284,7 @@ float PluginFx::getGain(void)
//extern config_t configuration;
//extern config_t configuration;
Dexed : : Dexed ( int rate )
Dexed : : Dexed ( uint8_t maxnotes , int rate )
{
{
uint8_t i ;
uint8_t i ;
@ -301,9 +301,10 @@ Dexed::Dexed(int rate)
engineMsfa = new FmCore ;
engineMsfa = new FmCore ;
loadInitVoice ( ) ;
max_notes = maxnotes ;
voices = new ProcessorVoice [ max_notes ] ;
for ( i = 0 ; i < MAX_ACTIVE_NOTES ; i + + )
for ( i = 0 ; i < max_notes ; i + + )
{
{
voices [ i ] . dx7_note = new Dx7Note ;
voices [ i ] . dx7_note = new Dx7Note ;
voices [ i ] . keydown = false ;
voices [ i ] . keydown = false ;
@ -312,7 +313,6 @@ Dexed::Dexed(int rate)
voices [ i ] . key_pressed_timer = 0 ;
voices [ i ] . key_pressed_timer = 0 ;
}
}
max_notes = MAX_NOTES ;
currentNote = 0 ;
currentNote = 0 ;
resetControllers ( ) ;
resetControllers ( ) ;
controllers . masterTune = 0 ;
controllers . masterTune = 0 ;
@ -326,15 +326,23 @@ Dexed::Dexed(int rate)
setMonoMode ( false ) ;
setMonoMode ( false ) ;
sustain = false ;
sustain = false ;
loadInitVoice ( ) ;
xrun = 0 ;
render_time_max = 0 ;
}
}
Dexed : : ~ Dexed ( )
Dexed : : ~ Dexed ( )
{
{
currentNote = - 1 ;
currentNote = - 1 ;
for ( uint8_t note = 0 ; note < MAX_ACTIVE_NOTES ; note + + )
for ( uint8_t note = 0 ; note < max_notes ; note + + )
delete voices [ note ] . dx7_note ;
delete voices [ note ] . dx7_note ;
for ( uint8_t note = 0 ; note < max_notes ; note + + )
delete & voices [ note ] ;
delete ( engineMsfa ) ;
delete ( engineMsfa ) ;
}
}
@ -538,6 +546,8 @@ void Dexed::keydown(int16_t pitch, uint8_t velo) {
void Dexed : : keyup ( int16_t pitch ) {
void Dexed : : keyup ( int16_t pitch ) {
uint8_t note ;
uint8_t note ;
pitch = constrain ( pitch , 0 , 127 ) ;
pitch + = data [ 144 ] - TRANSPOSE_FIX ;
pitch + = data [ 144 ] - TRANSPOSE_FIX ;
for ( note = 0 ; note < max_notes ; note + + ) {
for ( note = 0 ; note < max_notes ; note + + ) {
@ -621,7 +631,7 @@ bool Dexed::getSustain(void)
void Dexed : : panic ( void )
void Dexed : : panic ( void )
{
{
for ( uint8_t i = 0 ; i < MAX_ACTIVE_NOTES ; i + + )
for ( uint8_t i = 0 ; i < max_notes ; i + + )
{
{
if ( voices [ i ] . live = = true ) {
if ( voices [ i ] . live = = true ) {
voices [ i ] . keydown = false ;
voices [ i ] . keydown = false ;
@ -653,7 +663,7 @@ void Dexed::resetControllers(void)
}
}
void Dexed : : notesOff ( void ) {
void Dexed : : notesOff ( void ) {
for ( uint8_t i = 0 ; i < MAX_ACTIVE_NOTES ; i + + ) {
for ( uint8_t i = 0 ; i < max_notes ; i + + ) {
if ( voices [ i ] . live = = true ) {
if ( voices [ i ] . live = = true ) {
voices [ i ] . keydown = false ;
voices [ i ] . keydown = false ;
voices [ i ] . live = false ;
voices [ i ] . live = false ;
@ -662,7 +672,7 @@ void Dexed::notesOff(void) {
}
}
void Dexed : : setMaxNotes ( uint8_t n ) {
void Dexed : : setMaxNotes ( uint8_t n ) {
if ( n < = MAX_ACTIVE_NOTES )
if ( n < = max_notes )
{
{
notesOff ( ) ;
notesOff ( ) ;
max_notes = n ;
max_notes = n ;
@ -857,26 +867,36 @@ bool Dexed::getVoiceData(uint8_t* data_copy)
return ( true ) ;
return ( true ) ;
}
}
bool Dexed : : loadVoiceParameters ( uint8_t * new_data )
void Dexed : : setVoiceDataElement ( uint8_t address , uint8_t value )
{
address = constrain ( address , 0 , NUM_VOICE_PARAMETERS ) ;
data [ address ] = value ;
}
uint8_t Dexed : : getVoiceDataElement ( uint8_t address )
{
address = constrain ( address , 0 , NUM_VOICE_PARAMETERS ) ;
return ( data [ address ] ) ;
}
void Dexed : : loadVoiceParameters ( uint8_t * new_data )
{
{
# ifdef DEBUG
char dexed_voice_name [ 11 ] ;
char dexed_voice_name [ 11 ] ;
# endif
panic ( ) ;
panic ( ) ;
memcpy ( & data , new_data , 155 ) ;
memcpy ( & data , new_data , 155 ) ;
doRefreshVoice ( ) ;
doRefreshVoice ( ) ;
//activate();
strncpy ( dexed_voice_name , ( char * ) & new_data [ 145 ] , sizeof ( dexed_voice_name ) - 1 ) ;
strncpy ( dexed_voice_name , ( char * ) & new_data [ 145 ] , sizeof ( dexed_voice_name ) - 1 ) ;
dexed_voice_name [ 10 ] = ' \0 ' ;
# ifdef DEBUG
# ifdef DEBUG
dexed_voice_name [ 10 ] = ' \0 ' ;
Serial . print ( F ( " Voice [ " ) ) ;
Serial . print ( F ( " Voice [ " ) ) ;
Serial . print ( dexed_voice_name ) ;
Serial . print ( dexed_voice_name ) ;
Serial . println ( F ( " ] loaded. " ) ) ;
Serial . println ( F ( " ] loaded. " ) ) ;
# endif
# endif
return ( true ) ;
}
}
void Dexed : : loadInitVoice ( void )
void Dexed : : loadInitVoice ( void )
@ -890,8 +910,8 @@ void Dexed::setPBController(uint8_t pb_range, uint8_t pb_step)
Serial . println ( F ( " Dexed::setPBController " ) ) ;
Serial . println ( F ( " Dexed::setPBController " ) ) ;
# endif
# endif
pb_range = constrain ( pb_range , PB_RANGE_MIN , PB_RANGE_MAX ) ;
pb_range = constrain ( pb_range , 0 , 12 ) ;
pb_step = constrain ( pb_step , PB_STEP_MIN , PB_STEP_MAX ) ;
pb_step = constrain ( pb_step , 0 , 12 ) ;
controllers . values_ [ kControllerPitchRange ] = pb_range ;
controllers . values_ [ kControllerPitchRange ] = pb_range ;
controllers . values_ [ kControllerPitchStep ] = pb_step ;
controllers . values_ [ kControllerPitchStep ] = pb_step ;
@ -905,9 +925,9 @@ void Dexed::setMWController(uint8_t mw_range, uint8_t mw_assign, uint8_t mw_mode
Serial . println ( F ( " Dexed::setMWController " ) ) ;
Serial . println ( F ( " Dexed::setMWController " ) ) ;
# endif
# endif
mw_range = constrain ( mw_range , MW_RANGE_MIN , MW_RANGE_MAX ) ;
mw_range = constrain ( mw_range , 0 , 99 ) ;
mw_assign = constrain ( mw_assign , MW_ASSIGN_MIN , MW_ASSIGN_MAX ) ;
mw_assign = constrain ( mw_assign , 0 , 7 ) ;
mw_mode = constrain ( mw_mode , MW_MODE_MIN , MW _MODE_MAX) ;
mw_mode = constrain ( mw_mode , 0 , MIDI_CONTROLLER _MODE_MAX) ;
controllers . wheel . setRange ( mw_range ) ;
controllers . wheel . setRange ( mw_range ) ;
controllers . wheel . setTarget ( mw_assign ) ;
controllers . wheel . setTarget ( mw_assign ) ;
@ -922,9 +942,9 @@ void Dexed::setFCController(uint8_t fc_range, uint8_t fc_assign, uint8_t fc_mode
Serial . println ( F ( " Dexed::setFCController " ) ) ;
Serial . println ( F ( " Dexed::setFCController " ) ) ;
# endif
# endif
fc_range = constrain ( fc_range , FC_RANGE_MIN , FC_RANGE_MAX ) ;
fc_range = constrain ( fc_range , 0 , 99 ) ;
fc_assign = constrain ( fc_assign , FC_ASSIGN_MIN , FC_ASSIGN_MAX ) ;
fc_assign = constrain ( fc_assign , 0 , 7 ) ;
fc_mode = constrain ( fc_mode , FC_MODE_MIN , FC _MODE_MAX) ;
fc_mode = constrain ( fc_mode , 0 , MIDI_CONTROLLER _MODE_MAX) ;
controllers . foot . setRange ( fc_range ) ;
controllers . foot . setRange ( fc_range ) ;
controllers . foot . setTarget ( fc_assign ) ;
controllers . foot . setTarget ( fc_assign ) ;
@ -939,9 +959,9 @@ void Dexed::setBCController(uint8_t bc_range, uint8_t bc_assign, uint8_t bc_mode
Serial . println ( F ( " Dexed::setBCController " ) ) ;
Serial . println ( F ( " Dexed::setBCController " ) ) ;
# endif
# endif
bc_range = constrain ( bc_range , BC_RANGE_MIN , BC_RANGE_MAX ) ;
bc_range = constrain ( bc_range , 0 , 99 ) ;
bc_assign = constrain ( bc_assign , BC_ASSIGN_MIN , BC_ASSIGN_MAX ) ;
bc_assign = constrain ( bc_assign , 0 , 7 ) ;
bc_mode = constrain ( bc_mode , BC_MODE_MIN , BC _MODE_MAX) ;
bc_mode = constrain ( bc_mode , 0 , MIDI_CONTROLLER _MODE_MAX) ;
controllers . breath . setRange ( bc_range ) ;
controllers . breath . setRange ( bc_range ) ;
controllers . breath . setTarget ( bc_assign ) ;
controllers . breath . setTarget ( bc_assign ) ;
@ -956,9 +976,9 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign, uint8_t at_mode
Serial . println ( F ( " Dexed::setATController " ) ) ;
Serial . println ( F ( " Dexed::setATController " ) ) ;
# endif
# endif
at_range = constrain ( at_range , AT_RANGE_MIN , AT_RANGE_MAX ) ;
at_range = constrain ( at_range , 0 , 99 ) ;
at_assign = constrain ( at_assign , AT_ASSIGN_MIN , AT_ASSIGN_MAX ) ;
at_assign = constrain ( at_assign , 0 , 7 ) ;
at_mode = constrain ( at_mode , AT_MODE_MIN , AT _MODE_MAX) ;
at_mode = constrain ( at_mode , 0 , MIDI_CONTROLLER _MODE_MAX) ;
controllers . at . setRange ( at_range ) ;
controllers . at . setRange ( at_range ) ;
controllers . at . setTarget ( at_assign ) ;
controllers . at . setTarget ( at_assign ) ;
@ -969,6 +989,10 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign, uint8_t at_mode
void Dexed : : setPortamentoMode ( uint8_t portamento_mode , uint8_t portamento_glissando , uint8_t portamento_time )
void Dexed : : setPortamentoMode ( uint8_t portamento_mode , uint8_t portamento_glissando , uint8_t portamento_time )
{
{
portamento_mode = constrain ( portamento_mode , 0 , 1 ) ;
portamento_glissando = constrain ( portamento_glissando , 0 , 1 ) ;
portamento_mode = constrain ( portamento_mode , 0 , 99 ) ;
controllers . portamento_cc = portamento_time ;
controllers . portamento_cc = portamento_time ;
controllers . portamento_enable_cc = portamento_mode > 63 ;
controllers . portamento_enable_cc = portamento_mode > 63 ;
@ -982,42 +1006,249 @@ void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissa
controllers . refresh ( ) ;
controllers . refresh ( ) ;
}
}
void AudioSynthDexed : : update ( void )
uint32_t Dexed : : getXRun ( void )
{
{
if ( in_update = = true )
return ( xrun ) ;
{
}
xrun + + ;
return ;
}
else
in_update = true ;
elapsedMicros render_time ;
uint16_t Dexed : : getRenderTimeMax ( void )
audio_block_t * lblock ;
{
return ( render_time_max ) ;
}
lblock = allocate ( ) ;
void Dexed : : resetRenderTimeMax ( void )
{
render_time_max = 0 ;
}
if ( ! lblock )
void Dexed : : ControllersRefresh ( void )
{
{
in_update = false ;
controllers . refresh ( ) ;
return ;
}
}
void Dexed : : setMasterTune ( int8_t mastertune )
{
mastertune = constrain ( mastertune , - 99 , 99 ) ;
controllers . masterTune = ( int ( mastertune / 100.0 * 0x4000 ) < < 11 ) * ( 1.0 / 12.0 ) ;
}
getSamples ( AUDIO_BLOCK_SAMPLES , lblock - > data ) ;
int8_t Dexed : : getMasterTune ( void )
{
return ( controllers . masterTune ) ;
}
void Dexed : : setModWheel ( uint8_t value )
{
value = constrain ( value , 0 , 127 ) ;
controllers . modwheel_cc = value ;
}
uint8_t Dexed : : getModWheel ( void )
{
return ( controllers . modwheel_cc ) ;
}
void Dexed : : setBreathController ( uint8_t value )
{
value = constrain ( value , 0 , 127 ) ;
controllers . breath_cc = value ;
}
uint8_t Dexed : : getBreathController ( void )
{
return ( controllers . breath_cc ) ;
}
void Dexed : : setFootController ( uint8_t value )
{
value = constrain ( value , 0 , 127 ) ;
if ( render_time > audio_block_time_us ) // everything greater audio_block_time_us (2.9ms for buffer size of 128) is a buffer underrun!
controllers . foot_cc = value ;
xrun + + ;
}
uint8_t Dexed : : getFootController ( void )
{
return ( controllers . foot_cc ) ;
}
if ( render_time > render_time_max )
void Dexed : : setAftertouch ( uint8_t value )
render_time_max = render_time ;
{
value = constrain ( value , 0 , 127 ) ;
transmit ( lblock , 0 ) ;
controllers . aftertouch_cc = value ;
release ( lblock ) ;
}
in_update = false ;
uint8_t Dexed : : getAftertouch ( void )
} ;
{
return ( controllers . aftertouch_cc ) ;
}
void Dexed : : setPitchbend ( int16_t value )
{
value = constrain ( value , - 8192 , 8191 ) ;
controllers . values_ [ kControllerPitch ] = value + 0x2000 ; // -8192 to +8191 --> 0 to 16383
}
int16_t Dexed : : getPitchbend ( void )
{
return ( controllers . values_ [ kControllerPitch ] - 0x2000 ) ;
}
void Dexed : : setPitchbendRange ( uint8_t range )
{
range = constrain ( range , 0 , 12 ) ;
controllers . values_ [ kControllerPitchRange ] = range ;
}
uint8_t Dexed : : getPitchbendRange ( void )
{
return ( controllers . values_ [ kControllerPitchRange ] ) ;
}
void Dexed : : setPitchbendStep ( uint8_t step )
{
step = constrain ( step , 0 , 12 ) ;
controllers . values_ [ kControllerPitchStep ] = step ;
}
uint8_t Dexed : : getPitchbendStep ( void )
{
return ( controllers . values_ [ kControllerPitchStep ] ) ;
}
void AudioSynthDexed : : setOPRateAll ( uint8_t rate )
void Dexed : : setModWheelRange ( uint8_t range )
{
range = constrain ( range , 0 , 12 ) ;
controllers . wheel . setRange ( range ) ;
}
uint8_t Dexed : : getModWheelRange ( void )
{
return ( controllers . wheel . getRange ( ) ) ;
}
void Dexed : : setModWheelTarget ( uint8_t target )
{
target = constrain ( target , 0 , 7 ) ;
controllers . wheel . setTarget ( target ) ;
}
uint8_t Dexed : : getModWheelTarget ( void )
{
return ( controllers . wheel . getTarget ( ) ) ;
}
void Dexed : : setFootControllerRange ( uint8_t range )
{
range = constrain ( range , 0 , 12 ) ;
controllers . foot . setRange ( range ) ;
}
uint8_t Dexed : : getFootControllerRange ( void )
{
return ( controllers . foot . getRange ( ) ) ;
}
void Dexed : : setFootControllerTarget ( uint8_t target )
{
target = constrain ( target , 0 , 7 ) ;
controllers . foot . setTarget ( target ) ;
}
uint8_t Dexed : : getFootControllerTarget ( void )
{
return ( controllers . foot . getTarget ( ) ) ;
}
void Dexed : : setBreathControllerRange ( uint8_t range )
{
range = constrain ( range , 0 , 12 ) ;
controllers . breath . setRange ( range ) ;
}
uint8_t Dexed : : getBreathControllerRange ( void )
{
return ( controllers . breath . getRange ( ) ) ;
}
void Dexed : : setBreathControllerTarget ( uint8_t target )
{
target = constrain ( target , 0 , 7 ) ;
controllers . breath . setTarget ( target ) ;
}
uint8_t Dexed : : getBreathControllerTarget ( void )
{
return ( controllers . breath . getTarget ( ) ) ;
}
void Dexed : : setAftertouchRange ( uint8_t range )
{
range = constrain ( range , 0 , 12 ) ;
controllers . at . setRange ( range ) ;
}
uint8_t Dexed : : getAftertouchRange ( void )
{
return ( controllers . at . getRange ( ) ) ;
}
void Dexed : : setAftertouchTarget ( uint8_t target )
{
target = constrain ( target , 0 , 7 ) ;
controllers . at . setTarget ( target ) ;
}
uint8_t Dexed : : getAftertouchTarget ( void )
{
return ( controllers . at . getTarget ( ) ) ;
}
void Dexed : : setFilterCutoff ( float cutoff )
{
fx . Cutoff = cutoff ;
}
float Dexed : : getFilterCutoff ( void )
{
return ( fx . Cutoff ) ;
}
void Dexed : : setFilterResonance ( float resonance )
{
fx . Reso = resonance ;
}
float Dexed : : getFilterResonance ( void )
{
return ( fx . Reso ) ;
}
void Dexed : : setGain ( float gain )
{
fx . Gain = gain ;
}
float Dexed : : getGain ( void )
{
return ( fx . Gain ) ;
}
void Dexed : : setOPRateAll ( uint8_t rate )
{
{
rate = constrain ( rate , 0 , 99 ) ;
rate = constrain ( rate , 0 , 99 ) ;
@ -1030,7 +1261,7 @@ void AudioSynthDexed::setOPRateAll(uint8_t rate)
}
}
}
}
void AudioSynth Dexed: : setOPLevelAll ( uint8_t level )
void Dexed : : setOPLevelAll ( uint8_t level )
{
{
level = constrain ( level , 0 , 99 ) ;
level = constrain ( level , 0 , 99 ) ;
@ -1043,7 +1274,7 @@ void AudioSynthDexed::setOPLevelAll(uint8_t level)
}
}
}
}
void AudioSynth Dexed: : setOPRateAllModulator ( uint8_t step , uint8_t rate )
void Dexed : : setOPRateAllModulator ( uint8_t step , uint8_t rate )
{
{
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
@ -1057,7 +1288,7 @@ void AudioSynthDexed::setOPRateAllModulator(uint8_t step, uint8_t rate)
}
}
}
}
void AudioSynth Dexed: : setOPLevelAllModulator ( uint8_t step , uint8_t level )
void Dexed : : setOPLevelAllModulator ( uint8_t step , uint8_t level )
{
{
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
@ -1071,7 +1302,7 @@ void AudioSynthDexed::setOPLevelAllModulator(uint8_t step, uint8_t level)
}
}
}
}
void AudioSynth Dexed: : setOPRateAllCarrier ( uint8_t step , uint8_t rate )
void Dexed : : setOPRateAllCarrier ( uint8_t step , uint8_t rate )
{
{
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
@ -1085,7 +1316,7 @@ void AudioSynthDexed::setOPRateAllCarrier(uint8_t step, uint8_t rate)
}
}
}
}
void AudioSynth Dexed: : setOPLevelAllCarrier ( uint8_t step , uint8_t level )
void Dexed : : setOPLevelAllCarrier ( uint8_t step , uint8_t level )
{
{
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
uint8_t op_carrier = controllers . core - > get_carrier_operators ( data [ 134 ] ) ; // look for carriers
@ -1099,7 +1330,7 @@ void AudioSynthDexed::setOPLevelAllCarrier(uint8_t step, uint8_t level)
}
}
}
}
void AudioSynth Dexed: : setOPRate ( uint8_t op , uint8_t step , uint8_t rate )
void Dexed : : setOPRate ( uint8_t op , uint8_t step , uint8_t rate )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
@ -1108,7 +1339,7 @@ void AudioSynthDexed::setOPRate(uint8_t op, uint8_t step, uint8_t rate)
data [ ( op * 21 ) + DEXED_OP_EG_R1 + step ] = rate ;
data [ ( op * 21 ) + DEXED_OP_EG_R1 + step ] = rate ;
}
}
uint8_t AudioSynth Dexed: : getOPRate ( uint8_t op , uint8_t step )
uint8_t Dexed : : getOPRate ( uint8_t op , uint8_t step )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
@ -1116,7 +1347,7 @@ uint8_t AudioSynthDexed::getOPRate(uint8_t op, uint8_t step)
return ( data [ ( op * 21 ) + DEXED_OP_EG_R1 + step ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_EG_R1 + step ] ) ;
}
}
void AudioSynth Dexed: : setOPLevel ( uint8_t op , uint8_t step , uint8_t level )
void Dexed : : setOPLevel ( uint8_t op , uint8_t step , uint8_t level )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
@ -1125,7 +1356,7 @@ void AudioSynthDexed::setOPLevel(uint8_t op, uint8_t step, uint8_t level)
data [ ( op * 21 ) + DEXED_OP_EG_L1 + step ] = level ;
data [ ( op * 21 ) + DEXED_OP_EG_L1 + step ] = level ;
}
}
uint8_t AudioSynth Dexed: : getOPLevel ( uint8_t op , uint8_t step )
uint8_t Dexed : : getOPLevel ( uint8_t op , uint8_t step )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
@ -1133,7 +1364,7 @@ uint8_t AudioSynthDexed::getOPLevel(uint8_t op, uint8_t step)
return ( data [ ( op * 21 ) + DEXED_OP_EG_L1 + step ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_EG_L1 + step ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardLevelScalingBreakPoint ( uint8_t op , uint8_t level )
void Dexed : : setOPKeyboardLevelScalingBreakPoint ( uint8_t op , uint8_t level )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
level = constrain ( level , 0 , 99 ) ;
level = constrain ( level , 0 , 99 ) ;
@ -1141,14 +1372,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingBreakPoint(uint8_t op, uint8_t le
data [ ( op * 21 ) + DEXED_OP_LEV_SCL_BRK_PT ] = level ;
data [ ( op * 21 ) + DEXED_OP_LEV_SCL_BRK_PT ] = level ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardLevelScalingBreakPoint ( uint8_t op )
uint8_t Dexed : : getOPKeyboardLevelScalingBreakPoint ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_LEV_SCL_BRK_PT ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_LEV_SCL_BRK_PT ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardLevelScalingDepthLeft ( uint8_t op , uint8_t depth )
void Dexed : : setOPKeyboardLevelScalingDepthLeft ( uint8_t op , uint8_t depth )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
depth = constrain ( depth , 0 , 99 ) ;
depth = constrain ( depth , 0 , 99 ) ;
@ -1156,14 +1387,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingDepthLeft(uint8_t op, uint8_t dep
data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_DEPTH ] = depth ;
data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_DEPTH ] = depth ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardLevelScalingDepthLeft ( uint8_t op )
uint8_t Dexed : : getOPKeyboardLevelScalingDepthLeft ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_DEPTH ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_DEPTH ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardLevelScalingDepthRight ( uint8_t op , uint8_t depth )
void Dexed : : setOPKeyboardLevelScalingDepthRight ( uint8_t op , uint8_t depth )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
depth = constrain ( depth , 0 , 99 ) ;
depth = constrain ( depth , 0 , 99 ) ;
@ -1171,14 +1402,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingDepthRight(uint8_t op, uint8_t de
data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_DEPTH ] = depth ;
data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_DEPTH ] = depth ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardLevelScalingDepthRight ( uint8_t op )
uint8_t Dexed : : getOPKeyboardLevelScalingDepthRight ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_DEPTH ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_DEPTH ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardLevelScalingCurveLeft ( uint8_t op , uint8_t curve )
void Dexed : : setOPKeyboardLevelScalingCurveLeft ( uint8_t op , uint8_t curve )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
curve = constrain ( curve , 0 , 3 ) ;
curve = constrain ( curve , 0 , 3 ) ;
@ -1186,14 +1417,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingCurveLeft(uint8_t op, uint8_t cur
data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_CURVE ] = curve ;
data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_CURVE ] = curve ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardLevelScalingCurveLeft ( uint8_t op )
uint8_t Dexed : : getOPKeyboardLevelScalingCurveLeft ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_CURVE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_LEFT_CURVE ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardLevelScalingCurveRight ( uint8_t op , uint8_t curve )
void Dexed : : setOPKeyboardLevelScalingCurveRight ( uint8_t op , uint8_t curve )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
curve = constrain ( curve , 0 , 3 ) ;
curve = constrain ( curve , 0 , 3 ) ;
@ -1201,14 +1432,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingCurveRight(uint8_t op, uint8_t cu
data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_CURVE ] = curve ;
data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_CURVE ] = curve ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardLevelScalingCurveRight ( uint8_t op )
uint8_t Dexed : : getOPKeyboardLevelScalingCurveRight ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_CURVE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_SCL_RGHT_CURVE ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardRateScale ( uint8_t op , uint8_t scale )
void Dexed : : setOPKeyboardRateScale ( uint8_t op , uint8_t scale )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
scale = constrain ( scale , 0 , 7 ) ;
scale = constrain ( scale , 0 , 7 ) ;
@ -1216,14 +1447,14 @@ void AudioSynthDexed::setOPKeyboardRateScale(uint8_t op, uint8_t scale)
data [ ( op * 21 ) + DEXED_OP_OSC_RATE_SCALE ] = scale ;
data [ ( op * 21 ) + DEXED_OP_OSC_RATE_SCALE ] = scale ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardRateScale ( uint8_t op )
uint8_t Dexed : : getOPKeyboardRateScale ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_RATE_SCALE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_RATE_SCALE ] ) ;
}
}
void AudioSynth Dexed: : setOPAmpModulationSensity ( uint8_t op , uint8_t sensitivity )
void Dexed : : setOPAmpModulationSensity ( uint8_t op , uint8_t sensitivity )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
sensitivity = constrain ( sensitivity , 0 , 3 ) ;
sensitivity = constrain ( sensitivity , 0 , 3 ) ;
@ -1231,14 +1462,14 @@ void AudioSynthDexed::setOPAmpModulationSensity(uint8_t op, uint8_t sensitivity)
data [ ( op * 21 ) + DEXED_OP_AMP_MOD_SENS ] = sensitivity ;
data [ ( op * 21 ) + DEXED_OP_AMP_MOD_SENS ] = sensitivity ;
}
}
uint8_t AudioSynth Dexed: : getOPAmpModulationSensity ( uint8_t op )
uint8_t Dexed : : getOPAmpModulationSensity ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_AMP_MOD_SENS ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_AMP_MOD_SENS ] ) ;
}
}
void AudioSynth Dexed: : setOPKeyboardVelocitySensity ( uint8_t op , uint8_t sensitivity )
void Dexed : : setOPKeyboardVelocitySensity ( uint8_t op , uint8_t sensitivity )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
sensitivity = constrain ( sensitivity , 0 , 7 ) ;
sensitivity = constrain ( sensitivity , 0 , 7 ) ;
@ -1246,14 +1477,14 @@ void AudioSynthDexed::setOPKeyboardVelocitySensity(uint8_t op, uint8_t sensitivi
data [ ( op * 21 ) + DEXED_OP_KEY_VEL_SENS ] = sensitivity ;
data [ ( op * 21 ) + DEXED_OP_KEY_VEL_SENS ] = sensitivity ;
}
}
uint8_t AudioSynth Dexed: : getOPKeyboardVelocitySensity ( uint8_t op )
uint8_t Dexed : : getOPKeyboardVelocitySensity ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_KEY_VEL_SENS ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_KEY_VEL_SENS ] ) ;
}
}
void AudioSynth Dexed: : setOPOutputLevel ( uint8_t op , uint8_t level )
void Dexed : : setOPOutputLevel ( uint8_t op , uint8_t level )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
level = constrain ( level , 0 , 99 ) ;
level = constrain ( level , 0 , 99 ) ;
@ -1261,14 +1492,14 @@ void AudioSynthDexed::setOPOutputLevel(uint8_t op, uint8_t level)
data [ ( op * 21 ) + DEXED_OP_OUTPUT_LEV ] = level ;
data [ ( op * 21 ) + DEXED_OP_OUTPUT_LEV ] = level ;
}
}
uint8_t AudioSynth Dexed: : getOPOutputLevel ( uint8_t op )
uint8_t Dexed : : getOPOutputLevel ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OUTPUT_LEV ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OUTPUT_LEV ] ) ;
}
}
void AudioSynth Dexed: : setOPMode ( uint8_t op , uint8_t mode )
void Dexed : : setOPMode ( uint8_t op , uint8_t mode )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
mode = constrain ( mode , 0 , 1 ) ;
mode = constrain ( mode , 0 , 1 ) ;
@ -1276,14 +1507,14 @@ void AudioSynthDexed::setOPMode(uint8_t op, uint8_t mode)
data [ ( op * 21 ) + DEXED_OP_OSC_MODE ] = mode ;
data [ ( op * 21 ) + DEXED_OP_OSC_MODE ] = mode ;
}
}
uint8_t AudioSynth Dexed: : getOPMode ( uint8_t op )
uint8_t Dexed : : getOPMode ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_MODE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_MODE ] ) ;
}
}
void AudioSynth Dexed: : setOPFrequencyCoarse ( uint8_t op , uint8_t frq_coarse )
void Dexed : : setOPFrequencyCoarse ( uint8_t op , uint8_t frq_coarse )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
frq_coarse = constrain ( frq_coarse , 0 , 31 ) ;
frq_coarse = constrain ( frq_coarse , 0 , 31 ) ;
@ -1291,14 +1522,14 @@ void AudioSynthDexed::setOPFrequencyCoarse(uint8_t op, uint8_t frq_coarse)
data [ ( op * 21 ) + DEXED_OP_FREQ_COARSE ] = frq_coarse ;
data [ ( op * 21 ) + DEXED_OP_FREQ_COARSE ] = frq_coarse ;
}
}
uint8_t AudioSynth Dexed: : getOPFrequencyCoarse ( uint8_t op )
uint8_t Dexed : : getOPFrequencyCoarse ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_FREQ_COARSE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_FREQ_COARSE ] ) ;
}
}
void AudioSynth Dexed: : setOPFrequencyFine ( uint8_t op , uint8_t frq_fine )
void Dexed : : setOPFrequencyFine ( uint8_t op , uint8_t frq_fine )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
frq_fine = constrain ( frq_fine , 0 , 99 ) ;
frq_fine = constrain ( frq_fine , 0 , 99 ) ;
@ -1306,14 +1537,14 @@ void AudioSynthDexed::setOPFrequencyFine(uint8_t op, uint8_t frq_fine)
data [ ( op * 21 ) + DEXED_OP_FREQ_FINE ] = frq_fine ;
data [ ( op * 21 ) + DEXED_OP_FREQ_FINE ] = frq_fine ;
}
}
uint8_t AudioSynth Dexed: : getOPFrequencyFine ( uint8_t op )
uint8_t Dexed : : getOPFrequencyFine ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_FREQ_FINE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_FREQ_FINE ] ) ;
}
}
void AudioSynth Dexed: : setOPDetune ( uint8_t op , uint8_t detune )
void Dexed : : setOPDetune ( uint8_t op , uint8_t detune )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
detune = constrain ( detune , 0 , 14 ) ;
detune = constrain ( detune , 0 , 14 ) ;
@ -1321,14 +1552,14 @@ void AudioSynthDexed::setOPDetune(uint8_t op, uint8_t detune)
data [ ( op * 21 ) + DEXED_OP_OSC_DETUNE ] = detune ;
data [ ( op * 21 ) + DEXED_OP_OSC_DETUNE ] = detune ;
}
}
uint8_t AudioSynth Dexed: : getOPDetune ( uint8_t op )
uint8_t Dexed : : getOPDetune ( uint8_t op )
{
{
op = constrain ( op , 0 , 5 ) ;
op = constrain ( op , 0 , 5 ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_DETUNE ] ) ;
return ( data [ ( op * 21 ) + DEXED_OP_OSC_DETUNE ] ) ;
}
}
void AudioSynth Dexed: : setPitchRate ( uint8_t step , uint8_t rate )
void Dexed : : setPitchRate ( uint8_t step , uint8_t rate )
{
{
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
rate = constrain ( rate , 0 , 99 ) ;
rate = constrain ( rate , 0 , 99 ) ;
@ -1336,14 +1567,14 @@ void AudioSynthDexed::setPitchRate(uint8_t step, uint8_t rate)
data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step ] = rate ;
data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step ] = rate ;
}
}
uint8_t AudioSynth Dexed: : getPitchRate ( uint8_t step )
uint8_t Dexed : : getPitchRate ( uint8_t step )
{
{
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step ] ) ;
}
}
void AudioSynth Dexed: : setPitchLevel ( uint8_t step , uint8_t level )
void Dexed : : setPitchLevel ( uint8_t step , uint8_t level )
{
{
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
level = constrain ( level , 0 , 99 ) ;
level = constrain ( level , 0 , 99 ) ;
@ -1351,150 +1582,186 @@ void AudioSynthDexed::setPitchLevel(uint8_t step, uint8_t level)
data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step ] = level ;
data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step ] = level ;
}
}
uint8_t AudioSynth Dexed: : getPitchLevel ( uint8_t step )
uint8_t Dexed : : getPitchLevel ( uint8_t step )
{
{
step = constrain ( step , 0 , 3 ) ;
step = constrain ( step , 0 , 3 ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step ] ) ;
}
}
void AudioSynth Dexed: : setAlgorithm ( uint8_t algorithm )
void Dexed : : setAlgorithm ( uint8_t algorithm )
{
{
algorithm = constrain ( algorithm , 0 , 31 ) ;
algorithm = constrain ( algorithm , 0 , 31 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_ALGORITHM ] = algorithm ;
data [ DEXED_VOICE_OFFSET + DEXED_ALGORITHM ] = algorithm ;
}
}
uint8_t AudioSynth Dexed: : getAlgorithm ( void )
uint8_t Dexed : : getAlgorithm ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_ALGORITHM ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_ALGORITHM ] ) ;
}
}
void AudioSynth Dexed: : setFeedback ( uint8_t feedback )
void Dexed : : setFeedback ( uint8_t feedback )
{
{
feedback = constrain ( feedback , 0 , 31 ) ;
feedback = constrain ( feedback , 0 , 31 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_FEEDBACK ] = feedback ;
data [ DEXED_VOICE_OFFSET + DEXED_FEEDBACK ] = feedback ;
}
}
uint8_t AudioSynth Dexed: : getFeedback ( void )
uint8_t Dexed : : getFeedback ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_FEEDBACK ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_FEEDBACK ] ) ;
}
}
void AudioSynth Dexed: : setOscillatorSync ( bool sync )
void Dexed : : setOscillatorSync ( bool sync )
{
{
data [ DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC ] = sync ;
data [ DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC ] = sync ;
}
}
bool AudioSynth Dexed: : getOscillatorSync ( void )
bool Dexed : : getOscillatorSync ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC ] ) ;
}
}
void AudioSynth Dexed: : setLFOSpeed ( uint8_t speed )
void Dexed : : setLFOSpeed ( uint8_t speed )
{
{
speed = constrain ( speed , 0 , 99 ) ;
speed = constrain ( speed , 0 , 99 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_SPEED ] = speed ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_SPEED ] = speed ;
}
}
uint8_t AudioSynth Dexed: : getLFOSpeed ( void )
uint8_t Dexed : : getLFOSpeed ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_SPEED ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_SPEED ] ) ;
}
}
void AudioSynth Dexed: : setLFODelay ( uint8_t delay )
void Dexed : : setLFODelay ( uint8_t delay )
{
{
delay = constrain ( delay , 0 , 99 ) ;
delay = constrain ( delay , 0 , 99 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_DELAY ] = delay ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_DELAY ] = delay ;
}
}
uint8_t AudioSynth Dexed: : getLFODelay ( void )
uint8_t Dexed : : getLFODelay ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_DELAY ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_DELAY ] ) ;
}
}
void AudioSynth Dexed: : setLFOPitchModulationDepth ( uint8_t depth )
void Dexed : : setLFOPitchModulationDepth ( uint8_t depth )
{
{
depth = constrain ( depth , 0 , 99 ) ;
depth = constrain ( depth , 0 , 99 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP ] = depth ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP ] = depth ;
}
}
uint8_t AudioSynth Dexed: : getLFOPitchModulationDepth ( void )
uint8_t Dexed : : getLFOPitchModulationDepth ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP ] ) ;
}
}
void AudioSynth Dexed: : setLFOAmpModulationDepth ( uint8_t depth )
void Dexed : : setLFOAmpModulationDepth ( uint8_t depth )
{
{
depth = constrain ( depth , 0 , 99 ) ;
depth = constrain ( depth , 0 , 99 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP ] = depth ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP ] = depth ;
}
}
uint8_t AudioSynth Dexed: : getLFOAmpModulationDepth ( void )
uint8_t Dexed : : getLFOAmpModulationDepth ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP ] ) ;
}
}
void AudioSynth Dexed: : setLFOSync ( bool sync )
void Dexed : : setLFOSync ( bool sync )
{
{
data [ DEXED_VOICE_OFFSET + DEXED_LFO_SYNC ] = sync ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_SYNC ] = sync ;
}
}
bool AudioSynth Dexed: : getLFOSync ( void )
bool Dexed : : getLFOSync ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_SYNC ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_SYNC ] ) ;
}
}
void AudioSynth Dexed: : setLFOWaveform ( uint8_t waveform )
void Dexed : : setLFOWaveform ( uint8_t waveform )
{
{
waveform = constrain ( waveform , 0 , 5 ) ;
waveform = constrain ( waveform , 0 , 5 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_WAVE ] = waveform ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_WAVE ] = waveform ;
}
}
uint8_t AudioSynth Dexed: : getLFOWaveform ( void )
uint8_t Dexed : : getLFOWaveform ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_WAVE ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_WAVE ] ) ;
}
}
void AudioSynth Dexed: : setLFOPitchModulationSensitivity ( uint8_t sensitivity )
void Dexed : : setLFOPitchModulationSensitivity ( uint8_t sensitivity )
{
{
sensitivity = constrain ( sensitivity , 0 , 5 ) ;
sensitivity = constrain ( sensitivity , 0 , 5 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS ] = sensitivity ;
data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS ] = sensitivity ;
}
}
uint8_t AudioSynth Dexed: : getLFOPitchModulationSensitivity ( void )
uint8_t Dexed : : getLFOPitchModulationSensitivity ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS ] ) ;
}
}
void AudioSynth Dexed: : setTranspose ( uint8_t transpose )
void Dexed : : setTranspose ( uint8_t transpose )
{
{
transpose = constrain ( transpose , 0 , 48 ) ;
transpose = constrain ( transpose , 0 , 48 ) ;
data [ DEXED_VOICE_OFFSET + DEXED_TRANSPOSE ] = transpose ;
data [ DEXED_VOICE_OFFSET + DEXED_TRANSPOSE ] = transpose ;
}
}
uint8_t AudioSynth Dexed: : getTranspose ( void )
uint8_t Dexed : : getTranspose ( void )
{
{
return ( data [ DEXED_VOICE_OFFSET + DEXED_TRANSPOSE ] ) ;
return ( data [ DEXED_VOICE_OFFSET + DEXED_TRANSPOSE ] ) ;
}
}
void AudioSynth Dexed: : setName ( char * name )
void Dexed : : setName ( char * name )
{
{
strncpy ( name , ( char * ) & data [ DEXED_VOICE_OFFSET + DEXED_NAME ] , 10 ) ;
strncpy ( name , ( char * ) & data [ DEXED_VOICE_OFFSET + DEXED_NAME ] , 10 ) ;
}
}
void AudioSynth Dexed: : getName ( char * buffer )
void Dexed : : getName ( char * buffer )
{
{
strncpy ( ( char * ) & data [ DEXED_VOICE_OFFSET + DEXED_NAME ] , buffer , 10 ) ;
strncpy ( ( char * ) & data [ DEXED_VOICE_OFFSET + DEXED_NAME ] , buffer , 10 ) ;
buffer [ 10 ] = ' \0 ' ;
}
}
void AudioSynthDexed : : update ( void )
{
if ( in_update = = true )
{
xrun + + ;
return ;
}
else
in_update = true ;
elapsedMicros render_time ;
audio_block_t * lblock ;
lblock = allocate ( ) ;
if ( ! lblock )
{
in_update = false ;
return ;
}
getSamples ( AUDIO_BLOCK_SAMPLES , lblock - > data ) ;
if ( render_time > audio_block_time_us ) // everything greater audio_block_time_us (2.9ms for buffer size of 128) is a buffer underrun!
xrun + + ;
if ( render_time > render_time_max )
render_time_max = render_time ;
transmit ( lblock , 0 ) ;
release ( lblock ) ;
in_update = false ;
} ;
/*
/*
// https://www.musicdsp.org/en/latest/Effects/169-compressor.html#
// https://www.musicdsp.org/en/latest/Effects/169-compressor.html#
void compress
void compress