--- linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp 2017/07/30 14:33:15 3335 +++ linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp 2019/08/18 00:06:04 3557 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Christian Schoenebeck + * Copyright (c) 2014-2019 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -21,9 +21,9 @@ } VMFnResult* InstrumentScriptVMFunction_play_note::exec(VMFnArgs* args) { - int note = args->arg(0)->asInt()->evalInt(); - int velocity = (args->argsCount() >= 2) ? args->arg(1)->asInt()->evalInt() : 127; - int duration = (args->argsCount() >= 4) ? args->arg(3)->asInt()->evalInt() : 0; //TODO: -1 might be a better default value instead of 0 + vmint note = args->arg(0)->asInt()->evalInt(); + vmint velocity = (args->argsCount() >= 2) ? args->arg(1)->asInt()->evalInt() : 127; + vmint duration = (args->argsCount() >= 4) ? args->arg(3)->asInt()->evalInt() : 0; //TODO: -1 might be a better default value instead of 0 if (note < 0 || note > 127) { errMsg("play_note(): argument 1 is an invalid note number"); @@ -68,11 +68,12 @@ // if a sample offset is supplied, assign the offset as override // to the previously created Note object if (args->argsCount() >= 3) { - int sampleoffset = args->arg(2)->asInt()->evalInt(); + vmint sampleoffset = args->arg(2)->asInt()->evalInt(); if (sampleoffset >= 0) { NoteBase* pNote = pEngineChannel->pEngine->NoteByID(id); if (pNote) { - pNote->Override.SampleOffset = sampleoffset; + pNote->Override.SampleOffset = + (decltype(pNote->Override.SampleOffset)) sampleoffset; } } else if (sampleoffset < -1) { errMsg("play_note(): sample offset of argument 3 may not be less than -1"); @@ -102,8 +103,8 @@ } VMFnResult* InstrumentScriptVMFunction_set_controller::exec(VMFnArgs* args) { - int controller = args->arg(0)->asInt()->evalInt(); - int value = args->arg(1)->asInt()->evalInt(); + vmint controller = args->arg(0)->asInt()->evalInt(); + vmint value = args->arg(1)->asInt()->evalInt(); AbstractEngineChannel* pEngineChannel = static_cast(m_vm->m_event->cause.pEngineChannel); @@ -140,7 +141,7 @@ { } - bool InstrumentScriptVMFunction_ignore_event::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_ignore_event::acceptsArgType(vmint iArg, ExprType_t type) const { return type == INT_EXPR || type == INT_ARR_EXPR; } @@ -196,7 +197,7 @@ { } - bool InstrumentScriptVMFunction_note_off::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_note_off::acceptsArgType(vmint iArg, ExprType_t type) const { return type == INT_EXPR || type == INT_ARR_EXPR; } @@ -204,7 +205,7 @@ AbstractEngineChannel* pEngineChannel = static_cast(m_vm->m_event->cause.pEngineChannel); - int velocity = (args->argsCount() >= 2) ? args->arg(1)->asInt()->evalInt() : 127; + vmint velocity = (args->argsCount() >= 2) ? args->arg(1)->asInt()->evalInt() : 127; if (velocity < 0 || velocity > 127) { errMsg("note_off(): argument 2 is an invalid velocity value"); return errorResult(); @@ -235,7 +236,7 @@ pEngineChannel->ScheduleEventMicroSec(&e, 0); } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -266,7 +267,7 @@ VMFnResult* InstrumentScriptVMFunction_set_event_mark::exec(VMFnArgs* args) { const ScriptID id = args->arg(0)->asInt()->evalInt(); - const int groupID = args->arg(1)->asInt()->evalInt(); + const vmint groupID = args->arg(1)->asInt()->evalInt(); if (groupID < 0 || groupID >= INSTR_SCRIPT_EVENT_GROUPS) { errMsg("set_event_mark(): argument 2 is an invalid group id"); @@ -304,7 +305,7 @@ VMFnResult* InstrumentScriptVMFunction_delete_event_mark::exec(VMFnArgs* args) { const ScriptID id = args->arg(0)->asInt()->evalInt(); - const int groupID = args->arg(1)->asInt()->evalInt(); + const vmint groupID = args->arg(1)->asInt()->evalInt(); if (groupID < 0 || groupID >= INSTR_SCRIPT_EVENT_GROUPS) { errMsg("delete_event_mark(): argument 2 is an invalid group id"); @@ -326,11 +327,11 @@ { } - int InstrumentScriptVMFunction_by_marks::Result::arraySize() const { + vmint InstrumentScriptVMFunction_by_marks::Result::arraySize() const { return eventGroup->size(); } - int InstrumentScriptVMFunction_by_marks::Result::evalIntElement(uint i) { + vmint InstrumentScriptVMFunction_by_marks::Result::evalIntElement(vmuint i) { return (*eventGroup)[i]; } @@ -347,7 +348,7 @@ } VMFnResult* InstrumentScriptVMFunction_by_marks::exec(VMFnArgs* args) { - int groupID = args->arg(0)->asInt()->evalInt(); + vmint groupID = args->arg(0)->asInt()->evalInt(); if (groupID < 0 || groupID >= INSTR_SCRIPT_EVENT_GROUPS) { errMsg("by_marks(): argument is an invalid group id"); @@ -367,7 +368,7 @@ { } - bool InstrumentScriptVMFunction_change_vol::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_vol::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -375,7 +376,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_vol::exec(VMFnArgs* args) { - int volume = args->arg(1)->asInt()->evalInt(); // volume change in milli dB + vmint volume = args->arg(1)->asInt()->evalInt(); // volume change in milli dB bool relative = (args->argsCount() >= 3) ? (args->arg(2)->asInt()->evalInt() & 1) : false; const float fVolumeLin = RTMath::DecibelToLinRatio(float(volume) / 1000.f); @@ -419,7 +420,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -460,7 +461,7 @@ { } - bool InstrumentScriptVMFunction_change_tune::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_tune::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -468,7 +469,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_tune::exec(VMFnArgs* args) { - int tune = args->arg(1)->asInt()->evalInt(); // tuning change in milli cents + vmint tune = args->arg(1)->asInt()->evalInt(); // tuning change in milli cents bool relative = (args->argsCount() >= 3) ? (args->arg(2)->asInt()->evalInt() & 1) : false; const float fFreqRatio = RTMath::CentsToFreqRatioUnlimited(float(tune) / 1000.f); @@ -512,7 +513,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -553,7 +554,7 @@ { } - bool InstrumentScriptVMFunction_change_pan::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_pan::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -561,7 +562,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_pan::exec(VMFnArgs* args) { - int pan = args->arg(1)->asInt()->evalInt(); + vmint pan = args->arg(1)->asInt()->evalInt(); bool relative = (args->argsCount() >= 3) ? (args->arg(2)->asInt()->evalInt() & 1) : false; if (pan > 1000) { @@ -612,7 +613,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -655,7 +656,7 @@ { } - bool InstrumentScriptVMFunction_change_cutoff::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_cutoff::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -663,7 +664,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_cutoff::exec(VMFnArgs* args) { - int cutoff = args->arg(1)->asInt()->evalInt(); + vmint cutoff = args->arg(1)->asInt()->evalInt(); if (cutoff > VM_FILTER_PAR_MAX_VALUE) { wrnMsg("change_cutoff(): argument 2 may not be larger than 1000000"); cutoff = VM_FILTER_PAR_MAX_VALUE; @@ -707,7 +708,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -742,7 +743,7 @@ { } - bool InstrumentScriptVMFunction_change_reso::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_reso::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -750,7 +751,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_reso::exec(VMFnArgs* args) { - int resonance = args->arg(1)->asInt()->evalInt(); + vmint resonance = args->arg(1)->asInt()->evalInt(); if (resonance > VM_FILTER_PAR_MAX_VALUE) { wrnMsg("change_reso(): argument 2 may not be larger than 1000000"); resonance = VM_FILTER_PAR_MAX_VALUE; @@ -794,7 +795,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -829,7 +830,7 @@ { } - bool InstrumentScriptVMFunction_change_attack::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_attack::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -837,7 +838,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_attack::exec(VMFnArgs* args) { - int attack = args->arg(1)->asInt()->evalInt(); + vmint attack = args->arg(1)->asInt()->evalInt(); // note: intentionally not checking against a max. value here! // (to allow i.e. passing 2000000 for doubling the attack time) if (attack < 0) { @@ -880,7 +881,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -915,7 +916,7 @@ { } - bool InstrumentScriptVMFunction_change_decay::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_decay::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -923,7 +924,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_decay::exec(VMFnArgs* args) { - int decay = args->arg(1)->asInt()->evalInt(); + vmint decay = args->arg(1)->asInt()->evalInt(); // note: intentionally not checking against a max. value here! // (to allow i.e. passing 2000000 for doubling the decay time) if (decay < 0) { @@ -966,7 +967,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1001,7 +1002,7 @@ { } - bool InstrumentScriptVMFunction_change_release::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_change_release::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -1009,7 +1010,7 @@ } VMFnResult* InstrumentScriptVMFunction_change_release::exec(VMFnArgs* args) { - int release = args->arg(1)->asInt()->evalInt(); + vmint release = args->arg(1)->asInt()->evalInt(); // note: intentionally not checking against a max. value here! // (to allow i.e. passing 2000000 for doubling the release time) if (release < 0) { @@ -1052,7 +1053,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1082,7 +1083,7 @@ // template for change_*() functions - bool VMChangeSynthParamFunction::acceptsArgType(int iArg, ExprType_t type) const { + bool VMChangeSynthParamFunction::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -1092,10 +1093,10 @@ // Arbitrarily chosen constant value symbolizing "no limit". #define NO_LIMIT 1315916909 - template + template VMFnResult* VMChangeSynthParamFunction::execTemplate(VMFnArgs* args, const char* functionName) { - int value = args->arg(1)->asInt()->evalInt(); + vmint value = args->arg(1)->asInt()->evalInt(); if (T_maxValue != NO_LIMIT && value > T_maxValue) { wrnMsg(String(functionName) + "(): argument 2 may not be larger than " + ToString(T_maxValue)); value = T_maxValue; @@ -1145,7 +1146,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1178,9 +1179,45 @@ VMFnResult* InstrumentScriptVMFunction_change_sustain::exec(VMFnArgs* args) { return VMChangeSynthParamFunction::execTemplate< - &NoteBase::_Override::Sustain, - Event::synth_param_sustain, - true, NO_LIMIT, 0>( args, "change_sustain" ); + &NoteBase::_Override::Sustain, + Event::synth_param_sustain, + false, NO_LIMIT, 0>( args, "change_sustain" ); + } + + // change_cutoff_attack() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_attack::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffAttack, + Event::synth_param_cutoff_attack, + false, NO_LIMIT, 0>( args, "change_cutoff_attack" ); + } + + // change_cutoff_decay() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_decay::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffDecay, + Event::synth_param_cutoff_decay, + false, NO_LIMIT, 0>( args, "change_cutoff_decay" ); + } + + // change_cutoff_sustain() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_sustain::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffSustain, + Event::synth_param_cutoff_sustain, + false, NO_LIMIT, 0>( args, "change_cutoff_sustain" ); + } + + // change_cutoff_release() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_release::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffRelease, + Event::synth_param_cutoff_release, + false, NO_LIMIT, 0>( args, "change_cutoff_release" ); } // change_amp_lfo_depth() function @@ -1201,6 +1238,24 @@ true, 1000000, 0>( args, "change_amp_lfo_freq" ); } + // change_cutoff_lfo_depth() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_lfo_depth::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffLFODepth, + Event::synth_param_cutoff_lfo_depth, + true, 1000000, 0>( args, "change_cutoff_lfo_depth" ); + } + + // change_cutoff_lfo_freq() function + + VMFnResult* InstrumentScriptVMFunction_change_cutoff_lfo_freq::exec(VMFnArgs* args) { + return VMChangeSynthParamFunction::execTemplate< + &NoteBase::_Override::CutoffLFOFreq, + Event::synth_param_cutoff_lfo_freq, + true, 1000000, 0>( args, "change_cutoff_lfo_freq" ); + } + // change_pitch_lfo_depth() function VMFnResult* InstrumentScriptVMFunction_change_pitch_lfo_depth::exec(VMFnArgs* args) { @@ -1248,16 +1303,16 @@ // template for change_*_curve() functions - bool VMChangeFadeCurveFunction::acceptsArgType(int iArg, ExprType_t type) const { + bool VMChangeFadeCurveFunction::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else return type == INT_EXPR; } - template + template VMFnResult* VMChangeFadeCurveFunction::execTemplate(VMFnArgs* args, const char* functionName) { - int value = args->arg(1)->asInt()->evalInt(); + vmint value = args->arg(1)->asInt()->evalInt(); switch (value) { case FADE_CURVE_LINEAR: case FADE_CURVE_EASE_IN_EASE_OUT: @@ -1302,7 +1357,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1362,7 +1417,7 @@ { } - bool InstrumentScriptVMFunction_fade_in::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_fade_in::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -1370,7 +1425,7 @@ } VMFnResult* InstrumentScriptVMFunction_fade_in::exec(VMFnArgs* args) { - int duration = args->arg(1)->asInt()->evalInt(); + vmint duration = args->arg(1)->asInt()->evalInt(); if (duration < 0) { wrnMsg("fade_in(): argument 2 may not be negative"); duration = 0; @@ -1429,7 +1484,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1482,7 +1537,7 @@ { } - bool InstrumentScriptVMFunction_fade_out::acceptsArgType(int iArg, ExprType_t type) const { + bool InstrumentScriptVMFunction_fade_out::acceptsArgType(vmint iArg, ExprType_t type) const { if (iArg == 0) return type == INT_EXPR || type == INT_ARR_EXPR; else @@ -1490,7 +1545,7 @@ } VMFnResult* InstrumentScriptVMFunction_fade_out::exec(VMFnArgs* args) { - int duration = args->arg(1)->asInt()->evalInt(); + vmint duration = args->arg(1)->asInt()->evalInt(); if (duration < 0) { wrnMsg("fade_out(): argument 2 may not be negative"); duration = 0; @@ -1561,7 +1616,7 @@ } } else if (args->arg(0)->exprType() == INT_ARR_EXPR) { VMIntArrayExpr* ids = args->arg(0)->asIntArray(); - for (int i = 0; i < ids->arraySize(); ++i) { + for (vmint i = 0; i < ids->arraySize(); ++i) { const ScriptID id = ids->evalIntElement(i); if (!id || !id.isNoteID()) continue; @@ -1644,7 +1699,7 @@ return successResult(0); } - const int parameter = args->arg(1)->asInt()->evalInt(); + const vmint parameter = args->arg(1)->asInt()->evalInt(); switch (parameter) { case EVENT_PAR_NOTE: return successResult(pNote->cause.Param.Note.Key); @@ -1696,8 +1751,8 @@ NoteBase* pNote = pEngineChannel->pEngine->NoteByID( id.noteID() ); if (!pNote) return successResult(); - const int parameter = args->arg(1)->asInt()->evalInt(); - const int value = args->arg(2)->asInt()->evalInt(); + const vmint parameter = args->arg(1)->asInt()->evalInt(); + const vmint value = args->arg(2)->asInt()->evalInt(); switch (parameter) { case EVENT_PAR_NOTE: @@ -1772,7 +1827,7 @@ NoteBase* pNote = pEngineChannel->pEngine->NoteByID( id.noteID() ); if (!pNote) return successResult(); - const int value = args->arg(1)->asInt()->evalInt(); + const vmint value = args->arg(1)->asInt()->evalInt(); if (value < 0 || value > 127) { wrnMsg("change_note(): note number of argument 2 is out of range"); return successResult(); @@ -1812,7 +1867,7 @@ NoteBase* pNote = pEngineChannel->pEngine->NoteByID( id.noteID() ); if (!pNote) return successResult(); - const int value = args->arg(1)->asInt()->evalInt(); + const vmint value = args->arg(1)->asInt()->evalInt(); if (value < 0 || value > 127) { wrnMsg("change_velo(): velocity of argument 2 is out of range"); return successResult(); @@ -1846,7 +1901,7 @@ return successResult(); } - const int pos = args->arg(1)->asInt()->evalInt(); + const vmint pos = args->arg(1)->asInt()->evalInt(); if (pos < 0) { wrnMsg("change_play_pos(): playback position of argument 2 may not be negative"); return successResult(); @@ -1858,7 +1913,8 @@ NoteBase* pNote = pEngineChannel->pEngine->NoteByID( id.noteID() ); if (!pNote) return successResult(); - pNote->Override.SampleOffset = pos; + pNote->Override.SampleOffset = + (decltype(pNote->Override.SampleOffset)) pos; return successResult(); } @@ -2005,7 +2061,7 @@ // if we are here, then this is the parent, so we must fork this parent - const int n = + const vmint n = (args->argsCount() >= 1) ? args->arg(0)->asInt()->evalInt() : 1; const bool bAutoAbort = (args->argsCount() >= 2) ? args->arg(1)->asInt()->evalInt() : true; @@ -2031,9 +2087,9 @@ return errorResult(-1); // terminate script } // since both parent, as well all child script execution instances - // all land in this exect() method, the following is (more or less) + // all land in this exec() method, the following is (more or less) // the only feature that lets us distinguish the parent and - // respective children from each other in this exect() method + // respective children from each other in this exec() method itChild->forkIndex = iChild + 1; }