linuxsampler 2.3.1
AudioOutputDevice.h
Go to the documentation of this file.
1/***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2013 Christian Schoenebeck *
7 * *
8 * 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 *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 ***************************************************************************/
23
24#ifndef __LS_AUDIOOUTPUTDEVICE_H__
25#define __LS_AUDIOOUTPUTDEVICE_H__
26
27#include <set>
28#include <map>
29#include <vector>
30#include <stdexcept>
31
32#include "../../common/global.h"
33#include "../../common/Exception.h"
34#include "../Device.h"
35#include "../DeviceParameter.h"
36#include "../../engines/Engine.h"
37#include "AudioChannel.h"
38#include "../../common/SynchronizedConfig.h"
39#include "../../effects/EffectChain.h"
40
41namespace LinuxSampler {
42
43 // just symbol prototyping
44 class Engine;
45 class AudioOutputDeviceFactory;
46 class IDGenerator;
47
54 class AudioOutputDevice : public Device {
55 public:
56
58 // Device parameters
59
76
97
118
119
120
122 // abstract methods
123 // (these have to be implemented by the descendant)
124
139 virtual void Play() = 0;
140
144 virtual bool IsPlaying() = 0;
145
152 virtual void Stop() = 0;
153
164
173
178
184
201
202
203
205 // normal methods
206 // (usually not to be overriden by descendant)
207
217
226
240
246
266
272
277
283
290
296
302
308
313
318
323
328
329 protected:
336
338
340
354
365
366 friend class AudioOutputDeviceFactory; // allow AudioOutputDeviceFactory class to destroy audio devices
367
368 };
369
377 public:
378 AudioOutputException(const std::string& msg) : Exception(msg) {}
379 };
380}
381
382#endif // __LS_AUDIOOUTPUTDEVICE_H__
Audio Channel (always mono)
virtual std::map< String, DeviceCreationParameter * > DependsAsParameters() OVERRIDE
Might return a unique key-value pair list (map) reflecting the dependencies of this parameter to othe...
virtual optional< bool > DefaultAsBool(std::map< String, String > Parameters) OVERRIDE
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
virtual bool Fix() OVERRIDE
Whether the parameter is read only.
virtual bool Mandatory() OVERRIDE
Whether the parameter must be supplied by the user at device creation time.
virtual void OnSetValue(bool b) OVERRIDE
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
Abstract base class for audio output drivers in LinuxSampler.
void ReconnectAll()
This method can or should be called by the deriving driver in case some fundamental parameter changed...
virtual uint MaxSamplesPerCycle()=0
Maximum amount of sample points the implementing audio device will ever demand the sampler engines to...
EffectChain * SendEffectChain(uint iChain) const
Returns send effect chain given by iChain or NULL if there's no such effect chain.
uint SendEffectChainCount() const
Returns amount of send effect chains this AudioOutputDevice currently provides.
virtual AudioChannel * CreateChannel(uint ChannelNr)=0
Create new audio channel.
void AcquireChannels(uint Channels)
This method will usually be called by the sampler engines that are connected to this audio device to ...
virtual void Stop()=0
Stop playback of audio signal on the audio device.
virtual uint SampleRate()=0
Playback samplerate the audio device uses.
SynchronizedConfig< std::set< Engine * > >::Reader EnginesReader
Audio thread access to Engines.
EffectChain * SendEffectChainByID(uint iChainID) const
Returns send effect chain with ID iChainID or NULL if there's no such effect chain.
void Disconnect(Engine *pEngine)
Disconnect given sampler engine from this audio output device.
void RemoveMasterEffectChain(uint iChain) DEPRECATED_API
int RenderAudio(uint Samples)
This method should be called by the AudioOutputDevice descendant to let all connected engines proceed...
virtual bool IsPlaying()=0
Returns true if the audio device is currently playing back.
void Connect(Engine *pEngine)
Connect given sampler engine to this audio output device.
SynchronizedConfig< std::set< Engine * > > Engines
All sampler engines that are connected to the audio output device.
virtual float latency()
Might be optionally implemented by the deriving driver.
EffectChain * MasterEffectChain(uint iChain) const DEPRECATED_API
virtual String Driver()=0
Return the audio output device driver name.
EffectChain * AddMasterEffectChain() DEPRECATED_API
std::vector< EffectChain * > vEffectChains
std::vector< AudioChannel * > Channels
All audio channels of the audio output device. This is just a container; the descendant has to create...
int RenderSilence(uint Samples)
This can be called as an alternative to RenderAudio() for just writing silence to the audio output bu...
virtual void Play()=0
Start playback of audio signal on the audio device.
void RemoveSendEffectChain(uint iChain)
Remove the send effect chain given by iChain .
uint MasterEffectChainCount() const DEPRECATED_API
uint ChannelCount()
Returns the amount of audio channels (including the so called "mix channels") the device is currently...
AudioChannel * Channel(uint ChannelIndex)
Returns audio channel with index ChannelIndex or NULL if index out of bounds.
std::map< String, DeviceCreationParameter * > Parameters
All device parameters.
EffectChain * AddSendEffectChain()
Add a chain of send effects to this AudioOutputDevice.
std::map< String, DeviceCreationParameter * > DeviceParameters()
Returns all device parameter settings.
Audio output exception that should be thrown by the AudioOutputDevice descendants in case initializat...
AudioOutputException(const std::string &msg)
Abstract base class for driver parameters of type Bool.
Abstract base class for driver parameters of type int.
Abstract base class for parameters at driver instanciation time.
Abstract base class for all kind of drivers in LinuxSampler.
Definition Device.h:35
LinuxSampler Sampler Engine Interface.
Definition Engine.h:41
Exception that will be thrown in NON REAL TIME PARTS of the LinuxSampler application.
Definition Exception.h:37
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...
Thread-safe management of configuration data, where the data is updated by a single non real time thr...
#define DEPRECATED_API
Definition global.h:71
#define OVERRIDE
Definition global.h:84
std::string String
Definition global.h:44