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

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

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

revision 889 by schoenebeck, Sat Jul 1 13:34:18 2006 UTC revision 1879 by schoenebeck, Sun Mar 29 18:43:40 2009 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2009 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   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 21  Line 21 
21  #ifndef __LS_ENGINECHANNEL_H__  #ifndef __LS_ENGINECHANNEL_H__
22  #define __LS_ENGINECHANNEL_H__  #define __LS_ENGINECHANNEL_H__
23    
24    #include "../EventListeners.h"
25  #include "../drivers/audio/AudioOutputDevice.h"  #include "../drivers/audio/AudioOutputDevice.h"
26  #include "../drivers/midi/midi.h"  #include "../drivers/midi/midi.h"
27  #include "../drivers/midi/MidiInputDevice.h"  #include "../drivers/midi/MidiInputDevice.h"
28  #include "../drivers/midi/MidiInputPort.h"  #include "../drivers/midi/MidiInputPort.h"
29    #include "../drivers/midi/VirtualMidiDevice.h"
30  #include "Engine.h"  #include "Engine.h"
31    #include "FxSend.h"
32    
33  namespace LinuxSampler {  namespace LinuxSampler {
34    
35      // just symbol prototyping      // just symbol prototyping
36        class Sampler;
37        class SamplerChannel;
38      class AudioOutputDevice;      class AudioOutputDevice;
39      class MidiInputPort;      class MidiInputPort;
40        class FxSend;
41    
42    
43      /** @brief Channel Interface for LinuxSampler Sampler Engines      /** @brief Channel Interface for LinuxSampler Sampler Engines
44       *       *
# Line 47  namespace LinuxSampler { Line 54  namespace LinuxSampler {
54      class EngineChannel {      class EngineChannel {
55          public:          public:
56    
             EngineChannel();  
   
57              /////////////////////////////////////////////////////////////////              /////////////////////////////////////////////////////////////////
58              // abstract methods              // abstract methods
59              //     (these have to be implemented by the descendant)              //     (these have to be implemented by the descendant)
# Line 57  namespace LinuxSampler { Line 62  namespace LinuxSampler {
62              virtual void    LoadInstrument() = 0;              virtual void    LoadInstrument() = 0;
63              virtual void    Reset() = 0;              virtual void    Reset() = 0;
64              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity) = 0;              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity) = 0;
65                virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) = 0;
66              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity) = 0;              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity) = 0;
67                virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) = 0;
68              virtual void    SendPitchbend(int Pitch) = 0;              virtual void    SendPitchbend(int Pitch) = 0;
69                virtual void    SendPitchbend(int Pitch, int32_t FragmentPos) = 0;
70              virtual void    SendControlChange(uint8_t Controller, uint8_t Value) = 0;              virtual void    SendControlChange(uint8_t Controller, uint8_t Value) = 0;
71                virtual void    SendControlChange(uint8_t Controller, uint8_t Value, int32_t FragmentPos) = 0;
72              virtual bool    StatusChanged(bool bNewStatus = false) = 0;              virtual bool    StatusChanged(bool bNewStatus = false) = 0;
73              virtual float   Volume() = 0;              virtual float   Volume() = 0;
74              virtual void    Volume(float f) = 0;              virtual void    Volume(float f) = 0;
75                virtual float   Pan() = 0;
76                virtual void    Pan(float f) = 0;
77              virtual uint    Channels() = 0;              virtual uint    Channels() = 0;
78              virtual void    Connect(AudioOutputDevice* pAudioOut) = 0;              virtual void    Connect(AudioOutputDevice* pAudioOut) = 0;
79              virtual void    DisconnectAudioOutputDevice() = 0;              virtual void    DisconnectAudioOutputDevice() = 0;
80                virtual AudioOutputDevice* GetAudioOutputDevice() = 0;
81              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0;              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0;
82              virtual int     OutputChannel(uint EngineAudioChannel) = 0;              virtual int     OutputChannel(uint EngineAudioChannel) = 0;
83              virtual void    Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0;              virtual void    Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0;
# Line 78  namespace LinuxSampler { Line 90  namespace LinuxSampler {
90              virtual int     InstrumentStatus() = 0;              virtual int     InstrumentStatus() = 0;
91              virtual Engine* GetEngine() = 0;              virtual Engine* GetEngine() = 0;
92              virtual String  EngineName() = 0;              virtual String  EngineName() = 0;
93                virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception) = 0;
94                virtual FxSend* GetFxSend(uint FxSendIndex) = 0;
95                virtual uint    GetFxSendCount() = 0;
96                virtual void    RemoveFxSend(FxSend* pFxSend) = 0;
97                virtual void    Connect(VirtualMidiDevice* pDevice) = 0;
98                virtual void    Disconnect(VirtualMidiDevice* pDevice) = 0;
99    
100    
101                /////////////////////////////////////////////////////////////////
102                // normal methods
103                //     (usually not to be overridden by descendant)
104    
105              /**              /**
106               * Sets the mute state of this channel.               * Sets the mute state of this channel.
# Line 111  namespace LinuxSampler { Line 134  namespace LinuxSampler {
134               */               */
135              bool GetSolo();              bool GetSolo();
136    
137              int iSamplerChannelIndex; ///< FIXME: nasty hack, might be removed (should be 'virtual EngineChannel* EngineChannel() = 0;', but due to cyclic dependencies only a void* solution would be possible ATM)              /**
138                 * Returns current MIDI program (change) number of this
139                 * EngineChannel.
140                 */
141                uint8_t GetMidiProgram();
142    
143                /**
144                 * Change EngineChannel's MIDI program.
145                 */
146                void SetMidiProgram(uint8_t Program);
147    
148                /**
149                 * Returns current MIDI bank MSB (coarse) number of this
150                 * EngineChannel.
151                 */
152                uint8_t GetMidiBankMsb();
153    
154                /**
155                 * Change current MIDI bank MSB (coarse) number of this
156                 * EngineChannel.
157                 */
158                void SetMidiBankMsb(uint8_t BankMSB);
159    
160                /**
161                 * Returns current MIDI bank LSB (fine) number of this
162                 * EngineChannel.
163                 */
164                uint8_t GetMidiBankLsb();
165    
166                /**
167                 * Change current MIDI bank LSB (fine) number of this
168                 * EngineChannel.
169                 */
170                void SetMidiBankLsb(uint8_t BankLSB);
171    
172                /**
173                 * Returns true if this EngineChannel is using no MIDI
174                 * instrument map at all, that is if it will ignore all MIDI
175                 * program change messages.
176                 *
177                 * @see UsesDefaultMidiInstrumentMap()
178                 * @see GetMidiInstrumentMap()
179                 */
180                bool UsesNoMidiInstrumentMap();
181    
182                /**
183                 * Returns true if this EngineChannel is using the default MIDI
184                 * instrument map for handling MIDI program changes.
185                 *
186                 * @see UsesNoMidiInstrumentMap()
187                 * @see GetMidiInstrumentMap()
188                 */
189                bool UsesDefaultMidiInstrumentMap();
190    
191                /**
192                 * Returns ID of the MIDI instrument map currently used by this
193                 * EngineChannel to handle MIDI program changes. You should
194                 * always call @c UsesNoMidiInstrumentMap() and
195                 * @c UsesDefaultMidiInstrumentMap() before calling this method
196                 * to check if this EngineChannel is probably using the default
197                 * map or no map at all, because in these two particular cases
198                 * this method would throw an exception!
199                 *
200                 * @throws Exception - if EngineChannel is set to no map at all
201                 *                     or is set to the default map
202                 * @see UsesNoMidiInstrumentMap()
203                 * @see UsesDefaultMidiInstrumentMap()
204                 */
205                int GetMidiInstrumentMap() throw (Exception);
206    
207                /**
208                 * Let this EngineChannel use no MIDI instrument map at all,
209                 * that is to let it ignore all MIDI program change messages.
210                 *
211                 * @see SetMidiInstrumentMapToDefault()
212                 * @see SetMidiInstrumentMap()
213                 */
214                void SetMidiInstrumentMapToNone();
215    
216                /**
217                 * Let this EngineChannel use the default MIDI instrument map to
218                 * handle MIDI program changes.
219                 *
220                 * @see SetMidiInstrumentMapToNone()
221                 * @see SetMidiInstrumentMap()
222                 */
223                void SetMidiInstrumentMapToDefault();
224    
225                /**
226                 * Set a specific MIDI instrument map this EngineChannel should
227                 * use to handle MIDI program changes.
228                 *
229                 * @see SetMidiInstrumentMapToNone()
230                 * @see SetMidiInstrumentMapToDefault()
231                 *
232                 * @throws Exception - in case given map does not exist
233                 */
234                void SetMidiInstrumentMap(int MidiMap) throw (Exception);
235    
236                /**
237                 * Set MIDI Registered Parameter Number (RPN) Controller
238                 * (upper 8 bits / coarse).
239                 */
240                void SetMidiRpnControllerMsb(uint8_t CtrlMSB);
241    
242                /**
243                 * Set MIDI Registered Parameter Number (RPN) Controller
244                 * (lower 8 bits / fine).
245                 */
246                void SetMidiRpnControllerLsb(uint8_t CtrlLSB);
247    
248                /**
249                 * Reset to no RPN controller currently selected.
250                 */
251                void ResetMidiRpnController();
252    
253                 /**
254                 * Registers the specified listener to be notified when the number
255                 * of effect sends on this channel is changed.
256                 */
257                void AddFxSendCountListener(FxSendCountListener* l);
258    
259                /**
260                 * Removes the specified listener.
261                 */
262                void RemoveFxSendCountListener(FxSendCountListener* l);
263    
264                /**
265                 * Removes all listeners.
266                 */
267                void RemoveAllFxSendCountListeners();
268    
269                /**
270                 * Get currently selected MIDI Registered Parameter Number
271                 * (RPN) Controller, this method will return the already merged
272                 * value (MSB and LSB value).
273                 *
274                 * @e WARNING: you have to call @c ResetMidiRpnController()
275                 * after using this value, otherwise all subsequent MIDI CC #6
276                 * (Data) messages are interpreted as RPN controller value
277                 * messages.
278                 *
279                 * @returns currently selected RPN controller number, a negative
280                 *          value if no RPN controller currently selected
281                 */
282                int GetMidiRpnController();
283    
284                /**
285                 * Gets the current number of active voices.
286                 */
287                uint GetVoiceCount();
288    
289                /**
290                 * Sets the current number of active voices.
291                 */
292                void SetVoiceCount(uint Voices);
293    
294                /**
295                 * Gets the current number of active disk streams.
296                 */
297                uint GetDiskStreamCount();
298    
299                /**
300                 * Sets the current number of active disk streams.
301                 */
302                void SetDiskStreamCount(uint Streams);
303    
304                SamplerChannel* GetSamplerChannel();
305    
306                void SetSamplerChannel(SamplerChannel* pChannel);
307    
308                /** Returns the sampler to which this channel belongs */
309                Sampler* GetSampler();
310    
311          protected:          protected:
312              virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory              EngineChannel();
313                virtual ~EngineChannel(); // MUST only be destroyed by EngineChannelFactory
314    
315                /**
316                 * Notifies listeners that the number of effect sends
317                 * on a this channel is changed.
318                 * @param ChannelId The numerical ID of the sampler channel.
319                 * @param NewCount The new number of sampler channels.
320                 */
321                void fireFxSendCountChanged(int ChannelId, int NewCount);
322    
323              friend class EngineChannelFactory;              friend class EngineChannelFactory;
324    
325          private:          private:
326              int  iMute;              void* pPrivateData;
             bool bSolo;  
327      };      };
328    
329  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.889  
changed lines
  Added in v.1879

  ViewVC Help
Powered by ViewVC