/[svn]/linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3293 by schoenebeck, Tue Jun 27 22:19:19 2017 UTC revision 3316 by schoenebeck, Thu Jul 20 12:05:53 2017 UTC
# Line 838  namespace LinuxSampler { Line 838  namespace LinuxSampler {
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          }          }
# Line 925  namespace LinuxSampler { Line 924  namespace LinuxSampler {
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          }          }
# Line 1012  namespace LinuxSampler { Line 1010  namespace LinuxSampler {
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          }          }
# Line 1177  namespace LinuxSampler { Line 1174  namespace LinuxSampler {
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, 1000000, 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) {
# Line 1865  namespace LinuxSampler { Line 1871  namespace LinuxSampler {
1871          return successResult(pNote ? EVENT_STATUS_NOTE_QUEUE : EVENT_STATUS_INACTIVE);          return successResult(pNote ? EVENT_STATUS_NOTE_QUEUE : EVENT_STATUS_INACTIVE);
1872      }      }
1873    
1874        // callback_status() function
1875    
1876        InstrumentScriptVMFunction_callback_status::InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent)
1877            : m_vm(parent)
1878        {
1879        }
1880    
1881        VMFnResult* InstrumentScriptVMFunction_callback_status::exec(VMFnArgs* args) {
1882            const script_callback_id_t id = args->arg(0)->asInt()->evalInt();
1883            if (!id) {
1884                wrnMsg("callback_status(): callback ID for argument 1 may not be zero");
1885                return successResult();
1886            }
1887    
1888            AbstractEngineChannel* pEngineChannel =
1889                static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel);
1890    
1891            RTList<ScriptEvent>::Iterator itCallback = pEngineChannel->ScriptCallbackByID(id);
1892            if (!itCallback)
1893                return successResult(CALLBACK_STATUS_TERMINATED);
1894    
1895            return successResult(
1896                (m_vm->m_event->execCtx == itCallback->execCtx) ?
1897                    CALLBACK_STATUS_RUNNING : CALLBACK_STATUS_QUEUE
1898            );
1899        }
1900    
1901      // wait() function (overrides core wait() implementation)      // wait() function (overrides core wait() implementation)
1902    
1903      InstrumentScriptVMFunction_wait::InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent)      InstrumentScriptVMFunction_wait::InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent)

Legend:
Removed from v.3293  
changed lines
  Added in v.3316

  ViewVC Help
Powered by ViewVC