/[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 1662 by schoenebeck, Sun Feb 3 16:21:38 2008 UTC revision 1826 by iliev, Sat Jan 24 14:32:35 2009 UTC
# Line 24  Line 24 
24  #include "EngineChannel.h"  #include "EngineChannel.h"
25    
26  #include "../../common/global_private.h"  #include "../../common/global_private.h"
27    #include "../../Sampler.h"
28    
29  namespace LinuxSampler { namespace gig {  namespace LinuxSampler { namespace gig {
30    
# Line 63  namespace LinuxSampler { namespace gig { Line 64  namespace LinuxSampler { namespace gig {
64    
65      EngineChannel::~EngineChannel() {      EngineChannel::~EngineChannel() {
66          DisconnectAudioOutputDevice();          DisconnectAudioOutputDevice();
67    
68            // In case the channel was removed before the instrument was
69            // fully loaded, try to give back instrument again (see bug #113)
70            instrument_change_command_t& cmd = ChangeInstrument(NULL);
71            if (cmd.pInstrument) {
72                    Engine::instruments.HandBack(cmd.pInstrument, this);
73            }
74            ///////
75    
76          if (pEventQueue) delete pEventQueue;          if (pEventQueue) delete pEventQueue;
77          if (pActiveKeys) delete pActiveKeys;          if (pActiveKeys) delete pActiveKeys;
78          if (pMIDIKeyInfo) delete[] pMIDIKeyInfo;          if (pMIDIKeyInfo) delete[] pMIDIKeyInfo;
# Line 329  namespace LinuxSampler { namespace gig { Line 339  namespace LinuxSampler { namespace gig {
339                  // release the currently loaded instrument                  // release the currently loaded instrument
340                  Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d);                  Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d);
341              }              }
342    
343              if (d) delete d;              if (d) delete d;
344    
345              // release all active dimension regions to resource              // release all active dimension regions to resource
# Line 451  namespace LinuxSampler { namespace gig { Line 462  namespace LinuxSampler { namespace gig {
462          }          }
463          fxSends.push_back(pFxSend);          fxSends.push_back(pFxSend);
464          if (pEngine) pEngine->Enable();          if (pEngine) pEngine->Enable();
465          fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount());          fireFxSendCountChanged(GetSamplerChannel()->Index(), GetFxSendCount());
466    
467          return pFxSend;          return pFxSend;
468      }      }
# Line 490  namespace LinuxSampler { namespace gig { Line 501  namespace LinuxSampler { namespace gig {
501              }              }
502          }          }
503          if (pEngine) pEngine->Enable();          if (pEngine) pEngine->Enable();
504          fireFxSendCountChanged(iSamplerChannelIndex, GetFxSendCount());          fireFxSendCountChanged(GetSamplerChannel()->Index(), GetFxSendCount());
505      }      }
506    
507      /**      /**
# Line 737  namespace LinuxSampler { namespace gig { Line 748  namespace LinuxSampler { namespace gig {
748          MidiVolume     = 1.0;          MidiVolume     = 1.0;
749          GlobalPanLeft  = 1.0f;          GlobalPanLeft  = 1.0f;
750          GlobalPanRight = 1.0f;          GlobalPanRight = 1.0f;
751            iLastPanRequest = 64;
752          GlobalTranspose = 0;          GlobalTranspose = 0;
753          // set all MIDI controller values to zero          // set all MIDI controller values to zero
754          memset(ControllerTable, 0x00, 129);          memset(ControllerTable, 0x00, 129);
# Line 875  namespace LinuxSampler { namespace gig { Line 887  namespace LinuxSampler { namespace gig {
887          bStatusChanged = true; // status of engine channel has changed, so set notify flag          bStatusChanged = true; // status of engine channel has changed, so set notify flag
888      }      }
889    
890        float EngineChannel::Pan() {
891            return float(iLastPanRequest - 64) / 64.0f;
892        }
893    
894        void EngineChannel::Pan(float f) {
895            int iMidiPan = int(f * 64.0f) + 64;
896            if (iMidiPan > 127) iMidiPan = 127;
897            else if (iMidiPan < 0) iMidiPan = 0;
898            GlobalPanLeft  = Engine::PanCurve[128 - iMidiPan];
899            GlobalPanRight = Engine::PanCurve[iMidiPan];
900            iLastPanRequest = iMidiPan;
901        }
902    
903      uint EngineChannel::Channels() {      uint EngineChannel::Channels() {
904          return 2;          return 2;
905      }      }

Legend:
Removed from v.1662  
changed lines
  Added in v.1826

  ViewVC Help
Powered by ViewVC