1 |
/* |
/* |
2 |
* Copyright (c) 2014 Christian Schoenebeck |
* Copyright (c) 2014-2016 Christian Schoenebeck |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
46 |
return errorResult(-1); |
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"); |
|
} else if (duration != 0) { |
|
|
wrnMsg("play_note(): argument 4 does not support any other value as 0 as duration yet"); |
|
49 |
} |
} |
50 |
|
|
51 |
AbstractEngineChannel* pEngineChannel = |
AbstractEngineChannel* pEngineChannel = |
55 |
e.Type = Event::type_note_on; |
e.Type = Event::type_note_on; |
56 |
e.Param.Note.Key = note; |
e.Param.Note.Key = note; |
57 |
e.Param.Note.Velocity = velocity; |
e.Param.Note.Velocity = velocity; |
58 |
memset(&e.Format, 0, sizeof(e.Format)); // init format speific stuff with zero |
memset(&e.Format, 0, sizeof(e.Format)); // init format specific stuff with zero |
59 |
|
|
60 |
|
int id = pEngineChannel->ScheduleEventMicroSec(&e, 0); |
61 |
|
|
62 |
int id = pEngineChannel->ScheduleEvent(&e, duration); |
// if a duration is supplied, then schedule a subsequent note-ff event |
63 |
|
if (duration > 0) { |
64 |
|
e.Type = Event::type_note_off; |
65 |
|
e.Param.Note.Velocity = 127; |
66 |
|
pEngineChannel->ScheduleEventMicroSec(&e, duration); |
67 |
|
} |
68 |
|
|
69 |
return successResult(id); |
return successResult(id); |
70 |
} |
} |
98 |
return errorResult(); |
return errorResult(); |
99 |
} |
} |
100 |
|
|
101 |
int id = pEngineChannel->ScheduleEvent(&e, 0); |
int id = pEngineChannel->ScheduleEventMicroSec(&e, 0); |
102 |
|
|
103 |
return successResult(id); |
return successResult(id); |
104 |
} |
} |
188 |
e.Param.Note.Velocity = velocity; |
e.Param.Note.Velocity = velocity; |
189 |
memset(&e.Format, 0, sizeof(e.Format)); // init format speific stuff with zero |
memset(&e.Format, 0, sizeof(e.Format)); // init format speific stuff with zero |
190 |
|
|
191 |
int releaseEventID = pEngineChannel->ScheduleEvent(&e, 0); |
int releaseEventID = pEngineChannel->ScheduleEventMicroSec(&e, 0); |
192 |
} else if (args->arg(0)->exprType() == INT_ARR_EXPR) { |
} else if (args->arg(0)->exprType() == INT_ARR_EXPR) { |
193 |
VMIntArrayExpr* ids = args->arg(0)->asIntArray(); |
VMIntArrayExpr* ids = args->arg(0)->asIntArray(); |
194 |
for (int i = 0; i < ids->arraySize(); ++i) { |
for (int i = 0; i < ids->arraySize(); ++i) { |
202 |
e.Param.Note.Velocity = velocity; |
e.Param.Note.Velocity = velocity; |
203 |
memset(&e.Format, 0, sizeof(e.Format)); // init format speific stuff with zero |
memset(&e.Format, 0, sizeof(e.Format)); // init format speific stuff with zero |
204 |
|
|
205 |
int releaseEventID = pEngineChannel->ScheduleEvent(&e, 0); |
int releaseEventID = pEngineChannel->ScheduleEventMicroSec(&e, 0); |
206 |
} |
} |
207 |
} |
} |
208 |
|
|