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

Diff of /linuxsampler/trunk/src/engines/FxSend.cpp

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

revision 1040 by schoenebeck, Wed Feb 7 15:41:31 2007 UTC revision 2198 by iliev, Sun Jul 3 18:06:51 2011 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
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 - 2007 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2010 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   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 23  Line 23 
23    
24  #include "FxSend.h"  #include "FxSend.h"
25    
26    #include "../common/global_private.h"
27  #include "../drivers/audio/AudioOutputDevice.h"  #include "../drivers/audio/AudioOutputDevice.h"
28  #include "../common/RTMath.h"  #include "../common/RTMath.h"
29    
# Line 32  Line 33 
33    
34  namespace LinuxSampler {  namespace LinuxSampler {
35    
36      FxSend::FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name) throw (Exception) {      FxSend::FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name) throw (Exception)
37            : iDestinationEffectChain(-1), iDestinationEffectChainPos(-1), bInfoChanged(false)
38        {
39          this->pEngineChannel = pEngineChannel;          this->pEngineChannel = pEngineChannel;
40          AudioOutputDevice* pDevice = pEngineChannel->GetAudioOutputDevice();          AudioOutputDevice* pDevice = pEngineChannel->GetAudioOutputDevice();
41          const int iChanOffset = (pDevice) ? pDevice->ChannelCount() - pEngineChannel->Channels() : 0;          const int iChanOffset = (pDevice) ? pDevice->ChannelCount() - pEngineChannel->Channels() : 0;
# Line 75  namespace LinuxSampler { Line 78  namespace LinuxSampler {
78          fLevel = DEFAULT_FX_SEND_LEVEL;          fLevel = DEFAULT_FX_SEND_LEVEL;
79      }      }
80    
81        int FxSend::DestinationEffectChain() const {
82            return iDestinationEffectChain;
83        }
84    
85        int FxSend::DestinationEffectChainPosition() const {
86            return iDestinationEffectChainPos;
87        }
88    
89        void FxSend::SetDestinationEffect(int iChain, int iChainPos) throw (Exception) {
90            AudioOutputDevice* pDevice = pEngineChannel->GetAudioOutputDevice();
91            bool chainFound = false;
92            if (iChain != -1) {
93                if (pDevice->SendEffectChainByID(iChain) != NULL)  chainFound = true;
94                if (!chainFound) throw Exception(
95                    "Could not assign FX Send to send effect chain " +
96                    ToString(iChain) + ": effect chain doesn't exist."
97                );
98            }
99            if (chainFound && (iChainPos < 0 || iChainPos >= pDevice->SendEffectChainByID(iChain)->EffectCount()))
100                throw Exception(
101                    "Could not assign FX Send to send effect chain position " +
102                    ToString(iChainPos) + " of send effect chain " + ToString(iChain) +
103                    ": effect chain position out of bounds."
104                );
105            iDestinationEffectChain    = iChain;
106            iDestinationEffectChainPos = (iChain == -1 ? -1 : iChainPos);
107        }
108    
109        // TODO: to be removed
110        int FxSend::DestinationMasterEffectChain() const {
111            return DestinationEffectChain();
112        }
113    
114        // TODO: to be removed
115        int FxSend::DestinationMasterEffect() const {
116            return DestinationEffectChainPosition();
117        }
118    
119        // TODO: to be removed
120        void FxSend::SetDestinationMasterEffect(int iChain, int iChainPos) throw (Exception) {
121            SetDestinationEffect(iChain, iChainPos);
122        }
123    
124      int FxSend::DestinationChannel(int SrcChan) {      int FxSend::DestinationChannel(int SrcChan) {
125          if (SrcChan >= pEngineChannel->Channels()) return -1;          if (SrcChan >= pEngineChannel->Channels()) return -1;
126          return Routing[SrcChan];          return Routing[SrcChan];
# Line 118  namespace LinuxSampler { Line 164  namespace LinuxSampler {
164      }      }
165    
166      void FxSend::SetLevel(float f) {      void FxSend::SetLevel(float f) {
167            if(fLevel == f) return;
168          fLevel = f;          fLevel = f;
169            SetInfoChanged(true);
170      }      }
171    
172      void FxSend::SetLevel(uint8_t iMidiValue) {      void FxSend::SetLevel(uint8_t iMidiValue) {
173          fLevel = float(iMidiValue & 0x7f) / 127.0f;          fLevel = float(iMidiValue & 0x7f) / 127.0f;
174            SetInfoChanged(true);
175      }      }
176    
177      void FxSend::Reset() {      void FxSend::Reset() {
178          fLevel = DEFAULT_FX_SEND_LEVEL;          SetLevel(DEFAULT_FX_SEND_LEVEL);
179      }      }
180    
181      uint8_t FxSend::MidiController() {      uint8_t FxSend::MidiController() {
# Line 143  namespace LinuxSampler { Line 192  namespace LinuxSampler {
192          return sName;          return sName;
193      }      }
194    
195        void FxSend::SetName(String Name) {
196            sName = Name;
197        }
198    
199      uint FxSend::Id() {      uint FxSend::Id() {
200          return iId;          return iId;
201      }      }
202    
203        void FxSend::SetInfoChanged(bool b) {
204            bInfoChanged = b;
205        }
206    
207        bool FxSend::IsInfoChanged() {
208            return bInfoChanged;
209        }
210    
211  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.1040  
changed lines
  Added in v.2198

  ViewVC Help
Powered by ViewVC