/[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 2598 by schoenebeck, Fri Jun 6 12:38:54 2014 UTC revision 2600 by schoenebeck, Sat Jun 7 00:16:03 2014 UTC
# Line 57  namespace LinuxSampler { Line 57  namespace LinuxSampler {
57          e.Type = Event::type_note_on;          e.Type = Event::type_note_on;
58          e.Param.Note.Key = note;          e.Param.Note.Key = note;
59          e.Param.Note.Velocity = velocity;          e.Param.Note.Velocity = velocity;
60            e.Format = {}; // init format speific stuff with zero
61    
62          int id = pEngineChannel->ScheduleEvent(&e, duration);          int id = pEngineChannel->ScheduleEvent(&e, duration);
63    
64          return successResult(id);          return successResult(id);
65      }      }
66    
67        InstrumentScriptVMFunction_set_controller::InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent)
68            : m_vm(parent)
69        {
70        }
71    
72        VMFnResult* InstrumentScriptVMFunction_set_controller::exec(VMFnArgs* args) {
73            int controller = args->arg(0)->asInt()->evalInt();
74            int value      = args->arg(1)->asInt()->evalInt();
75    
76            AbstractEngineChannel* pEngineChannel =
77                static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel);
78    
79            Event e = m_vm->m_event->cause;
80            e.Format = {}; // init format speific stuff with zero
81            if (controller == CTRL_TABLE_IDX_AFTERTOUCH) {
82                e.Type = Event::type_channel_pressure;
83                e.Param.ChannelPressure.Value = value & 127;
84            } else if (controller == CTRL_TABLE_IDX_PITCHBEND) {
85                e.Type = Event::type_pitchbend;
86                e.Param.Pitch.Pitch = value;
87            } else if (controller >= 0 && controller <= 127) {
88                e.Type = Event::type_control_change;
89                e.Param.CC.Controller = controller;
90                e.Param.CC.Value = value;
91            } else {
92                errMsg("set_controller(): argument 1 is an invalid controller");
93                return errorResult();
94            }
95    
96            int id = pEngineChannel->ScheduleEvent(&e, 0);
97    
98            return successResult(id);
99        }    
100    
101      InstrumentScriptVMFunction_ignore_event::InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent)      InstrumentScriptVMFunction_ignore_event::InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent)
102          : m_vm(parent)          : m_vm(parent)
103      {      {

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

  ViewVC Help
Powered by ViewVC