/[svn]/linuxsampler/trunk/src/engines/EngineBase.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/EngineBase.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2938 by schoenebeck, Mon Jul 11 17:10:40 2016 UTC revision 3034 by schoenebeck, Mon Oct 31 00:05:00 2016 UTC
# Line 58  namespace LinuxSampler { Line 58  namespace LinuxSampler {
58              typedef typename RTList<RR*>::Iterator RootRegionIterator;              typedef typename RTList<RR*>::Iterator RootRegionIterator;
59              typedef typename MidiKeyboardManager<V>::MidiKey MidiKey;              typedef typename MidiKeyboardManager<V>::MidiKey MidiKey;
60                            
61              EngineBase() : SuspendedRegions(128), noteIDPool(GLOBAL_MAX_NOTES) {              EngineBase() : noteIDPool(GLOBAL_MAX_NOTES), SuspendedRegions(128) {
62                  pDiskThread          = NULL;                  pDiskThread          = NULL;
63                  pNotePool            = new Pool< Note<V> >(GLOBAL_MAX_NOTES);                  pNotePool            = new Pool< Note<V> >(GLOBAL_MAX_NOTES);
64                  pNotePool->setPoolElementIDsReservedBits(INSTR_SCRIPT_EVENT_ID_RESERVED_BITS);                  pNotePool->setPoolElementIDsReservedBits(INSTR_SCRIPT_EVENT_ID_RESERVED_BITS);
# Line 163  namespace LinuxSampler { Line 163  namespace LinuxSampler {
163                                  dmsg(5,("Engine: Sysex received\n"));                                  dmsg(5,("Engine: Sysex received\n"));
164                                  ProcessSysex(itEvent);                                  ProcessSysex(itEvent);
165                                  break;                                  break;
166                                default: ; // noop
167                          }                          }
168                      }                      }
169                  }                  }
# Line 689  namespace LinuxSampler { Line 690  namespace LinuxSampler {
690                  NoteIterator itNewNote = pNotePool->allocAppend();                  NoteIterator itNewNote = pNotePool->allocAppend();
691                  const note_id_t newNoteID = pNotePool->getID(itNewNote);                  const note_id_t newNoteID = pNotePool->getID(itNewNote);
692    
693                    // remember the engine's time when this note was triggered exactly
694                    itNewNote->triggerSchedTime = pNoteOnEvent->SchedTime();
695    
696                  // usually the new note (and its subsequent voices) will be                  // usually the new note (and its subsequent voices) will be
697                  // allocated on the key provided by the event's note number,                  // allocated on the key provided by the event's note number,
698                  // however if this new note is requested not to be a regular                  // however if this new note is requested not to be a regular
# Line 795  namespace LinuxSampler { Line 799  namespace LinuxSampler {
799                              case Event::type_note_pressure:                              case Event::type_note_pressure:
800                                  //TODO: ...                                  //TODO: ...
801                                  break;                                  break;
802    
803                                case Event::type_sysex:
804                                    //TODO: ...
805                                    break;
806    
807                                case Event::type_cancel_release_key:
808                                case Event::type_release_key:
809                                case Event::type_release_note:
810                                case Event::type_play_note:
811                                case Event::type_stop_note:
812                                case Event::type_note_synth_param:
813                                    break; // noop
814                          }                          }
815    
816                          // see HACK comment above                          // see HACK comment above
# Line 885  namespace LinuxSampler { Line 901  namespace LinuxSampler {
901                                  dmsg(5,("Engine: Note Synth Param received\n"));                                  dmsg(5,("Engine: Note Synth Param received\n"));
902                                  ProcessNoteSynthParam(itEvent->pEngineChannel, itEvent);                                  ProcessNoteSynthParam(itEvent->pEngineChannel, itEvent);
903                                  break;                                  break;
904                                case Event::type_sysex:
905                                    break; // TODO ...
906    
907                                case Event::type_cancel_release_key:
908                                case Event::type_release_key:
909                                case Event::type_release_note:
910                                    break; // noop
911                          }                          }
912                      }                      }
913                  }                  }
# Line 987  namespace LinuxSampler { Line 1010  namespace LinuxSampler {
1010                  itScriptEvent->cause = *itEvent;                  itScriptEvent->cause = *itEvent;
1011                  itScriptEvent->currentHandler = 0;                  itScriptEvent->currentHandler = 0;
1012                  itScriptEvent->executionSlices = 0;                  itScriptEvent->executionSlices = 0;
1013                    itScriptEvent->ignoreAllWaitCalls = false;
1014                    itScriptEvent->handlerType = pEventHandler->eventHandlerType();
1015                  // this is the native representation of the $EVENT_ID script variable                  // this is the native representation of the $EVENT_ID script variable
1016                  itScriptEvent->id =                  itScriptEvent->id =
1017                      (itEvent->Type == Event::type_note_on)                      (itEvent->Type == Event::type_note_on)
# Line 1254  namespace LinuxSampler { Line 1279  namespace LinuxSampler {
1279                          // the script's "init" event handler is only executed                          // the script's "init" event handler is only executed
1280                          // once (when the script is loaded or reloaded)                          // once (when the script is loaded or reloaded)
1281                          if (pEngineChannel->pScript && pEngineChannel->pScript->handlerInit) {                          if (pEngineChannel->pScript && pEngineChannel->pScript->handlerInit) {
1282                                dmsg(5,("Engine: exec handlerInit %p\n", pEngineChannel->pScript->handlerInit));
1283                              RTList<ScriptEvent>::Iterator itScriptEvent =                              RTList<ScriptEvent>::Iterator itScriptEvent =
1284                                  pEngineChannel->pScript->pEvents->allocAppend();                                  pEngineChannel->pScript->pEvents->allocAppend();
1285    
1286                              itScriptEvent->cause.pEngineChannel = pEngineChannel;                              itScriptEvent->cause.pEngineChannel = pEngineChannel;
1287                              itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit;                              itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit;
1288                              itScriptEvent->handlers[1] = NULL;                              itScriptEvent->handlers[1] = NULL;
1289                                itScriptEvent->currentHandler = 0;
1290                                itScriptEvent->executionSlices = 0;
1291                                itScriptEvent->ignoreAllWaitCalls = false;
1292                                itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT;
1293    
1294                              VMExecStatus_t res = pScriptVM->exec(                              /*VMExecStatus_t res = */ pScriptVM->exec(
1295                                  pEngineChannel->pScript->parserContext, &*itScriptEvent                                  pEngineChannel->pScript->parserContext, &*itScriptEvent
1296                              );                              );
1297    
# Line 1914  namespace LinuxSampler { Line 1944  namespace LinuxSampler {
1944               * @param pEngineChannel - engine channel on which this event occurred on               * @param pEngineChannel - engine channel on which this event occurred on
1945               * @param itEvent - note synthesis parameter change event               * @param itEvent - note synthesis parameter change event
1946               */               */
1947              virtual void ProcessNoteSynthParam(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) OVERRIDE {              virtual void ProcessNoteSynthParam(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) {
1948                  EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel);                  EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel);
1949    
1950                  NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID );                  NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID );
# Line 1952  namespace LinuxSampler { Line 1982  namespace LinuxSampler {
1982                      case Event::synth_param_resonance:                      case Event::synth_param_resonance:
1983                          pNote->Override.Resonance = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta;                          pNote->Override.Resonance = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta;
1984                          break;                          break;
1985                        case Event::synth_param_attack:
1986                            pNote->Override.Attack = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta;
1987                            break;
1988                        case Event::synth_param_decay:
1989                            pNote->Override.Decay = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta;
1990                            break;
1991                        case Event::synth_param_release:
1992                            pNote->Override.Release = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta;
1993                            break;
1994                  }                  }
1995    
1996                  // move note parameter event to its MIDI key                  // move note parameter event to its MIDI key

Legend:
Removed from v.2938  
changed lines
  Added in v.3034

  ViewVC Help
Powered by ViewVC