/[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 1017 by schoenebeck, Tue Jan 9 23:51:32 2007 UTC revision 1424 by schoenebeck, Sun Oct 14 22:00:17 2007 UTC
# 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    
30  #include <map>  #include <map>
31    
32    #define DEFAULT_FX_SEND_LEVEL   0.0f
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) {
# Line 38  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41              const int iDestination = iChanOffset + i;              const int iDestination = iChanOffset + i;
42              Routing.push_back(iDestination);              Routing.push_back(iDestination);
43          }          }
44          MidiFxSendController = MidiCtrl;          SetMidiController(MidiCtrl);
45          sName = Name;          sName = Name;
46    
47          // create an EngineChannel unique ID for this FxSend instance          // create an EngineChannel unique ID for this FxSend instance
# Line 70  namespace LinuxSampler { Line 73  namespace LinuxSampler {
73          }          }
74          __done:          __done:
75    
76          fLevel = 0.3f; // default FX send level          fLevel = DEFAULT_FX_SEND_LEVEL;
77      }      }
78    
79      int FxSend::DestinationChannel(int SrcChan) {      int FxSend::DestinationChannel(int SrcChan) {
# Line 116  namespace LinuxSampler { Line 119  namespace LinuxSampler {
119      }      }
120    
121      void FxSend::SetLevel(float f) {      void FxSend::SetLevel(float f) {
122            if(fLevel == f) return;
123          fLevel = f;          fLevel = f;
124            SetInfoChanged(true);
125      }      }
126    
127      void FxSend::SetLevel(uint8_t iMidiValue) {      void FxSend::SetLevel(uint8_t iMidiValue) {
128          fLevel = float(iMidiValue & 0x7f) / 127.0f;          fLevel = float(iMidiValue & 0x7f) / 127.0f;
129            SetInfoChanged(true);
130        }
131    
132        void FxSend::Reset() {
133            SetLevel(DEFAULT_FX_SEND_LEVEL);
134      }      }
135    
136      uint8_t FxSend::MidiController() {      uint8_t FxSend::MidiController() {
# Line 128  namespace LinuxSampler { Line 138  namespace LinuxSampler {
138      }      }
139    
140      void FxSend::SetMidiController(uint8_t MidiCtrl) throw (Exception) {      void FxSend::SetMidiController(uint8_t MidiCtrl) throw (Exception) {
141          if (MidiCtrl & 0x7f)          if (MidiCtrl >> 7)
142              throw Exception("Invalid MIDI controller");              throw Exception("Invalid MIDI controller " + ToString((int)MidiCtrl));
143          MidiFxSendController = MidiCtrl;          MidiFxSendController = MidiCtrl;
144      }      }
145    
# Line 137  namespace LinuxSampler { Line 147  namespace LinuxSampler {
147          return sName;          return sName;
148      }      }
149    
150        void FxSend::SetName(String Name) {
151            sName = Name;
152        }
153    
154      uint FxSend::Id() {      uint FxSend::Id() {
155          return iId;          return iId;
156      }      }
157    
158        void FxSend::SetInfoChanged(bool b) {
159            bInfoChanged = b;
160        }
161    
162        bool FxSend::IsInfoChanged() {
163            return bInfoChanged;
164        }
165    
166  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.1017  
changed lines
  Added in v.1424

  ViewVC Help
Powered by ViewVC