/[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 53 by schoenebeck, Mon Apr 26 17:15:51 2004 UTC revision 123 by schoenebeck, Mon Jun 14 19:33:16 2004 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck         *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *                                                                         *   *                                                                         *
7   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
8   *   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 59  namespace LinuxSampler { namespace gig { Line 59  namespace LinuxSampler { namespace gig {
59          pVoicePool->clear();          pVoicePool->clear();
60    
61          pSynthesisParameters[0] = NULL; // we allocate when an audio device is connected          pSynthesisParameters[0] = NULL; // we allocate when an audio device is connected
62            pBasicFilterParameters  = NULL;
63            pMainFilterParameters   = NULL;
64    
65            InstrumentIdx = -1;
66    
67          ResetInternal();          ResetInternal();
68      }      }
# Line 85  namespace LinuxSampler { namespace gig { Line 89  namespace LinuxSampler { namespace gig {
89          if (pVoicePool)  delete pVoicePool;          if (pVoicePool)  delete pVoicePool;
90          if (pActiveKeys) delete pActiveKeys;          if (pActiveKeys) delete pActiveKeys;
91          if (pEventGenerator) delete pEventGenerator;          if (pEventGenerator) delete pEventGenerator;
92            if (pMainFilterParameters) delete[] pMainFilterParameters;
93            if (pBasicFilterParameters) delete[] pBasicFilterParameters;
94          if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0];          if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0];
95      }      }
96    
97      void Engine::Enable() {      void Engine::Enable() {
98          dmsg(3,("gig::Engine: enabling\n"));          dmsg(3,("gig::Engine: enabling\n"));
99          EngineDisabled.PushAndUnlock(false, 2); // set condition object 'EngineDisabled' to false (wait max. 2s)          EngineDisabled.PushAndUnlock(false, 2); // set condition object 'EngineDisabled' to false (wait max. 2s)
100          dmsg(1,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe()));          dmsg(3,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe()));
101      }      }
102    
103      void Engine::Disable() {      void Engine::Disable() {
# Line 191  namespace LinuxSampler { namespace gig { Line 197  namespace LinuxSampler { namespace gig {
197              Instruments.HandBack(pInstrument, this);              Instruments.HandBack(pInstrument, this);
198          }          }
199    
200            InstrumentIdx = -1;
201    
202          // request gig instrument from instrument manager          // request gig instrument from instrument manager
203          try {          try {
204              instrument_id_t instrid;              instrument_id_t instrid;
# Line 214  namespace LinuxSampler { namespace gig { Line 222  namespace LinuxSampler { namespace gig {
222              throw LinuxSamplerException("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file.");              throw LinuxSamplerException("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file.");
223          }          }
224    
225            InstrumentFile = FileName;
226            InstrumentIdx = Instrument;
227    
228          // inform audio driver for the need of two channels          // inform audio driver for the need of two channels
229          try {          try {
230              if (pAudioOutputDevice) pAudioOutputDevice->AcquireChannels(2); // gig Engine only stereo              if (pAudioOutputDevice) pAudioOutputDevice->AcquireChannels(2); // gig Engine only stereo
# Line 289  namespace LinuxSampler { namespace gig { Line 300  namespace LinuxSampler { namespace gig {
300          for (int dst = 1; dst < Event::destination_count; dst++)          for (int dst = 1; dst < Event::destination_count; dst++)
301              pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle();              pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle();
302    
303            // (re)allocate biquad filter parameter sequence
304            if (pBasicFilterParameters) delete[] pBasicFilterParameters;
305            if (pMainFilterParameters)  delete[] pMainFilterParameters;
306            pBasicFilterParameters = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()];
307            pMainFilterParameters  = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()];
308    
309          dmsg(1,("Starting disk thread..."));          dmsg(1,("Starting disk thread..."));
310          pDiskThread->StartThread();          pDiskThread->StartThread();
311          dmsg(1,("OK\n"));          dmsg(1,("OK\n"));
# Line 635  namespace LinuxSampler { namespace gig { Line 652  namespace LinuxSampler { namespace gig {
652       */       */
653      void Engine::ResetSynthesisParameters(Event::destination_t dst, float val) {      void Engine::ResetSynthesisParameters(Event::destination_t dst, float val) {
654          int maxsamples = pAudioOutputDevice->MaxSamplesPerCycle();          int maxsamples = pAudioOutputDevice->MaxSamplesPerCycle();
655          for (int i = 0; i < maxsamples; i++) pSynthesisParameters[dst][i] = val;          float* m = &pSynthesisParameters[dst][0];
656            for (int i = 0; i < maxsamples; i += 4) {
657               m[i]   = val;
658               m[i+1] = val;
659               m[i+2] = val;
660               m[i+3] = val;
661            }
662      }      }
663    
664      float Engine::Volume() {      float Engine::Volume() {
# Line 674  namespace LinuxSampler { namespace gig { Line 697  namespace LinuxSampler { namespace gig {
697          return pDiskThread->GetBufferFillPercentage();          return pDiskThread->GetBufferFillPercentage();
698      }      }
699    
700        String Engine::EngineName() {
701            return "GigEngine";
702        }
703    
704        String Engine::InstrumentFileName() {
705            return InstrumentFile;
706        }
707    
708        int Engine::InstrumentIndex() {
709            return InstrumentIdx;
710        }
711    
712      String Engine::Description() {      String Engine::Description() {
713          return "Gigasampler Engine";          return "Gigasampler Engine";
714      }      }
715    
716      String Engine::Version() {      String Engine::Version() {
717          return "0.0.1-0cvs20040423";          String s = "$Revision: 1.6 $";
718            return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
719      }      }
720    
721  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.53  
changed lines
  Added in v.123

  ViewVC Help
Powered by ViewVC