/[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 2115 by persson, Thu Aug 12 15:36:15 2010 UTC revision 2448 by schoenebeck, Fri May 3 14:26:32 2013 UTC
# Line 4  Line 4 
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-2008 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *   *   Copyright (C) 2009-2013 Christian Schoenebeck and Grigor Iliev        *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   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 104  namespace LinuxSampler { Line 104  namespace LinuxSampler {
104               *  @param Samples - number of sample points to be rendered               *  @param Samples - number of sample points to be rendered
105               *  @returns       0 on success               *  @returns       0 on success
106               */               */
107              virtual int RenderAudio(uint Samples) {              virtual int RenderAudio(uint Samples) OVERRIDE {
108                  dmsg(8,("RenderAudio(Samples=%d)\n", Samples));                  dmsg(8,("RenderAudio(Samples=%d)\n", Samples));
109    
110                  // return if engine disabled                  // return if engine disabled
# Line 143  namespace LinuxSampler { Line 143  namespace LinuxSampler {
143                          }                          }
144                      }                      }
145                  }                  }
146                    
147                    // In case scale tuning has been changed, recalculate pitch for
148                    // all active voices.
149                    ProcessScaleTuningChange();
150    
151                  // reset internal voice counter (just for statistic of active voices)                  // reset internal voice counter (just for statistic of active voices)
152                  ActiveVoiceCountTemp = 0;                  ActiveVoiceCountTemp = 0;
# Line 190  namespace LinuxSampler { Line 194  namespace LinuxSampler {
194                  // been deleted by the disk thread                  // been deleted by the disk thread
195                  if (iPendingStreamDeletions) ProcessPendingStreamDeletions();                  if (iPendingStreamDeletions) ProcessPendingStreamDeletions();
196    
197                    // Release the instrument change command. (This has to
198                    // be done after all voices have been rendered and not
199                    // in HandleInstrumentChanges, as the RegionsInUse
200                    // list has been built up by the voice renderers.)
201                    for (int i = 0; i < engineChannels.size(); i++) {
202                        EngineChannelBase<V, R, I>* channel =
203                            static_cast<EngineChannelBase<V, R, I>*>(engineChannels[i]);
204                        channel->InstrumentChangeCommandReader.Unlock();
205                    }
206                  FrameTime += Samples;                  FrameTime += Samples;
207    
208                  EngineDisabled.RttDone();                  EngineDisabled.RttDone();
209                  return 0;                  return 0;
210              }              }
211    
212              virtual int MaxVoices() { return pVoicePool->poolSize(); }              virtual int MaxVoices() OVERRIDE { return pVoicePool->poolSize(); }
213    
214              virtual void SetMaxVoices(int iVoices) throw (Exception) {              virtual void SetMaxVoices(int iVoices) throw (Exception) OVERRIDE {
215                  if (iVoices < 1)                  if (iVoices < 1)
216                      throw Exception("Maximum voices for an engine cannot be set lower than 1");                      throw Exception("Maximum voices for an engine cannot be set lower than 1");
217    
# Line 234  namespace LinuxSampler { Line 247  namespace LinuxSampler {
247                  }                  }
248                  pVoicePool->clear();                  pVoicePool->clear();
249    
250                    PostSetMaxVoices(iVoices);
251                  ResumeAll();                  ResumeAll();
252              }              }
253                
254                /** Called after the new max number of voices is set and before resuming the engine. */
255                virtual void PostSetMaxVoices(int iVoices) { }
256    
257              virtual uint DiskStreamCount() { return (pDiskThread) ? pDiskThread->GetActiveStreamCount() : 0; }              virtual uint DiskStreamCount() OVERRIDE { return (pDiskThread) ? pDiskThread->GetActiveStreamCount() : 0; }
258              virtual uint DiskStreamCountMax() { return (pDiskThread) ? pDiskThread->ActiveStreamCountMax : 0; }              virtual uint DiskStreamCountMax() OVERRIDE { return (pDiskThread) ? pDiskThread->ActiveStreamCountMax : 0; }
259              virtual int  MaxDiskStreams() { return iMaxDiskStreams; }              virtual int  MaxDiskStreams() OVERRIDE { return iMaxDiskStreams; }
260    
261              virtual void SetMaxDiskStreams(int iStreams) throw (Exception) {              virtual void SetMaxDiskStreams(int iStreams) throw (Exception) OVERRIDE {
262                  if (iStreams < 0)                  if (iStreams < 0)
263                      throw Exception("Maximum disk streams for an engine cannot be set lower than 0");                      throw Exception("Maximum disk streams for an engine cannot be set lower than 0");
264    
# Line 256  namespace LinuxSampler { Line 273  namespace LinuxSampler {
273                  ResumeAll();                  ResumeAll();
274              }              }
275    
276              virtual String DiskStreamBufferFillBytes() { return (pDiskThread) ? pDiskThread->GetBufferFillBytes() : ""; }              virtual String DiskStreamBufferFillBytes() OVERRIDE { return (pDiskThread) ? pDiskThread->GetBufferFillBytes() : ""; }
277              virtual String DiskStreamBufferFillPercentage() { return (pDiskThread) ? pDiskThread->GetBufferFillPercentage() : ""; }              virtual String DiskStreamBufferFillPercentage() OVERRIDE { return (pDiskThread) ? pDiskThread->GetBufferFillPercentage() : ""; }
278              virtual InstrumentManager* GetInstrumentManager() { return &instruments; }              virtual InstrumentManager* GetInstrumentManager() OVERRIDE { return &instruments; }
279    
280              /**              /**
281               * Connect this engine instance with the given audio output device.               * Connect this engine instance with the given audio output device.
# Line 269  namespace LinuxSampler { Line 286  namespace LinuxSampler {
286               *               *
287               * @param pAudioOut - audio output device to connect to               * @param pAudioOut - audio output device to connect to
288               */               */
289              virtual void Connect(AudioOutputDevice* pAudioOut) {              virtual void Connect(AudioOutputDevice* pAudioOut) OVERRIDE {
290                  // caution: don't ignore if connecting to the same device here,                  // caution: don't ignore if connecting to the same device here,
291                  // because otherwise SetMaxDiskStreams() implementation won't work anymore!                  // because otherwise SetMaxDiskStreams() implementation won't work anymore!
292    
# Line 299  namespace LinuxSampler { Line 316  namespace LinuxSampler {
316                      // lower minimum release time                      // lower minimum release time
317                      const float minReleaseTime = (float) MaxSamplesPerCycle / (float) SampleRate;                      const float minReleaseTime = (float) MaxSamplesPerCycle / (float) SampleRate;
318                      for (VoiceIterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {                      for (VoiceIterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {
319                          iterVoice->pEG1->CalculateFadeOutCoeff(minReleaseTime, SampleRate);                          iterVoice->CalculateFadeOutCoeff(minReleaseTime, SampleRate);
320                      }                      }
321                      pVoicePool->clear();                      pVoicePool->clear();
322                  }                  }
# Line 332  namespace LinuxSampler { Line 349  namespace LinuxSampler {
349                  pDiskThread->StartThread();                  pDiskThread->StartThread();
350                  dmsg(1,("OK\n"));                  dmsg(1,("OK\n"));
351    
352                    bool printEqInfo = true;
353                  for (VoiceIterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {                  for (VoiceIterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {
354                      if (!iterVoice->pDiskThread) {                      if (!iterVoice->pDiskThread) {
355                          dmsg(0,("Engine -> voice::trigger: !pDiskThread\n"));                          dmsg(0,("Engine -> voice::trigger: !pDiskThread\n"));
356                          exit(EXIT_FAILURE);                          exit(EXIT_FAILURE);
357                      }                      }
358                        
359                        iterVoice->CreateEq();
360                        
361                        if(printEqInfo) {
362                            iterVoice->PrintEqInfo();
363                            printEqInfo = false;
364                        }
365                  }                  }
366                  pVoicePool->clear();                  pVoicePool->clear();
367                    
368                    // (re)create dedicated voice audio buffers
369                    //TODO: we could optimize resource usage a bit by just allocating these dedicated voice buffers when there is at least one engine channel with FX sends, because only in this case those special buffers are used actually, but since it would usually only save couple bytes in total, its probably not worth it
370                    if (pDedicatedVoiceChannelLeft)  delete pDedicatedVoiceChannelLeft;
371                    if (pDedicatedVoiceChannelRight) delete pDedicatedVoiceChannelRight;
372                    pDedicatedVoiceChannelLeft  = new AudioChannel(0, MaxSamplesPerCycle);
373                    pDedicatedVoiceChannelRight = new AudioChannel(1, MaxSamplesPerCycle);
374                }
375            
376                // Implementattion for abstract method derived from Engine.
377                virtual void ReconnectAudioOutputDevice() OVERRIDE {
378                    SuspendAll();
379                    if (pAudioOutputDevice) Connect(pAudioOutputDevice);
380                    ResumeAll();
381              }              }
382    
383              /**              /**
# Line 394  namespace LinuxSampler { Line 433  namespace LinuxSampler {
433               */               */
434              virtual void Suspend(RR* pRegion) {              virtual void Suspend(RR* pRegion) {
435                  dmsg(2,("EngineBase: Suspending Region %x ...\n",pRegion));                  dmsg(2,("EngineBase: Suspending Region %x ...\n",pRegion));
436                  SuspendedRegionsMutex.Lock();                  {
437                  SuspensionChangeOngoing.Set(true);                      LockGuard lock(SuspendedRegionsMutex);
438                  pPendingRegionSuspension = pRegion;                      SuspensionChangeOngoing.Set(true);
439                  SuspensionChangeOngoing.WaitAndUnlockIf(true);                      pPendingRegionSuspension = pRegion;
440                  SuspendedRegionsMutex.Unlock();                      SuspensionChangeOngoing.WaitAndUnlockIf(true);
441                    }
442                  dmsg(2,("EngineBase: Region %x suspended.",pRegion));                  dmsg(2,("EngineBase: Region %x suspended.",pRegion));
443              }              }
444    
# Line 410  namespace LinuxSampler { Line 450  namespace LinuxSampler {
450               */               */
451              virtual void Resume(RR* pRegion) {              virtual void Resume(RR* pRegion) {
452                  dmsg(2,("EngineBase: Resuming Region %x ...\n",pRegion));                  dmsg(2,("EngineBase: Resuming Region %x ...\n",pRegion));
453                  SuspendedRegionsMutex.Lock();                  {
454                  SuspensionChangeOngoing.Set(true);                      LockGuard lock(SuspendedRegionsMutex);
455                  pPendingRegionResumption = pRegion;                      SuspensionChangeOngoing.Set(true);
456                  SuspensionChangeOngoing.WaitAndUnlockIf(true);                      pPendingRegionResumption = pRegion;
457                  SuspendedRegionsMutex.Unlock();                      SuspensionChangeOngoing.WaitAndUnlockIf(true);
458                    }
459                  dmsg(2,("EngineBase: Region %x resumed.\n",pRegion));                  dmsg(2,("EngineBase: Region %x resumed.\n",pRegion));
460              }              }
461    
# Line 530  namespace LinuxSampler { Line 571  namespace LinuxSampler {
571    
572              //friend class EngineChannelBase<V, R, I>;              //friend class EngineChannelBase<V, R, I>;
573    
574                static IM instruments;
575    
576          protected:          protected:
577              class SuspensionVoiceHandler : public MidiKeyboardManager<V>::VoiceHandler {              class SuspensionVoiceHandler : public MidiKeyboardManager<V>::VoiceHandler {
578              public:              public:
579                  int PendingStreamDeletions;                  int PendingStreamDeletions;
580                  RR* pPendingRegionSuspension;                  RR* pPendingRegionSuspension;
581    
582                  SuspensionVoiceHandler(RR* pPendingRegionSuspension) {                  SuspensionVoiceHandler(RR* pPendingRegionSuspension) {
583                      PendingStreamDeletions = 0;                      PendingStreamDeletions = 0;
584                      this->pPendingRegionSuspension = pPendingRegionSuspension;                      this->pPendingRegionSuspension = pPendingRegionSuspension;
585                  }                  }
586    
587                  virtual bool Process(MidiKey* pMidiKey) {                  virtual bool Process(MidiKey* pMidiKey) OVERRIDE {
588                      VoiceIterator itVoice = pMidiKey->pActiveVoices->first();                      VoiceIterator itVoice = pMidiKey->pActiveVoices->first();
589                      // if current key is not associated with this region, skip this key                      // if current key is not associated with this region, skip this key
590                      if (itVoice->GetRegion()->GetParent() != pPendingRegionSuspension) return false;                      if (itVoice->GetRegion()->GetParent() != pPendingRegionSuspension) return false;
# Line 548  namespace LinuxSampler { Line 592  namespace LinuxSampler {
592                      return true;                      return true;
593                  }                  }
594    
595                  virtual void Process(VoiceIterator& itVoice) {                  virtual void Process(VoiceIterator& itVoice) OVERRIDE {
596                      // request a notification from disk thread side for stream deletion                      // request a notification from disk thread side for stream deletion
597                      const Stream::Handle hStream = itVoice->KillImmediately(true);                      const Stream::Handle hStream = itVoice->KillImmediately(true);
598                      if (hStream != Stream::INVALID_HANDLE) { // voice actually used a stream                      if (hStream != Stream::INVALID_HANDLE) { // voice actually used a stream
# Line 558  namespace LinuxSampler { Line 602  namespace LinuxSampler {
602                  }                  }
603              };              };
604    
             static IM instruments;  
   
605              Pool<R*>* pRegionPool[2]; ///< Double buffered pool, used by the engine channels to keep track of regions in use.              Pool<R*>* pRegionPool[2]; ///< Double buffered pool, used by the engine channels to keep track of regions in use.
606              int       MinFadeOutSamples;     ///< The number of samples needed to make an instant fade out (e.g. for voice stealing) without leading to clicks.              int       MinFadeOutSamples;     ///< The number of samples needed to make an instant fade out (e.g. for voice stealing) without leading to clicks.
607              D*        pDiskThread;              D*        pDiskThread;
# Line 765  namespace LinuxSampler { Line 807  namespace LinuxSampler {
807                      //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                      //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
808                      ResetSuspendedRegions();                      ResetSuspendedRegions();
809                  }                  }
   
                 for (int i = 0; i < engineChannels.size(); i++) {  
                     EngineChannelBase<V, R, I>* channel =  
                         static_cast<EngineChannelBase<V, R, I>*>(engineChannels[i]);  
                     channel->InstrumentChangeCommandReader.Unlock();  
                 }  
810              }              }
811    
812              /**              /**
# Line 857  namespace LinuxSampler { Line 893  namespace LinuxSampler {
893                  pChannel->ClearEventLists();                  pChannel->ClearEventLists();
894              }              }
895    
896                /**
897                 * Process MIDI control change events with hard coded behavior,
898                 * that is controllers whose behavior is defined independently
899                 * of the actual sampler engine type and instrument.
900                 *
901                 * @param pEngineChannel - engine channel on which the MIDI CC event was received
902                 * @param itControlChangeEvent - the actual MIDI CC event
903                 */
904              void ProcessHardcodedControllers (              void ProcessHardcodedControllers (
905                  EngineChannel*          pEngineChannel,                  EngineChannel*          pEngineChannel,
906                  Pool<Event>::Iterator&  itControlChangeEvent                  Pool<Event>::Iterator&  itControlChangeEvent
# Line 869  namespace LinuxSampler { Line 913  namespace LinuxSampler {
913                          pChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN;                          pChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN;
914                          break;                          break;
915                      }                      }
916                      case 6: { // data entry (currently only used for RPN controllers)                      case 6: { // data entry (currently only used for RPN and NRPN controllers)
917                          if (pChannel->GetMidiRpnController() == 2) { // coarse tuning in half tones                          //dmsg(1,("DATA ENTRY %d\n", itControlChangeEvent->Param.CC.Value));
918                              int transpose = (int) itControlChangeEvent->Param.CC.Value - 64;                          if (pChannel->GetMidiRpnController() >= 0) { // RPN controller number was sent previously ...
919                              // limit to +- two octaves for now                              dmsg(4,("Guess it's an RPN ...\n"));
920                              transpose = RTMath::Min(transpose,  24);                              if (pChannel->GetMidiRpnController() == 2) { // coarse tuning in half tones
921                              transpose = RTMath::Max(transpose, -24);                                  int transpose = (int) itControlChangeEvent->Param.CC.Value - 64;
922                              pChannel->GlobalTranspose = transpose;                                  // limit to +- two octaves for now
923                              // workaround, so we won't have hanging notes                                  transpose = RTMath::Min(transpose,  24);
924                              pChannel->ReleaseAllVoices(itControlChangeEvent);                                  transpose = RTMath::Max(transpose, -24);
925                                    pChannel->GlobalTranspose = transpose;
926                                    // workaround, so we won't have hanging notes
927                                    pChannel->ReleaseAllVoices(itControlChangeEvent);
928                                }
929                                // to prevent other MIDI CC #6 messages to be misenterpreted as RPN controller data
930                                pChannel->ResetMidiRpnController();
931                            } else if (pChannel->GetMidiNrpnController() >= 0) { // NRPN controller number was sent previously ...
932                                dmsg(4,("Guess it's an NRPN ...\n"));
933                                const int NrpnCtrlMSB = pChannel->GetMidiNrpnController() >> 8;
934                                const int NrpnCtrlLSB = pChannel->GetMidiNrpnController() & 0xff;
935                                dmsg(4,("NRPN MSB=%d LSB=%d Data=%d\n", NrpnCtrlMSB, NrpnCtrlLSB, itControlChangeEvent->Param.CC.Value));
936                                switch (NrpnCtrlMSB) {
937                                    case 0x1a: { // volume level of note (Roland GS NRPN)
938                                        const uint note = NrpnCtrlLSB;
939                                        const uint vol  = itControlChangeEvent->Param.CC.Value;
940                                        dmsg(4,("Note Volume NRPN received (note=%d,vol=%d).\n", note, vol));
941                                        if (note < 128 && vol < 128)
942                                            pChannel->pMIDIKeyInfo[note].Volume = VolumeCurve[vol];
943                                        break;
944                                    }
945                                    case 0x1c: { // panpot of note (Roland GS NRPN)
946                                        const uint note = NrpnCtrlLSB;
947                                        const uint pan  = itControlChangeEvent->Param.CC.Value;
948                                        dmsg(4,("Note Pan NRPN received (note=%d,pan=%d).\n", note, pan));
949                                        if (note < 128 && pan < 128) {
950                                            pChannel->pMIDIKeyInfo[note].PanLeft  = PanCurve[128 - pan];
951                                            pChannel->pMIDIKeyInfo[note].PanRight = PanCurve[pan];
952                                        }
953                                        break;
954                                    }
955                                    case 0x1d: { // reverb send of note (Roland GS NRPN)
956                                        const uint note = NrpnCtrlLSB;
957                                        const float reverb = float(itControlChangeEvent->Param.CC.Value) / 127.0f;
958                                        dmsg(4,("Note Reverb Send NRPN received (note=%d,send=%d).\n", note, reverb));
959                                        if (note < 128)
960                                            pChannel->pMIDIKeyInfo[note].ReverbSend = reverb;
961                                        break;
962                                    }
963                                    case 0x1e: { // chorus send of note (Roland GS NRPN)
964                                        const uint note = NrpnCtrlLSB;
965                                        const float chorus = float(itControlChangeEvent->Param.CC.Value) / 127.0f;
966                                        dmsg(4,("Note Chorus Send NRPN received (note=%d,send=%d).\n", note, chorus));
967                                        if (note < 128)
968                                            pChannel->pMIDIKeyInfo[note].ChorusSend = chorus;
969                                        break;
970                                    }
971                                }
972                                // to prevent other MIDI CC #6 messages to be misenterpreted as NRPN controller data
973                                pChannel->ResetMidiNrpnController();
974                          }                          }
                         // to avoid other MIDI CC #6 messages to be misenterpreted as RPN controller data  
                         pChannel->ResetMidiRpnController();  
975                          break;                          break;
976                      }                      }
977                      case 7: { // volume                      case 7: { // volume
# Line 891  namespace LinuxSampler { Line 982  namespace LinuxSampler {
982                      }                      }
983                      case 10: { // panpot                      case 10: { // panpot
984                          //TODO: not sample accurate yet                          //TODO: not sample accurate yet
                         pChannel->GlobalPanLeft  = PanCurve[128 - itControlChangeEvent->Param.CC.Value];  
                         pChannel->GlobalPanRight = PanCurve[itControlChangeEvent->Param.CC.Value];  
985                          pChannel->iLastPanRequest = itControlChangeEvent->Param.CC.Value;                          pChannel->iLastPanRequest = itControlChangeEvent->Param.CC.Value;
986                          break;                          break;
987                      }                      }
# Line 969  namespace LinuxSampler { Line 1058  namespace LinuxSampler {
1058                          }                          }
1059                          break;                          break;
1060                      }                      }
1061                        case 98: { // NRPN controller LSB
1062                            dmsg(4,("NRPN LSB %d\n", itControlChangeEvent->Param.CC.Value));
1063                            pEngineChannel->SetMidiNrpnControllerLsb(itControlChangeEvent->Param.CC.Value);
1064                            break;
1065                        }
1066                        case 99: { // NRPN controller MSB
1067                            dmsg(4,("NRPN MSB %d\n", itControlChangeEvent->Param.CC.Value));
1068                            pEngineChannel->SetMidiNrpnControllerMsb(itControlChangeEvent->Param.CC.Value);
1069                            break;
1070                        }
1071                      case 100: { // RPN controller LSB                      case 100: { // RPN controller LSB
1072                            dmsg(4,("RPN LSB %d\n", itControlChangeEvent->Param.CC.Value));
1073                          pEngineChannel->SetMidiRpnControllerLsb(itControlChangeEvent->Param.CC.Value);                          pEngineChannel->SetMidiRpnControllerLsb(itControlChangeEvent->Param.CC.Value);
1074                          break;                          break;
1075                      }                      }
1076                      case 101: { // RPN controller MSB                      case 101: { // RPN controller MSB
1077                            dmsg(4,("RPN MSB %d\n", itControlChangeEvent->Param.CC.Value));
1078                          pEngineChannel->SetMidiRpnControllerMsb(itControlChangeEvent->Param.CC.Value);                          pEngineChannel->SetMidiRpnControllerMsb(itControlChangeEvent->Param.CC.Value);
1079                          break;                          break;
1080                      }                      }
# Line 1231  namespace LinuxSampler { Line 1332  namespace LinuxSampler {
1332               *  control and status variables. This method is protected by a mutex.               *  control and status variables. This method is protected by a mutex.
1333               */               */
1334              virtual void ResetInternal() {              virtual void ResetInternal() {
1335                  ResetInternalMutex.Lock();                  LockGuard lock(ResetInternalMutex);
1336    
1337                  // make sure that the engine does not get any sysex messages                  // make sure that the engine does not get any sysex messages
1338                  // while it's reseting                  // while it's reseting
# Line 1260  namespace LinuxSampler { Line 1361  namespace LinuxSampler {
1361                  pEventQueue->init();                  pEventQueue->init();
1362                  pSysexBuffer->init();                  pSysexBuffer->init();
1363                  if (sysexDisabled) MidiInputPort::AddSysexListener(this);                  if (sysexDisabled) MidiInputPort::AddSysexListener(this);
                 ResetInternalMutex.Unlock();  
1364              }              }
1365    
1366              /**              /**
# Line 1356  namespace LinuxSampler { Line 1456  namespace LinuxSampler {
1456    
1457                  return -1;                  return -1;
1458              }              }
1459                
1460                /**
1461                 * Checks whether scale tuning setting has been changed since last
1462                 * time this method was called, if yes, it recalculates the pitch
1463                 * for all active voices.
1464                 */
1465                void ProcessScaleTuningChange() {
1466                    const bool changed = ScaleTuningChanged.readAndReset();
1467                    if (!changed) return;
1468                    
1469                    for (int i = 0; i < engineChannels.size(); i++) {
1470                        EngineChannelBase<V, R, I>* channel =
1471                            static_cast<EngineChannelBase<V, R, I>*>(engineChannels[i]);
1472                        channel->OnScaleTuningChanged();
1473                    }
1474                }
1475    
1476          private:          private:
1477              Pool<V>*    pVoicePool;            ///< Contains all voices that can be activated.              Pool<V>*    pVoicePool;            ///< Contains all voices that can be activated.

Legend:
Removed from v.2115  
changed lines
  Added in v.2448

  ViewVC Help
Powered by ViewVC