/[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 2597 by schoenebeck, Thu Jun 5 19:39:12 2014 UTC revision 2598 by schoenebeck, Fri Jun 6 12:38:54 2014 UTC
# Line 26  namespace LinuxSampler { Line 26  namespace LinuxSampler {
26    
27          if (note < 0 || note > 127) {          if (note < 0 || note > 127) {
28              errMsg("play_note(): argument 1 is an invalid note number");              errMsg("play_note(): argument 1 is an invalid note number");
29              return errorResult();              return errorResult(-1);
30          }          }
31    
32          if (velocity < 0 || velocity > 127) {          if (velocity < 0 || velocity > 127) {
33              errMsg("play_note(): argument 2 is an invalid velocity value");              errMsg("play_note(): argument 2 is an invalid velocity value");
34              return errorResult();              return errorResult(-1);
35          }          }
36    
37          if (sampleoffset < 0) {          if (sampleoffset < 0) {
38              errMsg("play_note(): argument 3 may not be a negative sample offset");              errMsg("play_note(): argument 3 may not be a negative sample offset");
39              return errorResult();              return errorResult(-1);
40          } else if (sampleoffset != 0) {          } else if (sampleoffset != 0) {
41              wrnMsg("play_note(): argument 3 does not support a sample offset other than 0 yet");              wrnMsg("play_note(): argument 3 does not support a sample offset other than 0 yet");
42          }          }
43    
44          if (duration < -1) {          if (duration < -1) {
45              errMsg("play_note(): argument 4 must be a duration value of at least -1 or higher");              errMsg("play_note(): argument 4 must be a duration value of at least -1 or higher");
46              return errorResult();              return errorResult(-1);
47          } else if (duration == -1) {          } else if (duration == -1) {
48              wrnMsg("play_note(): argument 4 does not support special value -1 as duration yet");              wrnMsg("play_note(): argument 4 does not support special value -1 as duration yet");
49          } else if (duration != 0) {          } else if (duration != 0) {
# Line 58  namespace LinuxSampler { Line 58  namespace LinuxSampler {
58          e.Param.Note.Key = note;          e.Param.Note.Key = note;
59          e.Param.Note.Velocity = velocity;          e.Param.Note.Velocity = velocity;
60    
61          pEngineChannel->ScheduleEvent(&e, duration);          int id = pEngineChannel->ScheduleEvent(&e, duration);
62    
63            return successResult(id);
64        }
65    
66        InstrumentScriptVMFunction_ignore_event::InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent)
67            : m_vm(parent)
68        {
69        }
70    
71        VMFnResult* InstrumentScriptVMFunction_ignore_event::exec(VMFnArgs* args) {
72            int id = args->arg(0)->asInt()->evalInt();
73            if (id < 0) {
74                wrnMsg("ignore_event(): argument may not be a negative event ID");
75                return successResult();
76            }
77    
78            AbstractEngineChannel* pEngineChannel =
79                static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel);
80    
81            pEngineChannel->IgnoreEvent(id);
82    
83            return successResult();
84        }
85    
86        InstrumentScriptVMFunction_ignore_controller::InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent)
87            : m_vm(parent)
88        {
89        }
90    
91        VMFnResult* InstrumentScriptVMFunction_ignore_controller::exec(VMFnArgs* args) {
92            int id = (args->argsCount() >= 1) ? args->arg(0)->asInt()->evalInt() : m_vm->m_event->id;
93            if (id < 0) {
94                wrnMsg("ignore_controller(): argument may not be a negative event ID");
95                return successResult();
96            }
97    
98            AbstractEngineChannel* pEngineChannel =
99                static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel);
100    
101            pEngineChannel->IgnoreEvent(id);
102    
103          return successResult();          return successResult();
104      }      }

Legend:
Removed from v.2597  
changed lines
  Added in v.2598

  ViewVC Help
Powered by ViewVC