/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDevice.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/audio/AudioOutputDevice.h

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

revision 411 by schoenebeck, Sat Feb 26 02:01:14 2005 UTC revision 2135 by schoenebeck, Thu Sep 30 20:00:43 2010 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 Christian Schoenebeck                              *   *   Copyright (C) 2005 - 2009 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 30  Line 30 
30  #include <stdexcept>  #include <stdexcept>
31    
32  #include "../../common/global.h"  #include "../../common/global.h"
33  #include "../../common/LinuxSamplerException.h"  #include "../../common/Exception.h"
34  #include "../Device.h"  #include "../Device.h"
35  #include "../DeviceParameter.h"  #include "../DeviceParameter.h"
36  #include "../../engines/common/EngineChannel.h"  #include "../../engines/Engine.h"
37  #include "AudioChannel.h"  #include "AudioChannel.h"
38    #include "../../common/SynchronizedConfig.h"
39    #include "../../effects/EffectChain.h"
40    
41  namespace LinuxSampler {  namespace LinuxSampler {
42    
43      // just symbol prototyping      // just symbol prototyping
44      class EngineChannel;      class Engine;
45        class AudioOutputDeviceFactory;
46        class IDGenerator;
47    
48      /** Abstract base class for audio output drivers in LinuxSampler      /** Abstract base class for audio output drivers in LinuxSampler
49       *       *
# Line 66  namespace LinuxSampler { Line 70  namespace LinuxSampler {
70                      virtual bool   Mandatory();                      virtual bool   Mandatory();
71                      virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();                      virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
72                      virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters);                      virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters);
73                      virtual void OnSetValue(bool b) throw (LinuxSamplerException);                      virtual void OnSetValue(bool b) throw (Exception);
74                      static String Name();                      static String Name();
75              };              };
76    
# Line 86  namespace LinuxSampler { Line 90  namespace LinuxSampler {
90                      virtual optional<int>    RangeMinAsInt(std::map<String,String> Parameters);                      virtual optional<int>    RangeMinAsInt(std::map<String,String> Parameters);
91                      virtual optional<int>    RangeMaxAsInt(std::map<String,String> Parameters);                      virtual optional<int>    RangeMaxAsInt(std::map<String,String> Parameters);
92                      virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);                      virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
93                      virtual void             OnSetValue(int i) throw (LinuxSamplerException);                      virtual int              ValueAsInt();
94                        virtual void             OnSetValue(int i) throw (Exception);
95                      static String Name();                      static String Name();
96              };              };
97    
# Line 107  namespace LinuxSampler { Line 112  namespace LinuxSampler {
112                      virtual optional<int>    RangeMinAsInt(std::map<String,String> Parameters);                      virtual optional<int>    RangeMinAsInt(std::map<String,String> Parameters);
113                      virtual optional<int>    RangeMaxAsInt(std::map<String,String> Parameters);                      virtual optional<int>    RangeMaxAsInt(std::map<String,String> Parameters);
114                      virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);                      virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
115                      virtual void             OnSetValue(int i) throw (LinuxSamplerException);                      virtual void             OnSetValue(int i) throw (Exception);
116                      static String Name();                      static String Name();
117              };              };
118    
# Line 189  namespace LinuxSampler { Line 194  namespace LinuxSampler {
194               * device and the engine will also automatically be informed               * device and the engine will also automatically be informed
195               * about the connection.               * about the connection.
196               *               *
197               * @param pEngineChannel - sampler engine channel               * @param pEngine - sampler engine
198               */               */
199              void Connect(EngineChannel* pEngineChannel);              void Connect(Engine* pEngine);
200    
201              /**              /**
202               * Disconnect given sampler engine from this audio output device.               * Disconnect given sampler engine from this audio output device.
203               * Removes given sampler engine reference from the Engines               * Removes given sampler engine reference from the Engines
204               * container of this audio device.               * container of this audio device.
205               *               *
206               * @param pEngineChannel - sampler engine channel               * @param pEngine - sampler engine
207               */               */
208              void Disconnect(EngineChannel* pEngineChannel);              void Disconnect(Engine* pEngine);
209    
210              /**              /**
211               * Returns audio channel with index \a ChannelIndex or NULL if               * Returns audio channel with index \a ChannelIndex or NULL if
# Line 229  namespace LinuxSampler { Line 234  namespace LinuxSampler {
234              void AcquireChannels(uint Channels);              void AcquireChannels(uint Channels);
235    
236              /**              /**
237                 * Returns the amount of audio channels (including the so called
238                 * "mix channels") the device is currently providing.
239                 */
240                uint ChannelCount();
241    
242                /**
243               * Returns all device parameter settings.               * Returns all device parameter settings.
244               */               */
245              std::map<String,DeviceCreationParameter*> DeviceParameters();              std::map<String,DeviceCreationParameter*> DeviceParameters();
246    
247                /**
248                 * Add a chain of master effects to this AudioOutputDevice.
249                 * You actually have to add effects to that chain afterwards.
250                 */
251                EffectChain* AddMasterEffectChain();
252    
253                /**
254                 * Remove the master effect chain given by @a iChain .
255                 *
256                 * @throws Exception - if given master effect chain doesn't exist
257                 */
258                void RemoveMasterEffectChain(uint iChain) throw (Exception);
259    
260                /**
261                 * Returns master effect chain given by @a iChain or @c NULL if
262                 * there's no such effect chain.
263                 */
264                EffectChain* MasterEffectChain(uint iChain) const;
265    
266                /**
267                 * Returns amount of master effect chains this AudioOutputDevice
268                 * currently provides.
269                 */
270                uint MasterEffectChainCount() const;
271    
272          protected:          protected:
273              std::set<EngineChannel*>                  EngineChannels; ///< All sampler engine channels that are connected to the audio output device.              SynchronizedConfig<std::set<Engine*> >    Engines;     ///< All sampler engines that are connected to the audio output device.
274                SynchronizedConfig<std::set<Engine*> >::Reader EnginesReader; ///< Audio thread access to Engines.
275              std::vector<AudioChannel*>                Channels;    ///< All audio channels of the audio output device. This is just a container; the descendant has to create channels by himself.              std::vector<AudioChannel*>                Channels;    ///< All audio channels of the audio output device. This is just a container; the descendant has to create channels by himself.
276              std::map<String,DeviceCreationParameter*> Parameters;  ///< All device parameters.              std::map<String,DeviceCreationParameter*> Parameters;  ///< All device parameters.
277                std::vector<EffectChain*>                 vEffectChains;
278                IDGenerator*                              EffectChainIDs;
279    
280              AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters);              AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters);
281    
# Line 267  namespace LinuxSampler { Line 306  namespace LinuxSampler {
306               */               */
307              int RenderSilence(uint Samples);              int RenderSilence(uint Samples);
308    
309              friend class Sampler; // allow Sampler class to destroy audio devices              friend class AudioOutputDeviceFactory; // allow AudioOutputDeviceFactory class to destroy audio devices
310    
311      };      };
312    
# Line 277  namespace LinuxSampler { Line 316  namespace LinuxSampler {
316       * (which should be done in the constructor of the AudioOutputDevice       * (which should be done in the constructor of the AudioOutputDevice
317       * descendant).       * descendant).
318       */       */
319      class AudioOutputException : public LinuxSamplerException {      class AudioOutputException : public Exception {
320          public:          public:
321              AudioOutputException(const std::string& msg) : LinuxSamplerException(msg) {}              AudioOutputException(const std::string& msg) : Exception(msg) {}
322      };      };
323  }  }
324    

Legend:
Removed from v.411  
changed lines
  Added in v.2135

  ViewVC Help
Powered by ViewVC