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

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

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

revision 554 by schoenebeck, Thu May 19 19:25:14 2005 UTC revision 670 by schoenebeck, Tue Jun 21 18:00:52 2005 UTC
# Line 49  namespace LinuxSampler { namespace gig { Line 49  namespace LinuxSampler { namespace gig {
49          InstrumentStat = -1;          InstrumentStat = -1;
50          AudioDeviceChannelLeft  = -1;          AudioDeviceChannelLeft  = -1;
51          AudioDeviceChannelRight = -1;          AudioDeviceChannelRight = -1;
52            ResetControllers();
53      }      }
54    
55      EngineChannel::~EngineChannel() {      EngineChannel::~EngineChannel() {
# Line 60  namespace LinuxSampler { namespace gig { Line 61  namespace LinuxSampler { namespace gig {
61      }      }
62    
63      /**      /**
64         * Implementation of virtual method from abstract EngineChannel interface.
65         * This method will periodically be polled (e.g. by the LSCP server) to
66         * check if some engine channel parameter has changed since the last
67         * StatusChanged() call.
68         *
69         * This method can also be used to mark the engine channel as changed
70         * from outside, e.g. by a MIDI input device. The optional argument
71         * \a nNewStatus can be used for this.
72         *
73         * TODO: This "poll method" is just a lazy solution and might be
74         *       replaced in future.
75         * @param bNewStatus - (optional, default: false) sets the new status flag
76         * @returns true if engine channel status has changed since last
77         *          StatusChanged() call
78         */
79        bool EngineChannel::StatusChanged(bool bNewStatus) {
80            bool b = bStatusChanged;
81            bStatusChanged = bNewStatus;
82            return b;
83        }
84    
85        void EngineChannel::Reset() {
86            if (pEngine) pEngine->DisableAndLock();
87            ResetInternal();
88            ResetControllers();
89            if (pEngine) {
90                pEngine->Enable();
91                pEngine->Reset();
92            }
93        }
94    
95        /**
96       * This method is not thread safe!       * This method is not thread safe!
97       */       */
98      void EngineChannel::ResetInternal() {      void EngineChannel::ResetInternal() {
         Pitch               = 0;  
         SustainPedal        = false;  
         GlobalVolume        = 1.0;  
         GlobalPanLeft       = 1.0f;  
         GlobalPanRight      = 1.0f;  
99          CurrentKeyDimension = 0;          CurrentKeyDimension = 0;
100    
         ResetControllers();  
   
101          // reset key info          // reset key info
102          for (uint i = 0; i < 128; i++) {          for (uint i = 0; i < 128; i++) {
103              if (pMIDIKeyInfo[i].pActiveVoices)              if (pMIDIKeyInfo[i].pActiveVoices)
# Line 96  namespace LinuxSampler { namespace gig { Line 122  namespace LinuxSampler { namespace gig {
122          pEventQueue->init();          pEventQueue->init();
123    
124          if (pEngine) pEngine->ResetInternal();          if (pEngine) pEngine->ResetInternal();
125    
126            // status of engine channel has changed, so set notify flag
127            bStatusChanged = true;
128      }      }
129    
130      LinuxSampler::Engine* EngineChannel::GetEngine() {      LinuxSampler::Engine* EngineChannel::GetEngine() {
# Line 208  namespace LinuxSampler { namespace gig { Line 237  namespace LinuxSampler { namespace gig {
237      void EngineChannel::ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg) {      void EngineChannel::ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg) {
238          this->pInstrument = pNewResource; //TODO: there are couple of engine parameters we should update here as well if the instrument was updated (see LoadInstrument())          this->pInstrument = pNewResource; //TODO: there are couple of engine parameters we should update here as well if the instrument was updated (see LoadInstrument())
239          if (pEngine) pEngine->Enable();          if (pEngine) pEngine->Enable();
240            bStatusChanged = true; // status of engine has changed, so set notify flag
241      }      }
242    
243      /**      /**
# Line 219  namespace LinuxSampler { namespace gig { Line 249  namespace LinuxSampler { namespace gig {
249      void EngineChannel::OnResourceProgress(float fProgress) {      void EngineChannel::OnResourceProgress(float fProgress) {
250          this->InstrumentStat = int(fProgress * 100.0f);          this->InstrumentStat = int(fProgress * 100.0f);
251          dmsg(7,("gig::EngineChannel: progress %d%", InstrumentStat));          dmsg(7,("gig::EngineChannel: progress %d%", InstrumentStat));
252            bStatusChanged = true; // status of engine has changed, so set notify flag
253      }      }
254    
255      void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {      void EngineChannel::Connect(AudioOutputDevice* pAudioOut) {
# Line 400  namespace LinuxSampler { namespace gig { Line 431  namespace LinuxSampler { namespace gig {
431      }      }
432    
433      void EngineChannel::ResetControllers() {      void EngineChannel::ResetControllers() {
434            Pitch          = 0;
435            SustainPedal   = false;
436            GlobalVolume   = 1.0;
437            GlobalPanLeft  = 1.0f;
438            GlobalPanRight = 1.0f;
439          // set all MIDI controller values to zero          // set all MIDI controller values to zero
440          memset(ControllerTable, 0x00, 128);          memset(ControllerTable, 0x00, 128);
441      }      }
# Line 446  namespace LinuxSampler { namespace gig { Line 482  namespace LinuxSampler { namespace gig {
482    
483      void EngineChannel::Volume(float f) {      void EngineChannel::Volume(float f) {
484          GlobalVolume = f;          GlobalVolume = f;
485            bStatusChanged = true; // status of engine channel has changed, so set notify flag
486      }      }
487    
488      uint EngineChannel::Channels() {      uint EngineChannel::Channels() {
# Line 471  namespace LinuxSampler { namespace gig { Line 508  namespace LinuxSampler { namespace gig {
508      String EngineChannel::EngineName() {      String EngineChannel::EngineName() {
509          return LS_GIG_ENGINE_NAME;          return LS_GIG_ENGINE_NAME;
510      }      }
511        
512  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.554  
changed lines
  Added in v.670

  ViewVC Help
Powered by ViewVC