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

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

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

revision 2878 by schoenebeck, Sun Apr 10 18:22:23 2016 UTC revision 2879 by schoenebeck, Tue Apr 19 14:07:53 2016 UTC
# Line 50  namespace LinuxSampler { Line 50  namespace LinuxSampler {
50      };      };
51    
52      template<class V>      template<class V>
53      class VoicePool {      class NotePool {
54          public:          public:
55              virtual Pool<V>* GetVoicePool() = 0;              virtual Pool<V>* GetVoicePool() = 0;
56                virtual Pool< Note<V> >* GetNotePool() = 0;
57                virtual Pool<note_id_t>* GetNodeIDPool() = 0;
58      };      };
59    
60      template <class V /* Voice */, class R /* Region */, class I /* Instrument */>      template <class V /* Voice */, class R /* Region */, class I /* Instrument */>
# Line 163  namespace LinuxSampler { Line 165  namespace LinuxSampler {
165                      bStatusChanged = true;                      bStatusChanged = true;
166                  }                  }
167    
168                  VoicePool<V>* pVoicePool = dynamic_cast<VoicePool<V>*>(pEngine);                  NotePool<V>* pNotePool = dynamic_cast<NotePool<V>*>(pEngine);
169                  MidiKeyboardManager<V>::AllocateActiveVoices(pVoicePool->GetVoicePool());                  MidiKeyboardManager<V>::AllocateActiveNotesLists(
170                  MidiKeyboardManager<V>::AllocateEvents(pEngine->pEventPool);                      pNotePool->GetNotePool(),
171                        pNotePool->GetVoicePool()
172                    );
173                    MidiKeyboardManager<V>::AllocateEventsLists(pEngine->pEventPool);
174    
175                  AudioDeviceChannelLeft  = 0;                  AudioDeviceChannelLeft  = 0;
176                  AudioDeviceChannelRight = 1;                  AudioDeviceChannelRight = 1;
# Line 206  namespace LinuxSampler { Line 211  namespace LinuxSampler {
211                          delayedEvents.pList = NULL;                          delayedEvents.pList = NULL;
212                      }                      }
213    
214                      MidiKeyboardManager<V>::DeleteActiveVoices();                      MidiKeyboardManager<V>::DeleteActiveNotesLists();
215                      MidiKeyboardManager<V>::DeleteEvents();                      MidiKeyboardManager<V>::DeleteEventsLists();
216                      DeleteGroupEventLists();                      DeleteGroupEventLists();
217    
218                      AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;                      AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;
# Line 294  namespace LinuxSampler { Line 299  namespace LinuxSampler {
299                  SetDiskStreamCount(handler.StreamCount);                  SetDiskStreamCount(handler.StreamCount);
300              }              }
301    
302                /**
303                 * Called by real-time instrument script functions to schedule a
304                 * new note (new note-on event and a new @c Note object linked to it)
305                 * @a delay microseconds in future.
306                 *
307                 * @b IMPORTANT: for the supplied @a delay to be scheduled
308                 * correctly, the passed @a pEvent must be assigned a valid
309                 * fragment time within the current audio fragment boundaries. That
310                 * fragment time will be used by this method as basis for
311                 * interpreting what "now" acutally is, and thus it will be used as
312                 * basis for calculating the precise scheduling time for @a delay.
313                 * The easiest way to achieve this is by copying a recent event
314                 * which happened within the current audio fragment cycle: i.e. the
315                 * original event which caused calling this method here, or by using
316                 * Event::copyTimefrom() method to only copy the time, without any
317                 * other event data.
318                 *
319                 * @param pEvent - note-on event to be scheduled in future (event
320                 *                 data will be copied)
321                 * @param delay - amount of microseconds in future (from now) when
322                 *                event shall be processed
323                 * @returns unique note ID of scheduled new note, or NULL on error
324                 */
325                note_id_t ScheduleNoteMicroSec(const Event* pEvent, int delay) OVERRIDE {
326                    // add (copied) note-on event into scheduler queue
327                    const event_id_t noteOnEventID = ScheduleEventMicroSec(pEvent, delay);
328                    if (!noteOnEventID) return 0; // error
329                    // get access to (copied) event on the scheduler queue
330                    RTList<Event>::Iterator itEvent = pEvents->fromID(noteOnEventID);
331                    // stick a new note to the (copied) event on the queue
332                    const note_id_t noteID = pEngine->LaunchNewNote(this, &*itEvent);
333                    return noteID;
334                }
335    
336              RTList<R*>* pRegionsInUse;     ///< temporary pointer into the instrument change command, used by the audio thread              RTList<R*>* pRegionsInUse;     ///< temporary pointer into the instrument change command, used by the audio thread
337              I* pInstrument;              I* pInstrument;
338    

Legend:
Removed from v.2878  
changed lines
  Added in v.2879

  ViewVC Help
Powered by ViewVC