/[svn]/linuxsampler/trunk/src/engines/gig/Engine.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/Engine.cpp

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

revision 924 by schoenebeck, Sat Oct 21 14:13:09 2006 UTC revision 1348 by schoenebeck, Fri Sep 14 14:45:11 2007 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005-2007 Christian Schoenebeck                        *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 51  namespace LinuxSampler { namespace gig { Line 51  namespace LinuxSampler { namespace gig {
51          if (engines.count(pDevice)) {          if (engines.count(pDevice)) {
52              dmsg(4,("Using existing gig::Engine.\n"));              dmsg(4,("Using existing gig::Engine.\n"));
53              pEngine = engines[pDevice];              pEngine = engines[pDevice];
54    
55                // Disable the engine while the new engine channel is
56                // added and initialized. The engine will be enabled again
57                // in EngineChannel::Connect.
58                pEngine->DisableAndLock();
59          } else { // create a new engine (and disk thread) instance for the given audio output device          } else { // create a new engine (and disk thread) instance for the given audio output device
60              dmsg(4,("Creating new gig::Engine.\n"));              dmsg(4,("Creating new gig::Engine.\n"));
61              pEngine = (Engine*) EngineFactory::Create("gig");              pEngine = (Engine*) EngineFactory::Create("gig");
# Line 93  namespace LinuxSampler { namespace gig { Line 98  namespace LinuxSampler { namespace gig {
98      /**      /**
99       * Constructor       * Constructor
100       */       */
101      Engine::Engine() {      Engine::Engine() : SuspendedRegions(128) {
102          pAudioOutputDevice = NULL;          pAudioOutputDevice = NULL;
103          pDiskThread        = NULL;          pDiskThread        = NULL;
104          pEventGenerator    = NULL;          pEventGenerator    = NULL;
105          pSysexBuffer       = new RingBuffer<uint8_t>(CONFIG_SYSEX_BUFFER_SIZE, 0);          pSysexBuffer       = new RingBuffer<uint8_t,false>(CONFIG_SYSEX_BUFFER_SIZE, 0);
106          pEventQueue        = new RingBuffer<Event>(CONFIG_MAX_EVENTS_PER_FRAGMENT, 0);          pEventQueue        = new RingBuffer<Event,false>(CONFIG_MAX_EVENTS_PER_FRAGMENT, 0);
107          pEventPool         = new Pool<Event>(CONFIG_MAX_EVENTS_PER_FRAGMENT);          pEventPool         = new Pool<Event>(CONFIG_MAX_EVENTS_PER_FRAGMENT);
108          pVoicePool         = new Pool<Voice>(CONFIG_MAX_VOICES);          pVoicePool         = new Pool<Voice>(CONFIG_MAX_VOICES);
109            pDimRegionsInUse   = new ::gig::DimensionRegion*[CONFIG_MAX_VOICES + 1];
110          pVoiceStealingQueue = new RTList<Event>(pEventPool);          pVoiceStealingQueue = new RTList<Event>(pEventPool);
111          pGlobalEvents      = new RTList<Event>(pEventPool);          pGlobalEvents      = new RTList<Event>(pEventPool);
112            InstrumentChangeQueue      = new RingBuffer<instrument_change_command_t,false>(1, 0);
113            InstrumentChangeReplyQueue = new RingBuffer<instrument_change_reply_t,false>(1, 0);
114    
115          for (RTList<Voice>::Iterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {          for (RTList<Voice>::Iterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {
116              iterVoice->SetEngine(this);              iterVoice->SetEngine(this);
117          }          }
# Line 110  namespace LinuxSampler { namespace gig { Line 119  namespace LinuxSampler { namespace gig {
119    
120          ResetInternal();          ResetInternal();
121          ResetScaleTuning();          ResetScaleTuning();
122            ResetSuspendedRegions();
123      }      }
124    
125      /**      /**
# Line 132  namespace LinuxSampler { namespace gig { Line 142  namespace LinuxSampler { namespace gig {
142          if (pEventGenerator) delete pEventGenerator;          if (pEventGenerator) delete pEventGenerator;
143          if (pVoiceStealingQueue) delete pVoiceStealingQueue;          if (pVoiceStealingQueue) delete pVoiceStealingQueue;
144          if (pSysexBuffer) delete pSysexBuffer;          if (pSysexBuffer) delete pSysexBuffer;
145          EngineFactory::Destroy(this);          if (pGlobalEvents) delete pGlobalEvents;
146            if (InstrumentChangeQueue) delete InstrumentChangeQueue;
147            if (InstrumentChangeReplyQueue) delete InstrumentChangeReplyQueue;
148            if (pDimRegionsInUse) delete[] pDimRegionsInUse;
149            ResetSuspendedRegions();
150            Unregister();
151      }      }
152    
153      void Engine::Enable() {      void Engine::Enable() {
# Line 141  namespace LinuxSampler { namespace gig { Line 156  namespace LinuxSampler { namespace gig {
156          dmsg(3,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe()));          dmsg(3,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe()));
157      }      }
158    
159        /**
160         * Temporarily stop the engine to not do anything. The engine will just be
161         * frozen during that time, that means after enabling it again it will
162         * continue where it was, with all its voices and playback state it had at
163         * the point of disabling. Notice that the engine's (audio) thread will
164         * continue to run, it just remains in an inactive loop during that time.
165         *
166         * If you need to be sure that all voices and disk streams are killed as
167         * well, use @c SuspendAll() instead.
168         *
169         * @see Enable(), SuspendAll()
170         */
171      void Engine::Disable() {      void Engine::Disable() {
172          dmsg(3,("gig::Engine: disabling\n"));          dmsg(3,("gig::Engine: disabling\n"));
173          bool* pWasDisabled = EngineDisabled.PushAndUnlock(true, 2); // wait max. 2s          bool* pWasDisabled = EngineDisabled.PushAndUnlock(true, 2); // wait max. 2s
# Line 154  namespace LinuxSampler { namespace gig { Line 181  namespace LinuxSampler { namespace gig {
181      }      }
182    
183      /**      /**
184         * Similar to @c Disable() but this method additionally kills all voices
185         * and disk streams and blocks until all voices and disk streams are actually
186         * killed / deleted.
187         *
188         * @e Note: only the original calling thread is able to re-enable the
189         * engine afterwards by calling @c ResumeAll() later on!
190         */
191        void Engine::SuspendAll() {
192            dmsg(1,("gig::Engine: Suspending all ...\n"));
193            // stop the engine, so we can safely modify the engine's
194            // data structures from this foreign thread
195            DisableAndLock();
196            // we could also use the respective class member variable here,
197            // but this is probably safer and cleaner
198            int iPendingStreamDeletions = 0;
199            // kill all voices on all engine channels the *die hard* way
200            for (int iChannel = 0; iChannel < engineChannels.size(); iChannel++) {
201                EngineChannel* pEngineChannel = engineChannels[iChannel];
202                RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
203                RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();
204                for (; iuiKey != end; ++iuiKey) { // iterate through all active keys
205                    midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[*iuiKey];
206                    RTList<Voice>::Iterator itVoice = pKey->pActiveVoices->first();
207                    RTList<Voice>::Iterator itVoicesEnd = pKey->pActiveVoices->end();
208                    for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key
209                        // request a notification from disk thread side for stream deletion
210                        const Stream::Handle hStream = itVoice->KillImmediately(true);
211                        if (hStream != Stream::INVALID_HANDLE) { // voice actually used a stream
212                            iPendingStreamDeletions++;
213                        }
214                    }
215                }
216            }
217            // wait until all streams were actually deleted by the disk thread
218            while (iPendingStreamDeletions) {
219                while (
220                    iPendingStreamDeletions &&
221                    pDiskThread->AskForDeletedStream() != Stream::INVALID_HANDLE
222                ) iPendingStreamDeletions--;
223                if (!iPendingStreamDeletions) break;
224                usleep(10000); // sleep for 10ms
225            }
226            dmsg(1,("gig::Engine: Everything suspended.\n"));
227        }
228    
229        /**
230         * At the moment same as calling @c Enable() directly, but this might
231         * change in future, so better call this method as counterpart to
232         * @c SuspendAll() instead of @c Enable() !
233         */
234        void Engine::ResumeAll() {
235            Enable();
236        }
237    
238        /**
239         * Order the engine to stop rendering audio for the given region.
240         * Additionally this method will block until all voices and their disk
241         * streams associated with that region are actually killed / deleted, so
242         * one can i.e. safely modify the region with an instrument editor after
243         * returning from this method.
244         *
245         * @param pRegion - region the engine shall stop using
246         */
247        void Engine::Suspend(::gig::Region* pRegion) {
248            dmsg(1,("gig::Engine: Suspending Region %x ...\n",pRegion));
249            SuspendedRegionsMutex.Lock();
250            SuspensionChangeOngoing.Set(true);
251            pPendingRegionSuspension = pRegion;
252            SuspensionChangeOngoing.WaitAndUnlockIf(true);
253            SuspendedRegionsMutex.Unlock();
254            dmsg(1,("gig::Engine: Region %x suspended.",pRegion));
255        }
256    
257        /**
258         * Orders the engine to resume playing back the given region, previously
259         * suspended with @c Suspend() .
260         *
261         * @param pRegion - region the engine shall be allowed to use again
262         */
263        void Engine::Resume(::gig::Region* pRegion) {
264            dmsg(1,("gig::Engine: Resuming Region %x ...\n",pRegion));
265            SuspendedRegionsMutex.Lock();
266            SuspensionChangeOngoing.Set(true);
267            pPendingRegionResumption = pRegion;
268            SuspensionChangeOngoing.WaitAndUnlockIf(true);
269            SuspendedRegionsMutex.Unlock();
270            dmsg(1,("gig::Engine: Region %x resumed.\n",pRegion));
271        }
272    
273        /**
274       *  Reset all voices and disk thread and clear input event queue and all       *  Reset all voices and disk thread and clear input event queue and all
275       *  control and status variables.       *  control and status variables.
276       */       */
# Line 208  namespace LinuxSampler { namespace gig { Line 325  namespace LinuxSampler { namespace gig {
325          memset(&ScaleTuning[0], 0x00, 12);          memset(&ScaleTuning[0], 0x00, 12);
326      }      }
327    
328        void Engine::ResetSuspendedRegions() {
329            SuspendedRegions.clear();
330            iPendingStreamDeletions = 0;
331            pPendingRegionSuspension = pPendingRegionResumption = NULL;
332            SuspensionChangeOngoing.Set(false);
333        }
334    
335      /**      /**
336       * Connect this engine instance with the given audio output device.       * Connect this engine instance with the given audio output device.
337       * This method will be called when an Engine instance is created.       * This method will be called when an Engine instance is created.
# Line 257  namespace LinuxSampler { namespace gig { Line 381  namespace LinuxSampler { namespace gig {
381              delete this->pDiskThread;              delete this->pDiskThread;
382              dmsg(1,("OK\n"));              dmsg(1,("OK\n"));
383          }          }
384          this->pDiskThread = new DiskThread(((pAudioOut->MaxSamplesPerCycle() << CONFIG_MAX_PITCH) << 1) + 6); //FIXME: assuming stereo          this->pDiskThread = new DiskThread(((pAudioOut->MaxSamplesPerCycle() << CONFIG_MAX_PITCH) << 1) + 6, //FIXME: assuming stereo
385                                               &instruments);
386          if (!pDiskThread) {          if (!pDiskThread) {
387              dmsg(0,("gig::Engine  new diskthread = NULL\n"));              dmsg(0,("gig::Engine  new diskthread = NULL\n"));
388              exit(EXIT_FAILURE);              exit(EXIT_FAILURE);
# Line 286  namespace LinuxSampler { namespace gig { Line 411  namespace LinuxSampler { namespace gig {
411      }      }
412    
413      /**      /**
414         * Called by the engine's (audio) thread once per cycle to process requests
415         * from the outer world to suspend or resume a given @c gig::Region .
416         */
417        void Engine::ProcessSuspensionsChanges() {
418            // process request for suspending one region
419            if (pPendingRegionSuspension) {
420                // kill all voices on all engine channels that use this region
421                for (int iChannel = 0; iChannel < engineChannels.size(); iChannel++) {
422                    EngineChannel* pEngineChannel = engineChannels[iChannel];
423                    RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
424                    RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();
425                    for (; iuiKey != end; ++iuiKey) { // iterate through all active keys
426                        midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[*iuiKey];
427                        RTList<Voice>::Iterator itVoice = pKey->pActiveVoices->first();
428                        // if current key is not associated with this region, skip this key
429                        if (itVoice->pDimRgn->GetParent() != pPendingRegionSuspension) continue;
430                        RTList<Voice>::Iterator itVoicesEnd = pKey->pActiveVoices->end();
431                        for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key
432                            // request a notification from disk thread side for stream deletion
433                            const Stream::Handle hStream = itVoice->KillImmediately(true);
434                            if (hStream != Stream::INVALID_HANDLE) { // voice actually used a stream
435                                iPendingStreamDeletions++;
436                            }
437                        }
438                    }
439                }
440                // make sure the region is not yet on the list
441                bool bAlreadySuspended = false;
442                RTList< ::gig::Region*>::Iterator iter = SuspendedRegions.first();
443                RTList< ::gig::Region*>::Iterator end  = SuspendedRegions.end();
444                for (; iter != end; ++iter) { // iterate through all suspended regions
445                    if (*iter == pPendingRegionSuspension) { // found
446                        bAlreadySuspended = true;
447                        dmsg(1,("gig::Engine: attempt to suspend an already suspended region !!!\n"));
448                        break;
449                    }
450                }
451                if (!bAlreadySuspended) {
452                    // put the region on the list of suspended regions
453                    RTList< ::gig::Region*>::Iterator iter = SuspendedRegions.allocAppend();
454                    if (iter) {
455                        *iter = pPendingRegionSuspension;
456                    } else std::cerr << "gig::Engine: Could not suspend Region, list is full. This is a bug!!!\n" << std::flush;
457                }
458                // free request slot for next caller (and to make sure that
459                // we're not going to process the same request in the next cycle)
460                pPendingRegionSuspension = NULL;
461                // if no disk stream deletions are pending, awaker other side, as
462                // we're done in this case
463                if (!iPendingStreamDeletions) SuspensionChangeOngoing.Set(false);
464            }
465    
466            // process request for resuming one region
467            if (pPendingRegionResumption) {
468                // remove region from the list of suspended regions
469                RTList< ::gig::Region*>::Iterator iter = SuspendedRegions.first();
470                RTList< ::gig::Region*>::Iterator end  = SuspendedRegions.end();
471                for (; iter != end; ++iter) { // iterate through all suspended regions
472                    if (*iter == pPendingRegionResumption) { // found
473                        SuspendedRegions.free(iter);
474                        break; // done
475                    }
476                }
477                // free request slot for next caller
478                pPendingRegionResumption = NULL;
479                // awake other side as we're done
480                SuspensionChangeOngoing.Set(false);
481            }
482        }
483    
484        /**
485         * Called by the engine's (audio) thread once per cycle to check if
486         * streams of voices that were killed due to suspension request have
487         * finally really been deleted by the disk thread.
488         */
489        void Engine::ProcessPendingStreamDeletions() {
490            if (!iPendingStreamDeletions) return;
491            //TODO: or shall we better store a list with stream handles instead of a scalar amount of streams to be deleted? might be safer
492            while (
493                iPendingStreamDeletions &&
494                pDiskThread->AskForDeletedStream() != Stream::INVALID_HANDLE
495            ) iPendingStreamDeletions--;
496            // just for safety ...
497            while (pDiskThread->AskForDeletedStream() != Stream::INVALID_HANDLE);
498            // now that all disk streams are deleted, awake other side as
499            // we're finally done with suspending the requested region
500            if (!iPendingStreamDeletions) SuspensionChangeOngoing.Set(false);
501        }
502    
503        /**
504         * Returns @c true if the given region is currently set to be suspended
505         * from being used, @c false otherwise.
506         */
507        bool Engine::RegionSuspended(::gig::Region* pRegion) {
508            if (SuspendedRegions.isEmpty()) return false;
509            //TODO: or shall we use a sorted container instead of the RTList? might be faster ... or trivial ;-)
510            RTList< ::gig::Region*>::Iterator iter = SuspendedRegions.first();
511            RTList< ::gig::Region*>::Iterator end  = SuspendedRegions.end();
512            for (; iter != end; ++iter)  // iterate through all suspended regions
513                if (*iter == pRegion) return true;
514            return false;
515        }
516    
517        /**
518       * Clear all engine global event lists.       * Clear all engine global event lists.
519       */       */
520      void Engine::ClearEventLists() {      void Engine::ClearEventLists() {
# Line 306  namespace LinuxSampler { namespace gig { Line 535  namespace LinuxSampler { namespace gig {
535       *                  current audio cycle       *                  current audio cycle
536       */       */
537      void Engine::ImportEvents(uint Samples) {      void Engine::ImportEvents(uint Samples) {
538          RingBuffer<Event>::NonVolatileReader eventQueueReader = pEventQueue->get_non_volatile_reader();          RingBuffer<Event,false>::NonVolatileReader eventQueueReader = pEventQueue->get_non_volatile_reader();
539          Event* pEvent;          Event* pEvent;
540          while (true) {          while (true) {
541              // get next event from input event queue              // get next event from input event queue
# Line 340  namespace LinuxSampler { namespace gig { Line 569  namespace LinuxSampler { namespace gig {
569       *  @returns       0 on success       *  @returns       0 on success
570       */       */
571      int Engine::RenderAudio(uint Samples) {      int Engine::RenderAudio(uint Samples) {
572          dmsg(5,("RenderAudio(Samples=%d)\n", Samples));          dmsg(7,("RenderAudio(Samples=%d)\n", Samples));
573    
574          // return if engine disabled          // return if engine disabled
575          if (EngineDisabled.Pop()) {          if (EngineDisabled.Pop()) {
# Line 348  namespace LinuxSampler { namespace gig { Line 577  namespace LinuxSampler { namespace gig {
577              return 0;              return 0;
578          }          }
579    
580            // process requests for suspending / resuming regions (i.e. to avoid
581            // crashes while these regions are modified by an instrument editor)
582            ProcessSuspensionsChanges();
583    
584          // update time of start and end of this audio fragment (as events' time stamps relate to this)          // update time of start and end of this audio fragment (as events' time stamps relate to this)
585          pEventGenerator->UpdateFragmentTime(Samples);          pEventGenerator->UpdateFragmentTime(Samples);
586    
# Line 377  namespace LinuxSampler { namespace gig { Line 610  namespace LinuxSampler { namespace gig {
610          // reset internal voice counter (just for statistic of active voices)          // reset internal voice counter (just for statistic of active voices)
611          ActiveVoiceCountTemp = 0;          ActiveVoiceCountTemp = 0;
612    
613            // handle instrument change commands
614            instrument_change_command_t command;
615            if (InstrumentChangeQueue->pop(&command) > 0) {
616                EngineChannel* pEngineChannel = command.pEngineChannel;
617                pEngineChannel->pInstrument = command.pInstrument;
618    
619                //TODO: this is a lazy solution ATM and not safe in case somebody is currently editing the instrument we're currently switching to (we should store all suspended regions on instrument manager side and when switching to another instrument copy that list to the engine's local list of suspensions
620                ResetSuspendedRegions();
621    
622                // iterate through all active voices and mark their
623                // dimension regions as "in use". The instrument resource
624                // manager may delete all of the instrument except the
625                // dimension regions and samples that are in use.
626                int i = 0;
627                RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
628                RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();
629                while (iuiKey != end) { // iterate through all active keys
630                    midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[*iuiKey];
631                    ++iuiKey;
632    
633                    RTList<Voice>::Iterator itVoice     = pKey->pActiveVoices->first();
634                    RTList<Voice>::Iterator itVoicesEnd = pKey->pActiveVoices->end();
635                    for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key
636                        if (!itVoice->Orphan) {
637                            itVoice->Orphan = true;
638                            pDimRegionsInUse[i++] = itVoice->pDimRgn;
639                        }
640                    }
641                }
642                pDimRegionsInUse[i] = 0; // end of list
643    
644                // send a reply to the calling thread, which is waiting
645                instrument_change_reply_t reply;
646                InstrumentChangeReplyQueue->push(&reply);
647            }
648    
649          // handle events on all engine channels          // handle events on all engine channels
650          for (int i = 0; i < engineChannels.size(); i++) {          for (int i = 0; i < engineChannels.size(); i++) {
             if (!engineChannels[i]->pInstrument) continue; // ignore if no instrument loaded  
651              ProcessEvents(engineChannels[i], Samples);              ProcessEvents(engineChannels[i], Samples);
652          }          }
653    
654          // render all 'normal', active voices on all engine channels          // render all 'normal', active voices on all engine channels
655          for (int i = 0; i < engineChannels.size(); i++) {          for (int i = 0; i < engineChannels.size(); i++) {
             if (!engineChannels[i]->pInstrument) continue; // ignore if no instrument loaded  
656              RenderActiveVoices(engineChannels[i], Samples);              RenderActiveVoices(engineChannels[i], Samples);
657          }          }
658    
659          // now that all ordinary voices on ALL engine channels are rendered, render new stolen voices          // now that all ordinary voices on ALL engine channels are rendered, render new stolen voices
660          RenderStolenVoices(Samples);          RenderStolenVoices(Samples);
661    
662            // handle audio routing for engine channels with FX sends
663            for (int i = 0; i < engineChannels.size(); i++) {
664                if (engineChannels[i]->fxSends.empty()) continue; // ignore if no FX sends
665                RouteAudio(engineChannels[i], Samples);
666            }
667    
668          // handle cleanup on all engine channels for the next audio fragment          // handle cleanup on all engine channels for the next audio fragment
669          for (int i = 0; i < engineChannels.size(); i++) {          for (int i = 0; i < engineChannels.size(); i++) {
             if (!engineChannels[i]->pInstrument) continue; // ignore if no instrument loaded  
670              PostProcess(engineChannels[i]);              PostProcess(engineChannels[i]);
671          }          }
672    
# Line 409  namespace LinuxSampler { namespace gig { Line 681  namespace LinuxSampler { namespace gig {
681          ActiveVoiceCount = ActiveVoiceCountTemp;          ActiveVoiceCount = ActiveVoiceCountTemp;
682          if (ActiveVoiceCount > ActiveVoiceCountMax) ActiveVoiceCountMax = ActiveVoiceCount;          if (ActiveVoiceCount > ActiveVoiceCountMax) ActiveVoiceCountMax = ActiveVoiceCount;
683    
684            // in case regions were previously suspended and we killed voices
685            // with disk streams due to that, check if those streams have finally
686            // been deleted by the disk thread
687            if (iPendingStreamDeletions) ProcessPendingStreamDeletions();
688    
689          FrameTime += Samples;          FrameTime += Samples;
690    
691          return 0;          return 0;
# Line 476  namespace LinuxSampler { namespace gig { Line 753  namespace LinuxSampler { namespace gig {
753          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
754          #endif          #endif
755    
756            uint voiceCount = 0;
757            uint streamCount = 0;
758          RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();          RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
759          RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();          RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();
760          while (iuiKey != end) { // iterate through all active keys          while (iuiKey != end) { // iterate through all active keys
# Line 487  namespace LinuxSampler { namespace gig { Line 766  namespace LinuxSampler { namespace gig {
766              for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key              for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key
767                  // now render current voice                  // now render current voice
768                  itVoice->Render(Samples);                  itVoice->Render(Samples);
769                  if (itVoice->IsActive()) ActiveVoiceCountTemp++; // still active                  if (itVoice->IsActive()) { // still active
770                  else { // voice reached end, is now inactive                      ActiveVoiceCountTemp++;
771                        voiceCount++;
772    
773                        if (itVoice->PlaybackState == Voice::playback_state_disk) {
774                            if ((itVoice->DiskStreamRef).State == Stream::state_active) streamCount++;
775                        }
776                    }  else { // voice reached end, is now inactive
777                      FreeVoice(pEngineChannel, itVoice); // remove voice from the list of active voices                      FreeVoice(pEngineChannel, itVoice); // remove voice from the list of active voices
778                  }                  }
779              }              }
780          }          }
781    
782            pEngineChannel->SetVoiceCount(voiceCount);
783            pEngineChannel->SetDiskStreamCount(streamCount);
784      }      }
785    
786      /**      /**
# Line 513  namespace LinuxSampler { namespace gig { Line 801  namespace LinuxSampler { namespace gig {
801          RTList<Event>::Iterator end               = pVoiceStealingQueue->end();          RTList<Event>::Iterator end               = pVoiceStealingQueue->end();
802          for (; itVoiceStealEvent != end; ++itVoiceStealEvent) {          for (; itVoiceStealEvent != end; ++itVoiceStealEvent) {
803              EngineChannel* pEngineChannel = (EngineChannel*) itVoiceStealEvent->pEngineChannel;              EngineChannel* pEngineChannel = (EngineChannel*) itVoiceStealEvent->pEngineChannel;
804                if (!pEngineChannel->pInstrument) continue; // ignore if no instrument loaded
805              Pool<Voice>::Iterator itNewVoice =              Pool<Voice>::Iterator itNewVoice =
806                  LaunchVoice(pEngineChannel, itVoiceStealEvent, itVoiceStealEvent->Param.Note.Layer, itVoiceStealEvent->Param.Note.ReleaseTrigger, false, false);                  LaunchVoice(pEngineChannel, itVoiceStealEvent, itVoiceStealEvent->Param.Note.Layer, itVoiceStealEvent->Param.Note.ReleaseTrigger, false, false);
807              if (itNewVoice) {              if (itNewVoice) {
808                  itNewVoice->Render(Samples);                  itNewVoice->Render(Samples);
809                  if (itNewVoice->IsActive()) ActiveVoiceCountTemp++; // still active                  if (itNewVoice->IsActive()) { // still active
810                  else { // voice reached end, is now inactive                      ActiveVoiceCountTemp++;
811                        pEngineChannel->SetVoiceCount(pEngineChannel->GetVoiceCount() + 1);
812    
813                        if (itNewVoice->PlaybackState == Voice::playback_state_disk) {
814                            if (itNewVoice->DiskStreamRef.State == Stream::state_active) {
815                                pEngineChannel->SetDiskStreamCount(pEngineChannel->GetDiskStreamCount() + 1);
816                            }
817                        }
818                    } else { // voice reached end, is now inactive
819                      FreeVoice(pEngineChannel, itNewVoice); // remove voice from the list of active voices                      FreeVoice(pEngineChannel, itNewVoice); // remove voice from the list of active voices
820                  }                  }
821              }              }
# Line 532  namespace LinuxSampler { namespace gig { Line 829  namespace LinuxSampler { namespace gig {
829      }      }
830    
831      /**      /**
832         * Will be called in case the respective engine channel sports FX send
833         * channels. In this particular case, engine channel local buffers are
834         * used to render and mix all voices to. This method is responsible for
835         * copying the audio data from those local buffers to the master audio
836         * output channels as well as to the FX send audio output channels with
837         * their respective FX send levels.
838         *
839         * @param pEngineChannel - engine channel from which audio should be
840         *                         routed
841         * @param Samples        - amount of sample points to be routed in
842         *                         this audio fragment cycle
843         */
844        void Engine::RouteAudio(EngineChannel* pEngineChannel, uint Samples) {
845            // route master signal
846            {
847                AudioChannel* pDstL = pAudioOutputDevice->Channel(pEngineChannel->AudioDeviceChannelLeft);
848                AudioChannel* pDstR = pAudioOutputDevice->Channel(pEngineChannel->AudioDeviceChannelRight);
849                pEngineChannel->pChannelLeft->MixTo(pDstL, Samples);
850                pEngineChannel->pChannelRight->MixTo(pDstR, Samples);
851            }
852            // route FX send signal
853            {
854                for (int iFxSend = 0; iFxSend < pEngineChannel->GetFxSendCount(); iFxSend++) {
855                    FxSend* pFxSend = pEngineChannel->GetFxSend(iFxSend);
856                    // left channel
857                    const int iDstL = pFxSend->DestinationChannel(0);
858                    if (iDstL < 0) {
859                        dmsg(1,("Engine::RouteAudio() Error: invalid FX send (L) destination channel"));
860                    } else {
861                        AudioChannel* pDstL = pAudioOutputDevice->Channel(iDstL);
862                        if (!pDstL) {
863                            dmsg(1,("Engine::RouteAudio() Error: invalid FX send (L) destination channel"));
864                        } else pEngineChannel->pChannelLeft->MixTo(pDstL, Samples, pFxSend->Level());
865                    }
866                    // right channel
867                    const int iDstR = pFxSend->DestinationChannel(1);
868                    if (iDstR < 0) {
869                        dmsg(1,("Engine::RouteAudio() Error: invalid FX send (R) destination channel"));
870                    } else {
871                        AudioChannel* pDstR = pAudioOutputDevice->Channel(iDstR);
872                        if (!pDstR) {
873                            dmsg(1,("Engine::RouteAudio() Error: invalid FX send (R) destination channel"));
874                        } else pEngineChannel->pChannelRight->MixTo(pDstR, Samples, pFxSend->Level());
875                    }
876                }
877            }
878            // reset buffers with silence (zero out) for the next audio cycle
879            pEngineChannel->pChannelLeft->Clear();
880            pEngineChannel->pChannelRight->Clear();
881        }
882    
883        /**
884       * Free all keys which have turned inactive in this audio fragment, from       * Free all keys which have turned inactive in this audio fragment, from
885       * the list of active keys and clear all event lists on that engine       * the list of active keys and clear all event lists on that engine
886       * channel.       * channel.
# Line 608  namespace LinuxSampler { namespace gig { Line 957  namespace LinuxSampler { namespace gig {
957          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
958          #endif          #endif
959    
960            if (!pEngineChannel->pInstrument) return; // ignore if no instrument loaded
961    
962            //HACK: we should better add the transpose value only to the most mandatory places (like for retrieving the region and calculating the tuning), because otherwise voices will unintendedly survive when changing transpose while playing
963            itNoteOnEvent->Param.Note.Key += pEngineChannel->GlobalTranspose;
964    
965          const int key = itNoteOnEvent->Param.Note.Key;          const int key = itNoteOnEvent->Param.Note.Key;
966          midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[key];          midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[key];
967    
# Line 665  namespace LinuxSampler { namespace gig { Line 1019  namespace LinuxSampler { namespace gig {
1019          {          {
1020              // first, get total amount of required voices (dependant on amount of layers)              // first, get total amount of required voices (dependant on amount of layers)
1021              ::gig::Region* pRegion = pEngineChannel->pInstrument->GetRegion(itNoteOnEventOnKeyList->Param.Note.Key);              ::gig::Region* pRegion = pEngineChannel->pInstrument->GetRegion(itNoteOnEventOnKeyList->Param.Note.Key);
1022              if (pRegion) {              if (pRegion && !RegionSuspended(pRegion)) {
1023                  int voicesRequired = pRegion->Layers;                  int voicesRequired = pRegion->Layers;
1024                  // now launch the required amount of voices                  // now launch the required amount of voices
1025                  for (int i = 0; i < voicesRequired; i++)                  for (int i = 0; i < voicesRequired; i++)
# Line 695  namespace LinuxSampler { namespace gig { Line 1049  namespace LinuxSampler { namespace gig {
1049          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted          if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
1050          #endif          #endif
1051    
1052            //HACK: we should better add the transpose value only to the most mandatory places (like for retrieving the region and calculating the tuning), because otherwise voices will unintendedly survive when changing transpose while playing
1053            itNoteOffEvent->Param.Note.Key += pEngineChannel->GlobalTranspose;
1054    
1055          const int iKey = itNoteOffEvent->Param.Note.Key;          const int iKey = itNoteOffEvent->Param.Note.Key;
1056          midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[iKey];          midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[iKey];
1057          pKey->KeyPressed = false; // the MIDI key was now released          pKey->KeyPressed = false; // the MIDI key was now released
# Line 705  namespace LinuxSampler { namespace gig { Line 1062  namespace LinuxSampler { namespace gig {
1062          bool bShouldRelease = pKey->Active && ShouldReleaseVoice(pEngineChannel, itNoteOffEventOnKeyList->Param.Note.Key);          bool bShouldRelease = pKey->Active && ShouldReleaseVoice(pEngineChannel, itNoteOffEventOnKeyList->Param.Note.Key);
1063    
1064          // in case Solo Mode is enabled, kill all voices on this key and respawn a voice on the highest pressed key (if any)          // in case Solo Mode is enabled, kill all voices on this key and respawn a voice on the highest pressed key (if any)
1065          if (pEngineChannel->SoloMode) { //TODO: this feels like too much code just for handling solo mode :P          if (pEngineChannel->SoloMode && pEngineChannel->pInstrument) { //TODO: this feels like too much code just for handling solo mode :P
1066              bool bOtherKeysPressed = false;              bool bOtherKeysPressed = false;
1067              if (iKey == pEngineChannel->SoloKey) {              if (iKey == pEngineChannel->SoloKey) {
1068                  pEngineChannel->SoloKey = -1;                  pEngineChannel->SoloKey = -1;
# Line 768  namespace LinuxSampler { namespace gig { Line 1125  namespace LinuxSampler { namespace gig {
1125              itNoteOffEventOnKeyList->Type = Event::type_release; // transform event type              itNoteOffEventOnKeyList->Type = Event::type_release; // transform event type
1126    
1127              // spawn release triggered voice(s) if needed              // spawn release triggered voice(s) if needed
1128              if (pKey->ReleaseTrigger) {              if (pKey->ReleaseTrigger && pEngineChannel->pInstrument) {
1129                  // first, get total amount of required voices (dependant on amount of layers)                  // first, get total amount of required voices (dependant on amount of layers)
1130                  ::gig::Region* pRegion = pEngineChannel->pInstrument->GetRegion(itNoteOffEventOnKeyList->Param.Note.Key);                  ::gig::Region* pRegion = pEngineChannel->pInstrument->GetRegion(itNoteOffEventOnKeyList->Param.Note.Key);
1131                  if (pRegion) {                  if (pRegion) {
# Line 963  namespace LinuxSampler { namespace gig { Line 1320  namespace LinuxSampler { namespace gig {
1320                      std::cerr << "gig::Engine::LaunchVoice() Error: Unknown dimension\n" << std::flush;                      std::cerr << "gig::Engine::LaunchVoice() Error: Unknown dimension\n" << std::flush;
1321              }              }
1322          }          }
1323    
1324            // return if this is a release triggered voice and there is no
1325            // releasetrigger dimension (could happen if an instrument
1326            // change has occured between note on and off)
1327            if (ReleaseTriggerVoice && VoiceType != Voice::type_release_trigger) return Pool<Voice>::Iterator();
1328    
1329          ::gig::DimensionRegion* pDimRgn = pRegion->GetDimensionRegionByValue(DimValues);          ::gig::DimensionRegion* pDimRgn = pRegion->GetDimensionRegionByValue(DimValues);
1330    
1331          // no need to continue if sample is silent          // no need to continue if sample is silent
# Line 1192  namespace LinuxSampler { namespace gig { Line 1555  namespace LinuxSampler { namespace gig {
1555    
1556              uint keygroup = itVoice->KeyGroup;              uint keygroup = itVoice->KeyGroup;
1557    
1558                // if the sample and dimension region belong to an
1559                // instrument that is unloaded, tell the disk thread to
1560                // release them
1561                if (itVoice->Orphan) {
1562                    pDiskThread->OrderDeletionOfDimreg(itVoice->pDimRgn);
1563                }
1564    
1565              // free the voice object              // free the voice object
1566              pVoicePool->free(itVoice);              pVoicePool->free(itVoice);
1567    
# Line 1236  namespace LinuxSampler { namespace gig { Line 1606  namespace LinuxSampler { namespace gig {
1606          // update controller value in the engine channel's controller table          // update controller value in the engine channel's controller table
1607          pEngineChannel->ControllerTable[itControlChangeEvent->Param.CC.Controller] = itControlChangeEvent->Param.CC.Value;          pEngineChannel->ControllerTable[itControlChangeEvent->Param.CC.Controller] = itControlChangeEvent->Param.CC.Value;
1608    
1609            // handle hard coded MIDI controllers
1610          switch (itControlChangeEvent->Param.CC.Controller) {          switch (itControlChangeEvent->Param.CC.Controller) {
1611              case 5: { // portamento time              case 5: { // portamento time
1612                  pEngineChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN;                  pEngineChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN;
1613                  break;                  break;
1614              }              }
1615                case 6: { // data entry (currently only used for RPN controllers)
1616                    if (pEngineChannel->GetMidiRpnController() == 2) { // coarse tuning in half tones
1617                        int transpose = (int) itControlChangeEvent->Param.CC.Value - 64;
1618                        // limit to +- two octaves for now
1619                        transpose = RTMath::Min(transpose,  24);
1620                        transpose = RTMath::Max(transpose, -24);
1621                        pEngineChannel->GlobalTranspose = transpose;
1622                        // workaround, so we won't have hanging notes
1623                        ReleaseAllVoices(pEngineChannel, itControlChangeEvent);
1624                    }
1625                    // to avoid other MIDI CC #6 messages to be misenterpreted as RPN controller data
1626                    pEngineChannel->ResetMidiRpnController();
1627                    break;
1628                }
1629              case 7: { // volume              case 7: { // volume
1630                  //TODO: not sample accurate yet                  //TODO: not sample accurate yet
1631                  pEngineChannel->GlobalVolume = VolumeCurve[itControlChangeEvent->Param.CC.Value] *  CONFIG_GLOBAL_ATTENUATION;                  pEngineChannel->MidiVolume = VolumeCurve[itControlChangeEvent->Param.CC.Value];
1632                  pEngineChannel->bStatusChanged = true; // engine channel status has changed, so set notify flag                  pEngineChannel->bStatusChanged = true; // engine channel status has changed, so set notify flag
1633                  break;                  break;
1634              }              }
# Line 1301  namespace LinuxSampler { namespace gig { Line 1686  namespace LinuxSampler { namespace gig {
1686                  break;                  break;
1687              }              }
1688              case 65: { // portamento on / off              case 65: { // portamento on / off
1689                  KillAllVoices(pEngineChannel, itControlChangeEvent);                  const bool bPortamento = itControlChangeEvent->Param.CC.Value >= 64;
1690                  pEngineChannel->PortamentoMode = itControlChangeEvent->Param.CC.Value >= 64;                  if (bPortamento != pEngineChannel->PortamentoMode)
1691                        KillAllVoices(pEngineChannel, itControlChangeEvent);
1692                    pEngineChannel->PortamentoMode = bPortamento;
1693                  break;                  break;
1694              }              }
1695              case 66: { // sostenuto              case 66: { // sostenuto
# Line 1345  namespace LinuxSampler { namespace gig { Line 1732  namespace LinuxSampler { namespace gig {
1732                  }                  }
1733                  break;                  break;
1734              }              }
1735                case 100: { // RPN controller LSB
1736                    pEngineChannel->SetMidiRpnControllerLsb(itControlChangeEvent->Param.CC.Value);
1737                    break;
1738                }
1739                case 101: { // RPN controller MSB
1740                    pEngineChannel->SetMidiRpnControllerMsb(itControlChangeEvent->Param.CC.Value);
1741                    break;
1742                }
1743    
1744    
1745              // Channel Mode Messages              // Channel Mode Messages
# Line 1364  namespace LinuxSampler { namespace gig { Line 1759  namespace LinuxSampler { namespace gig {
1759                  break;                  break;
1760              }              }
1761              case 126: { // mono mode on              case 126: { // mono mode on
1762                  KillAllVoices(pEngineChannel, itControlChangeEvent);                  if (!pEngineChannel->SoloMode)
1763                        KillAllVoices(pEngineChannel, itControlChangeEvent);
1764                  pEngineChannel->SoloMode = true;                  pEngineChannel->SoloMode = true;
1765                  break;                  break;
1766              }              }
1767              case 127: { // poly mode on              case 127: { // poly mode on
1768                  KillAllVoices(pEngineChannel, itControlChangeEvent);                  if (pEngineChannel->SoloMode)
1769                        KillAllVoices(pEngineChannel, itControlChangeEvent);
1770                  pEngineChannel->SoloMode = false;                  pEngineChannel->SoloMode = false;
1771                  break;                  break;
1772              }              }
1773          }          }
1774    
1775            // handle FX send controllers
1776            if (!pEngineChannel->fxSends.empty()) {
1777                for (int iFxSend = 0; iFxSend < pEngineChannel->GetFxSendCount(); iFxSend++) {
1778                    FxSend* pFxSend = pEngineChannel->GetFxSend(iFxSend);
1779                    if (pFxSend->MidiController() == itControlChangeEvent->Param.CC.Controller)
1780                        pFxSend->SetLevel(itControlChangeEvent->Param.CC.Value);
1781                        pFxSend->SetInfoChanged(true);
1782                }
1783            }
1784      }      }
1785    
1786      /**      /**
# Line 1382  namespace LinuxSampler { namespace gig { Line 1789  namespace LinuxSampler { namespace gig {
1789       *  @param itSysexEvent - sysex data size and time stamp of the sysex event       *  @param itSysexEvent - sysex data size and time stamp of the sysex event
1790       */       */
1791      void Engine::ProcessSysex(Pool<Event>::Iterator& itSysexEvent) {      void Engine::ProcessSysex(Pool<Event>::Iterator& itSysexEvent) {
1792          RingBuffer<uint8_t>::NonVolatileReader reader = pSysexBuffer->get_non_volatile_reader();          RingBuffer<uint8_t,false>::NonVolatileReader reader = pSysexBuffer->get_non_volatile_reader();
1793    
1794          uint8_t exclusive_status, id;          uint8_t exclusive_status, id;
1795          if (!reader.pop(&exclusive_status)) goto free_sysex_data;          if (!reader.pop(&exclusive_status)) goto free_sysex_data;
# Line 1401  namespace LinuxSampler { namespace gig { Line 1808  namespace LinuxSampler { namespace gig {
1808    
1809                  // command address                  // command address
1810                  uint8_t addr[3]; // 2 byte addr MSB, followed by 1 byte addr LSB)                  uint8_t addr[3]; // 2 byte addr MSB, followed by 1 byte addr LSB)
1811                  const RingBuffer<uint8_t>::NonVolatileReader checksum_reader = reader; // so we can calculate the check sum later                  const RingBuffer<uint8_t,false>::NonVolatileReader checksum_reader = reader; // so we can calculate the check sum later
1812                  if (reader.read(&addr[0], 3) != 3) goto free_sysex_data;                  if (reader.read(&addr[0], 3) != 3) goto free_sysex_data;
1813                  if (addr[0] == 0x40 && addr[1] == 0x00) { // System Parameters                  if (addr[0] == 0x40 && addr[1] == 0x00) { // System Parameters
1814                      dmsg(3,("\tSystem Parameter\n"));                      dmsg(3,("\tSystem Parameter\n"));
# Line 1448  namespace LinuxSampler { namespace gig { Line 1855  namespace LinuxSampler { namespace gig {
1855       *                     question       *                     question
1856       * @param DataSize   - size of the GS message data (in bytes)       * @param DataSize   - size of the GS message data (in bytes)
1857       */       */
1858      uint8_t Engine::GSCheckSum(const RingBuffer<uint8_t>::NonVolatileReader AddrReader, uint DataSize) {      uint8_t Engine::GSCheckSum(const RingBuffer<uint8_t,false>::NonVolatileReader AddrReader, uint DataSize) {
1859          RingBuffer<uint8_t>::NonVolatileReader reader = AddrReader;          RingBuffer<uint8_t,false>::NonVolatileReader reader = AddrReader;
1860          uint bytes = 3 /*addr*/ + DataSize;          uint bytes = 3 /*addr*/ + DataSize;
1861          uint8_t addr_and_data[bytes];          uint8_t addr_and_data[bytes];
1862          reader.read(&addr_and_data[0], bytes);          reader.read(&addr_and_data[0], bytes);
# Line 1568  namespace LinuxSampler { namespace gig { Line 1975  namespace LinuxSampler { namespace gig {
1975      }      }
1976    
1977      String Engine::Version() {      String Engine::Version() {
1978          String s = "$Revision: 1.65 $";          String s = "$Revision: 1.81 $";
1979          return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword          return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
1980      }      }
1981    
1982        InstrumentManager* Engine::GetInstrumentManager() {
1983            return &instruments;
1984        }
1985    
1986      // static constant initializers      // static constant initializers
1987      const float* Engine::VolumeCurve(InitVolumeCurve());      const float* Engine::VolumeCurve(InitVolumeCurve());
1988      const float* Engine::PanCurve(InitPanCurve());      const float* Engine::PanCurve(InitPanCurve());
# Line 1614  namespace LinuxSampler { namespace gig { Line 2025  namespace LinuxSampler { namespace gig {
2025          return y;          return y;
2026      }      }
2027    
2028        /**
2029         * Changes the instrument for an engine channel.
2030         *
2031         * @param pEngineChannel - engine channel on which the instrument
2032         *                         should be changed
2033         * @param pInstrument - new instrument
2034         * @returns a list of dimension regions from the old instrument
2035         *          that are still in use
2036         */
2037        ::gig::DimensionRegion** Engine::ChangeInstrument(EngineChannel* pEngineChannel, ::gig::Instrument* pInstrument) {
2038            instrument_change_command_t command;
2039            command.pEngineChannel = pEngineChannel;
2040            command.pInstrument = pInstrument;
2041            InstrumentChangeQueue->push(&command);
2042    
2043            // wait for the audio thread to confirm that the instrument
2044            // change has been done
2045            instrument_change_reply_t reply;
2046            while (InstrumentChangeReplyQueue->pop(&reply) == 0) {
2047                usleep(10000);
2048            }
2049            return pDimRegionsInUse;
2050        }
2051    
2052  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.924  
changed lines
  Added in v.1348

  ViewVC Help
Powered by ViewVC