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

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

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

revision 973 by schoenebeck, Fri Dec 15 21:40:27 2006 UTC revision 1424 by schoenebeck, Sun Oct 14 22:00:17 2007 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, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2007 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program 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 25  Line 25 
25    
26  #include <algorithm>  #include <algorithm>
27    
28    #include "../common/global_private.h"
29  #include "../drivers/midi/MidiInstrumentMapper.h"  #include "../drivers/midi/MidiInstrumentMapper.h"
30    
31  #define NO_MIDI_INSTRUMENT_MAP          -1  #define NO_MIDI_INSTRUMENT_MAP          -1
# Line 40  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41          uiMidiProgram = 0;          uiMidiProgram = 0;
42          bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false;          bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false;
43          iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP;          iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP;
44            uiVoiceCount = 0;
45            uiDiskStreamCount = 0;
46            ResetMidiRpnController();
47      }      }
48    
49      void EngineChannel::SetMute(int state) throw (Exception) {      void EngineChannel::SetMute(int state) throw (Exception) {
# Line 143  namespace LinuxSampler { Line 147  namespace LinuxSampler {
147      }      }
148    
149      void EngineChannel::SetMidiInstrumentMapToNone() {      void EngineChannel::SetMidiInstrumentMapToNone() {
150            if (iMidiInstrumentMap == NO_MIDI_INSTRUMENT_MAP) return;
151          iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP;          iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP;
152            StatusChanged(true);
153      }      }
154    
155      void EngineChannel::SetMidiInstrumentMapToDefault() {      void EngineChannel::SetMidiInstrumentMapToDefault() {
156            if (iMidiInstrumentMap == DEFAULT_MIDI_INSTRUMENT_MAP) return;
157          iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP;          iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP;
158            StatusChanged(true);
159      }      }
160    
161      void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) {      void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) {
162            if (iMidiInstrumentMap == MidiMap) return;
163    
164          // check if given map actually exists in the MIDI instrument mapper          // check if given map actually exists in the MIDI instrument mapper
165          std::vector<int> maps = MidiInstrumentMapper::Maps();          std::vector<int> maps = MidiInstrumentMapper::Maps();
166          if (find(maps.begin(), maps.end(), MidiMap) == maps.end())          if (find(maps.begin(), maps.end(), MidiMap) == maps.end())
167              throw Exception("MIDI instrument map doesn't exist");              throw Exception("MIDI instrument map doesn't exist");
168          iMidiInstrumentMap = MidiMap; // assign the new map ID          iMidiInstrumentMap = MidiMap; // assign the new map ID
169            StatusChanged(true);
170        }
171    
172        void EngineChannel::SetMidiRpnControllerMsb(uint8_t CtrlMSB) {
173            uiMidiRpnMsb = CtrlMSB;
174            bMidiRpnReceived = true;
175        }
176    
177        void EngineChannel::SetMidiRpnControllerLsb(uint8_t CtrlLSB) {
178            uiMidiRpnLsb = CtrlLSB;
179            bMidiRpnReceived = true;
180        }
181    
182        void EngineChannel::ResetMidiRpnController() {
183            uiMidiRpnMsb = uiMidiRpnLsb = 0;
184            bMidiRpnReceived = false;
185        }
186    
187        int EngineChannel::GetMidiRpnController() {
188            return (bMidiRpnReceived) ? (uiMidiRpnMsb << 8) | uiMidiRpnLsb : -1;
189        }
190    
191        uint EngineChannel::GetVoiceCount() {
192            return uiVoiceCount;
193        }
194        
195        void EngineChannel::SetVoiceCount(uint Voices) {
196            uiVoiceCount = Voices;
197        }
198    
199        uint EngineChannel::GetDiskStreamCount() {
200            return uiDiskStreamCount;
201        }
202        
203        void EngineChannel::SetDiskStreamCount(uint Streams) {
204            uiDiskStreamCount = Streams;
205        }
206    
207        void EngineChannel::AddFxSendCountListener(FxSendCountListener* l) {
208            llFxSendCountListeners.AddListener(l);
209        }
210    
211        void EngineChannel::RemoveFxSendCountListener(FxSendCountListener* l) {
212            llFxSendCountListeners.RemoveListener(l);
213        }
214    
215        void EngineChannel::RemoveAllFxSendCountListeners() {
216            llFxSendCountListeners.RemoveAllListeners();
217        }
218    
219        void EngineChannel::fireFxSendCountChanged(int ChannelId, int NewCount) {
220            for (int i = 0; i < llFxSendCountListeners.GetListenerCount(); i++) {
221                llFxSendCountListeners.GetListener(i)->FxSendCountChanged(ChannelId, NewCount);
222            }
223      }      }
224    
225  } // namespace LinuxSampler  } // namespace LinuxSampler

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

  ViewVC Help
Powered by ViewVC