/[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 669 by schoenebeck, Tue Jun 21 13:33:19 2005 UTC revision 716 by iliev, Sun Jul 24 06:57:30 2005 UTC
# Line 240  namespace LinuxSampler { namespace gig { Line 240  namespace LinuxSampler { namespace gig {
240    
241          // FIXME: audio drivers with varying fragment sizes might be a problem here          // FIXME: audio drivers with varying fragment sizes might be a problem here
242          MaxFadeOutPos = MaxSamplesPerCycle - int(double(SampleRate) * CONFIG_EG_MIN_RELEASE_TIME) - 1;          MaxFadeOutPos = MaxSamplesPerCycle - int(double(SampleRate) * CONFIG_EG_MIN_RELEASE_TIME) - 1;
243          if (MaxFadeOutPos < 0)          if (MaxFadeOutPos < 0) {
244              throw LinuxSamplerException("CONFIG_EG_MIN_RELEASE_TIME too big for current audio fragment size / sampling rate!");              std::cerr << "gig::Engine: WARNING, CONFIG_EG_MIN_RELEASE_TIME "
245                          << "too big for current audio fragment size & sampling rate! "
246                          << "May lead to click sounds if voice stealing chimes in!\n" << std::flush;
247                // force volume ramp downs at the beginning of each fragment
248                MaxFadeOutPos = 0;
249                // lower minimum release time
250                const float minReleaseTime = (float) MaxSamplesPerCycle / (float) SampleRate;
251                for (RTList<Voice>::Iterator iterVoice = pVoicePool->allocAppend(); iterVoice == pVoicePool->last(); iterVoice = pVoicePool->allocAppend()) {
252                    iterVoice->pEG1->CalculateFadeOutCoeff(minReleaseTime, SampleRate);
253                }
254                pVoicePool->clear();
255            }
256    
257          // (re)create disk thread          // (re)create disk thread
258          if (this->pDiskThread) {          if (this->pDiskThread) {
# Line 481  namespace LinuxSampler { namespace gig { Line 492  namespace LinuxSampler { namespace gig {
492       *                         this audio fragment cycle       *                         this audio fragment cycle
493       */       */
494      void Engine::RenderActiveVoices(EngineChannel* pEngineChannel, uint Samples) {      void Engine::RenderActiveVoices(EngineChannel* pEngineChannel, uint Samples) {
495            #if !CONFIG_PROCESS_MUTED_CHANNELS
496            if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
497            #endif
498    
499          RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();          RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
500          RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();          RTList<uint>::Iterator end    = pEngineChannel->pActiveKeys->end();
501          while (iuiKey != end) { // iterate through all active keys          while (iuiKey != end) { // iterate through all active keys
# Line 609  namespace LinuxSampler { namespace gig { Line 624  namespace LinuxSampler { namespace gig {
624       *  @param itNoteOnEvent - key, velocity and time stamp of the event       *  @param itNoteOnEvent - key, velocity and time stamp of the event
625       */       */
626      void Engine::ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) {      void Engine::ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) {
627            #if !CONFIG_PROCESS_MUTED_CHANNELS
628            if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
629            #endif
630    
631          const int key = itNoteOnEvent->Param.Note.Key;          const int key = itNoteOnEvent->Param.Note.Key;
632    
# Line 668  namespace LinuxSampler { namespace gig { Line 686  namespace LinuxSampler { namespace gig {
686       *  @param itNoteOffEvent - key, velocity and time stamp of the event       *  @param itNoteOffEvent - key, velocity and time stamp of the event
687       */       */
688      void Engine::ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) {      void Engine::ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) {
689          midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[itNoteOffEvent->Param.Note.Key];          #if !CONFIG_PROCESS_MUTED_CHANNELS
690            if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
691            #endif
692    
693            midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[itNoteOffEvent->Param.Note.Key];
694          pKey->KeyPressed = false; // the MIDI key was now released          pKey->KeyPressed = false; // the MIDI key was now released
695    
696          // release voices on this key if needed          // release voices on this key if needed
# Line 1170  namespace LinuxSampler { namespace gig { Line 1191  namespace LinuxSampler { namespace gig {
1191                      dmsg(4,("PEDAL DOWN\n"));                      dmsg(4,("PEDAL DOWN\n"));
1192                      pEngineChannel->SustainPedal = true;                      pEngineChannel->SustainPedal = true;
1193    
1194                        #if !CONFIG_PROCESS_MUTED_CHANNELS
1195                        if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
1196                        #endif
1197    
1198                      // cancel release process of voices if necessary                      // cancel release process of voices if necessary
1199                      RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();                      RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
1200                      for (; iuiKey; ++iuiKey) {                      for (; iuiKey; ++iuiKey) {
# Line 1188  namespace LinuxSampler { namespace gig { Line 1213  namespace LinuxSampler { namespace gig {
1213                      dmsg(4,("PEDAL UP\n"));                      dmsg(4,("PEDAL UP\n"));
1214                      pEngineChannel->SustainPedal = false;                      pEngineChannel->SustainPedal = false;
1215    
1216                        #if !CONFIG_PROCESS_MUTED_CHANNELS
1217                        if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted
1218                        #endif
1219    
1220                      // release voices if their respective key is not pressed                      // release voices if their respective key is not pressed
1221                      RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();                      RTList<uint>::Iterator iuiKey = pEngineChannel->pActiveKeys->first();
1222                      for (; iuiKey; ++iuiKey) {                      for (; iuiKey; ++iuiKey) {
# Line 1412  namespace LinuxSampler { namespace gig { Line 1441  namespace LinuxSampler { namespace gig {
1441      }      }
1442    
1443      String Engine::Version() {      String Engine::Version() {
1444          String s = "$Revision: 1.47 $";          String s = "$Revision: 1.51 $";
1445          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
1446      }      }
1447    

Legend:
Removed from v.669  
changed lines
  Added in v.716

  ViewVC Help
Powered by ViewVC