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 |
{ |
{ |