838 |
|
|
839 |
VMFnResult* InstrumentScriptVMFunction_change_attack::exec(VMFnArgs* args) { |
VMFnResult* InstrumentScriptVMFunction_change_attack::exec(VMFnArgs* args) { |
840 |
int attack = args->arg(1)->asInt()->evalInt(); |
int attack = args->arg(1)->asInt()->evalInt(); |
841 |
if (attack > VM_EG_PAR_MAX_VALUE) { |
// note: intentionally not checking against a max. value here! |
842 |
wrnMsg("change_attack(): argument 2 may not be larger than 1000000"); |
// (to allow i.e. passing 2000000 for doubling the attack time) |
843 |
attack = VM_EG_PAR_MAX_VALUE; |
if (attack < 0) { |
|
} else if (attack < 0) { |
|
844 |
wrnMsg("change_attack(): argument 2 may not be negative"); |
wrnMsg("change_attack(): argument 2 may not be negative"); |
845 |
attack = 0; |
attack = 0; |
846 |
} |
} |
924 |
|
|
925 |
VMFnResult* InstrumentScriptVMFunction_change_decay::exec(VMFnArgs* args) { |
VMFnResult* InstrumentScriptVMFunction_change_decay::exec(VMFnArgs* args) { |
926 |
int decay = args->arg(1)->asInt()->evalInt(); |
int decay = args->arg(1)->asInt()->evalInt(); |
927 |
if (decay > VM_EG_PAR_MAX_VALUE) { |
// note: intentionally not checking against a max. value here! |
928 |
wrnMsg("change_decay(): argument 2 may not be larger than 1000000"); |
// (to allow i.e. passing 2000000 for doubling the decay time) |
929 |
decay = VM_EG_PAR_MAX_VALUE; |
if (decay < 0) { |
|
} else if (decay < 0) { |
|
930 |
wrnMsg("change_decay(): argument 2 may not be negative"); |
wrnMsg("change_decay(): argument 2 may not be negative"); |
931 |
decay = 0; |
decay = 0; |
932 |
} |
} |
1010 |
|
|
1011 |
VMFnResult* InstrumentScriptVMFunction_change_release::exec(VMFnArgs* args) { |
VMFnResult* InstrumentScriptVMFunction_change_release::exec(VMFnArgs* args) { |
1012 |
int release = args->arg(1)->asInt()->evalInt(); |
int release = args->arg(1)->asInt()->evalInt(); |
1013 |
if (release > VM_EG_PAR_MAX_VALUE) { |
// note: intentionally not checking against a max. value here! |
1014 |
wrnMsg("change_release(): argument 2 may not be larger than 1000000"); |
// (to allow i.e. passing 2000000 for doubling the release time) |
1015 |
release = VM_EG_PAR_MAX_VALUE; |
if (release < 0) { |
|
} else if (release < 0) { |
|
1016 |
wrnMsg("change_release(): argument 2 may not be negative"); |
wrnMsg("change_release(): argument 2 may not be negative"); |
1017 |
release = 0; |
release = 0; |
1018 |
} |
} |
1174 |
return successResult(); |
return successResult(); |
1175 |
} |
} |
1176 |
|
|
1177 |
|
// change_sustain() function |
1178 |
|
|
1179 |
|
VMFnResult* InstrumentScriptVMFunction_change_sustain::exec(VMFnArgs* args) { |
1180 |
|
return VMChangeSynthParamFunction::execTemplate< |
1181 |
|
&NoteBase::_Override::Sustain, |
1182 |
|
Event::synth_param_sustain, |
1183 |
|
true, NO_LIMIT, 0>( args, "change_sustain" ); |
1184 |
|
} |
1185 |
|
|
1186 |
// change_amp_lfo_depth() function |
// change_amp_lfo_depth() function |
1187 |
|
|
1188 |
VMFnResult* InstrumentScriptVMFunction_change_amp_lfo_depth::exec(VMFnArgs* args) { |
VMFnResult* InstrumentScriptVMFunction_change_amp_lfo_depth::exec(VMFnArgs* args) { |
1237 |
false, NO_LIMIT, 0>( args, "change_tune_time" ); |
false, NO_LIMIT, 0>( args, "change_tune_time" ); |
1238 |
} |
} |
1239 |
|
|
1240 |
|
// change_pan_time() function |
1241 |
|
|
1242 |
|
VMFnResult* InstrumentScriptVMFunction_change_pan_time::exec(VMFnArgs* args) { |
1243 |
|
return VMChangeSynthParamFunction::execTemplate< |
1244 |
|
&NoteBase::_Override::PanTime, |
1245 |
|
Event::synth_param_pan_time, |
1246 |
|
false, NO_LIMIT, 0>( args, "change_pan_time" ); |
1247 |
|
} |
1248 |
|
|
1249 |
// template for change_*_curve() functions |
// template for change_*_curve() functions |
1250 |
|
|
1251 |
bool VMChangeFadeCurveFunction::acceptsArgType(int iArg, ExprType_t type) const { |
bool VMChangeFadeCurveFunction::acceptsArgType(int iArg, ExprType_t type) const { |
1347 |
Event::synth_param_pitch_curve>( args, "change_tune_curve" ); |
Event::synth_param_pitch_curve>( args, "change_tune_curve" ); |
1348 |
} |
} |
1349 |
|
|
1350 |
|
// change_pan_curve() function |
1351 |
|
|
1352 |
|
VMFnResult* InstrumentScriptVMFunction_change_pan_curve::exec(VMFnArgs* args) { |
1353 |
|
return VMChangeFadeCurveFunction::execTemplate< |
1354 |
|
&NoteBase::_Override::PanCurve, |
1355 |
|
Event::synth_param_pan_curve>( args, "change_pan_curve" ); |
1356 |
|
} |
1357 |
|
|
1358 |
// fade_in() function |
// fade_in() function |
1359 |
|
|
1360 |
InstrumentScriptVMFunction_fade_in::InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent) |
InstrumentScriptVMFunction_fade_in::InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent) |
1888 |
return successResult(pNote ? EVENT_STATUS_NOTE_QUEUE : EVENT_STATUS_INACTIVE); |
return successResult(pNote ? EVENT_STATUS_NOTE_QUEUE : EVENT_STATUS_INACTIVE); |
1889 |
} |
} |
1890 |
|
|
1891 |
|
// callback_status() function |
1892 |
|
|
1893 |
|
InstrumentScriptVMFunction_callback_status::InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent) |
1894 |
|
: m_vm(parent) |
1895 |
|
{ |
1896 |
|
} |
1897 |
|
|
1898 |
|
VMFnResult* InstrumentScriptVMFunction_callback_status::exec(VMFnArgs* args) { |
1899 |
|
const script_callback_id_t id = args->arg(0)->asInt()->evalInt(); |
1900 |
|
if (!id) { |
1901 |
|
wrnMsg("callback_status(): callback ID for argument 1 may not be zero"); |
1902 |
|
return successResult(); |
1903 |
|
} |
1904 |
|
|
1905 |
|
AbstractEngineChannel* pEngineChannel = |
1906 |
|
static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel); |
1907 |
|
|
1908 |
|
RTList<ScriptEvent>::Iterator itCallback = pEngineChannel->ScriptCallbackByID(id); |
1909 |
|
if (!itCallback) |
1910 |
|
return successResult(CALLBACK_STATUS_TERMINATED); |
1911 |
|
|
1912 |
|
return successResult( |
1913 |
|
(m_vm->m_event->execCtx == itCallback->execCtx) ? |
1914 |
|
CALLBACK_STATUS_RUNNING : CALLBACK_STATUS_QUEUE |
1915 |
|
); |
1916 |
|
} |
1917 |
|
|
1918 |
// wait() function (overrides core wait() implementation) |
// wait() function (overrides core wait() implementation) |
1919 |
|
|
1920 |
InstrumentScriptVMFunction_wait::InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent) |
InstrumentScriptVMFunction_wait::InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent) |