/[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 2630 by schoenebeck, Fri Jun 13 15:01:06 2014 UTC revision 2871 by schoenebeck, Sun Apr 10 18:22:23 2016 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014 Christian Schoenebeck   * Copyright (c) 2014-2016 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 46  namespace LinuxSampler { Line 46  namespace LinuxSampler {
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 =
# Line 57  namespace LinuxSampler { Line 55  namespace LinuxSampler {
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      }      }
# Line 93  namespace LinuxSampler { Line 98  namespace LinuxSampler {
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      }          }    
# Line 183  namespace LinuxSampler { Line 188  namespace LinuxSampler {
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) {
# Line 197  namespace LinuxSampler { Line 202  namespace LinuxSampler {
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    

Legend:
Removed from v.2630  
changed lines
  Added in v.2871

  ViewVC Help
Powered by ViewVC