cwPresetSel.h/cpp : Added 'master' variables: wet in/out gain, dry gain, sync delay ms.
This commit is contained in:
parent
bb2cd0d086
commit
e4dcb5f83c
@ -32,6 +32,11 @@ namespace cw
|
|||||||
|
|
||||||
frag_t* last_ts_frag;
|
frag_t* last_ts_frag;
|
||||||
|
|
||||||
|
double master_wet_in_gain;
|
||||||
|
double master_wet_out_gain;
|
||||||
|
double master_dry_gain;
|
||||||
|
double master_sync_delay_ms;
|
||||||
|
|
||||||
} preset_sel_t;
|
} preset_sel_t;
|
||||||
|
|
||||||
preset_sel_t* _handleToPtr( handle_t h )
|
preset_sel_t* _handleToPtr( handle_t h )
|
||||||
@ -205,6 +210,9 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _is_master_var_id( unsigned varId )
|
||||||
|
{ return varId > kBaseMasterVarId; }
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
rc_t _set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, const T& value )
|
rc_t _set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, const T& value )
|
||||||
{
|
{
|
||||||
@ -212,7 +220,8 @@ namespace cw
|
|||||||
preset_sel_t* p = _handleToPtr(h);
|
preset_sel_t* p = _handleToPtr(h);
|
||||||
frag_t* f = nullptr;
|
frag_t* f = nullptr;
|
||||||
|
|
||||||
// locate the requested fragment
|
// if this is not a 'master' variable then locate the requested fragment
|
||||||
|
if( !_is_master_var_id(varId) )
|
||||||
if((rc = _find_frag(p,fragId,f)) != kOkRC )
|
if((rc = _find_frag(p,fragId,f)) != kOkRC )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
@ -260,6 +269,22 @@ namespace cw
|
|||||||
case kPlayBtnVarId:
|
case kPlayBtnVarId:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kMasterWetInGainVarId:
|
||||||
|
p->master_wet_in_gain = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterWetOutGainVarId:
|
||||||
|
p->master_wet_out_gain = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterDryGainVarId:
|
||||||
|
p->master_dry_gain = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterSyncDelayMsVarId:
|
||||||
|
p->master_sync_delay_ms = value;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rc = cwLogError(kInvalidIdRC,"There is no preset variable with var id:%i.",varId);
|
rc = cwLogError(kInvalidIdRC,"There is no preset variable with var id:%i.",varId);
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -280,7 +305,8 @@ namespace cw
|
|||||||
preset_sel_t* p = _handleToPtr(h);
|
preset_sel_t* p = _handleToPtr(h);
|
||||||
frag_t* f = nullptr;
|
frag_t* f = nullptr;
|
||||||
|
|
||||||
// locate the requested fragment
|
// if this is not a 'master' variable then locate the requested fragment
|
||||||
|
if( !_is_master_var_id( varId ) )
|
||||||
if((rc = _find_frag(p,fragId,f)) != kOkRC )
|
if((rc = _find_frag(p,fragId,f)) != kOkRC )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
@ -335,6 +361,22 @@ namespace cw
|
|||||||
case kPlayBtnVarId:
|
case kPlayBtnVarId:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kMasterWetInGainVarId:
|
||||||
|
valueRef = p->master_wet_in_gain;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterWetOutGainVarId:
|
||||||
|
valueRef = p->master_wet_out_gain;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterDryGainVarId:
|
||||||
|
valueRef = p->master_dry_gain;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMasterSyncDelayMsVarId:
|
||||||
|
valueRef = p->master_sync_delay_ms;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rc = cwLogError(kInvalidIdRC,"There is no preset variable with var id:%i.",varId);
|
rc = cwLogError(kInvalidIdRC,"There is no preset variable with var id:%i.",varId);
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -369,7 +411,11 @@ cw::rc_t cw::preset_sel::create( handle_t& hRef, const object_t* cfg )
|
|||||||
"default_gain", p->defaultGain,
|
"default_gain", p->defaultGain,
|
||||||
"default_wet_dry_gain", p->defaultWetDryGain,
|
"default_wet_dry_gain", p->defaultWetDryGain,
|
||||||
"default_fade_ms", p->defaultFadeOutMs,
|
"default_fade_ms", p->defaultFadeOutMs,
|
||||||
"default_preset", default_preset_label)) != kOkRC )
|
"default_preset", default_preset_label,
|
||||||
|
"default_master_wet_in_gain", p->master_wet_in_gain,
|
||||||
|
"default_master_wet_out_gain", p->master_wet_out_gain,
|
||||||
|
"default_master_dry_gain", p->master_dry_gain,
|
||||||
|
"default_master_sync_delay_ms", p->master_sync_delay_ms)) != kOkRC )
|
||||||
{
|
{
|
||||||
rc = cwLogError(rc,"The preset configuration parse failed.");
|
rc = cwLogError(rc,"The preset configuration parse failed.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -801,6 +847,10 @@ cw::rc_t cw::preset_sel::write( handle_t h, const char* fn )
|
|||||||
|
|
||||||
newPairObject("fragL", fragL_obj, root);
|
newPairObject("fragL", fragL_obj, root);
|
||||||
newPairObject("fragN", fragN, root);
|
newPairObject("fragN", fragN, root);
|
||||||
|
newPairObject("masterWetInGain", p->master_wet_in_gain, root );
|
||||||
|
newPairObject("masterWetOutGain", p->master_wet_out_gain, root );
|
||||||
|
newPairObject("masterDryGain", p->master_dry_gain, root );
|
||||||
|
newPairObject("masterSyncDelayMs", p->master_sync_delay_ms,root );
|
||||||
|
|
||||||
unsigned bytes_per_frag = 1024;
|
unsigned bytes_per_frag = 1024;
|
||||||
|
|
||||||
@ -849,7 +899,11 @@ cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
|
|||||||
|
|
||||||
// parse the root level
|
// parse the root level
|
||||||
if((rc = root->getv( "fragN", fragN,
|
if((rc = root->getv( "fragN", fragN,
|
||||||
"fragL", fragL_obj )) != kOkRC )
|
"fragL", fragL_obj,
|
||||||
|
"masterWetInGain", p->master_wet_in_gain,
|
||||||
|
"masterWetOutGain", p->master_wet_out_gain,
|
||||||
|
"masterDryGain", p->master_dry_gain,
|
||||||
|
"masterSyncDelayMs",p->master_sync_delay_ms)) != kOkRC )
|
||||||
{
|
{
|
||||||
rc = cwLogError(rc,"Root preset select parse failed on '%s'.", cwStringNullGuard(fn));
|
rc = cwLogError(rc,"Root preset select parse failed on '%s'.", cwStringNullGuard(fn));
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
@ -57,6 +57,13 @@ namespace cw
|
|||||||
kPresetSelectVarId, // select a preset to play
|
kPresetSelectVarId, // select a preset to play
|
||||||
kPlayEnableVarId, // include in the segment to play
|
kPlayEnableVarId, // include in the segment to play
|
||||||
kDryFlVarId, // play this fragment dry
|
kDryFlVarId, // play this fragment dry
|
||||||
|
|
||||||
|
|
||||||
|
kBaseMasterVarId, // All 'master' variables have id's greater than kBaseMasterVarId
|
||||||
|
kMasterWetInGainVarId,
|
||||||
|
kMasterWetOutGainVarId,
|
||||||
|
kMasterDryGainVarId,
|
||||||
|
kMasterSyncDelayMsVarId
|
||||||
};
|
};
|
||||||
|
|
||||||
rc_t create( handle_t& hRef, const object_t* cfg );
|
rc_t create( handle_t& hRef, const object_t* cfg );
|
||||||
|
@ -10,11 +10,24 @@
|
|||||||
row: {
|
row: {
|
||||||
button:{ name: quitBtnId, title:"Quit" },
|
button:{ name: quitBtnId, title:"Quit" },
|
||||||
button:{ name: ioReportBtnId, title:"IO Report" },
|
button:{ name: ioReportBtnId, title:"IO Report" },
|
||||||
|
button:{ name: netPrintBtnId, title:"Print Network" }
|
||||||
button:{ name: reportBtnId, title:"App Report" },
|
button:{ name: reportBtnId, title:"App Report" },
|
||||||
button:{ name: loadBtnId, title:"Load" },
|
button:{ name: loadBtnId, title:"Load" },
|
||||||
button:{ name: saveBtnId, title:"Save" },
|
button:{ name: saveBtnId, title:"Save" },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
row: {
|
||||||
|
check: { name: printMidiCheckId, title: "Print MIDI" },
|
||||||
|
check: { name: pianoMidiCheckId, title: "Piano MIDI" },
|
||||||
|
check: { name: samplerMidiCheckId, title: "Sampler MIDI" },
|
||||||
|
number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 },
|
||||||
|
},
|
||||||
|
|
||||||
|
row: {
|
||||||
|
number: { name: wetInGainId, title:"Wet In Gain", min:0, max:100.0, step:0.01, decpl:3 },
|
||||||
|
number: { name: wetOutGainId, title:"Wet Out Gain", min:0, max:100.0, step:0.01, decpl:3 },
|
||||||
|
number: { name: dryGainId, title:"Dry Gain", min:0, max:100.0, step:0.01, decpl:3 },
|
||||||
|
},
|
||||||
|
|
||||||
row: {
|
row: {
|
||||||
button:{ name: startBtnId, title:"Start" },
|
button:{ name: startBtnId, title:"Start" },
|
||||||
|
Loading…
Reference in New Issue
Block a user