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 * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This library 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 * |
10 |
* the Free Software Foundation; either version 2 of the License, or * |
* the Free Software Foundation; either version 2 of the License, or * |
11 |
* (at your option) any later version. * |
* (at your option) any later version. * |
12 |
* * |
* * |
13 |
* This program is distributed in the hope that it will be useful, * |
* This library is distributed in the hope that it will be useful, * |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
* GNU General Public License for more details. * |
* GNU General Public License for more details. * |
17 |
* * |
* * |
18 |
* You should have received a copy of the GNU General Public License * |
* You should have received a copy of the GNU General Public License * |
19 |
* along with this program; if not, write to the Free Software * |
* along with this library; if not, write to the Free Software * |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
* MA 02111-1307 USA * |
* MA 02111-1307 USA * |
22 |
***************************************************************************/ |
***************************************************************************/ |
23 |
|
|
24 |
#include "AudioOutputDeviceFactory.h" |
#include "AudioOutputDeviceFactory.h" |
25 |
|
|
26 |
// just to avoid linker problems |
#if HAVE_ALSA |
27 |
#include "AudioOutputDeviceAlsa.h" |
# include "AudioOutputDeviceAlsa.h" |
28 |
#include "AudioOutputDeviceJack.h" |
#endif // HAVE_ALSA |
29 |
|
|
30 |
|
#if HAVE_JACK |
31 |
|
# include "AudioOutputDeviceJack.h" |
32 |
|
#endif // HAVE_JACK |
33 |
|
|
34 |
|
#if HAVE_ARTS |
35 |
|
# include "AudioOutputDeviceArts.h" |
36 |
|
#endif // HAVE_ARTS |
37 |
|
|
38 |
namespace LinuxSampler { |
namespace LinuxSampler { |
39 |
|
|
40 |
std::map<String, AudioOutputDeviceFactory::InnerFactory*> AudioOutputDeviceFactory::InnerFactories; |
std::map<String, AudioOutputDeviceFactory::InnerFactory*> AudioOutputDeviceFactory::InnerFactories; |
41 |
std::map<String, DeviceParameterFactory*> AudioOutputDeviceFactory::ParameterFactories; |
std::map<String, DeviceParameterFactory*> AudioOutputDeviceFactory::ParameterFactories; |
42 |
|
|
43 |
// just a little hack to avoid linker problems |
#if HAVE_ALSA |
44 |
static int ___init___foo___() { |
REGISTER_AUDIO_OUTPUT_DRIVER(AudioOutputDeviceAlsa); |
45 |
#if HAVE_ALSA |
/* Common parameters for now they'll have to be registered here. */ |
46 |
AudioOutputDeviceAlsa::Name().c_str(); |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterActive); |
47 |
#endif // HAVE_ALSA |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterSampleRate); |
48 |
#if HAVE_JACK |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterChannels); |
49 |
AudioOutputDeviceJack::Name().c_str(); |
/* Driver specific parameters */ |
50 |
#endif // HAVE_JACK |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterCard); |
51 |
return 0; |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterFragments); |
52 |
} |
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceAlsa, ParameterFragmentSize); |
53 |
static int ___foo___ = ___init___foo___(); |
#endif // HAVE_ALSA |
54 |
|
|
55 |
|
#if HAVE_JACK |
56 |
|
REGISTER_AUDIO_OUTPUT_DRIVER(AudioOutputDeviceJack); |
57 |
|
/* Common parameters for now they'll have to be registered here. */ |
58 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceJack, ParameterActive); |
59 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceJack, ParameterChannels); |
60 |
|
/* Driver specific parameters */ |
61 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceJack, ParameterName); |
62 |
|
#endif // HAVE_JACK |
63 |
|
|
64 |
|
#if HAVE_ARTS |
65 |
|
REGISTER_AUDIO_OUTPUT_DRIVER(AudioOutputDeviceArts); |
66 |
|
/* Common parameters for now they'll have to be registered here. */ |
67 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceArts, ParameterActive); |
68 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceArts, ParameterSampleRate); |
69 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceArts, ParameterChannels); |
70 |
|
/* Driver specific parameters */ |
71 |
|
REGISTER_AUDIO_OUTPUT_DRIVER_PARAMETER(AudioOutputDeviceArts, ParameterName); |
72 |
|
#endif // HAVE_ARTS |
73 |
|
|
74 |
AudioOutputDevice* AudioOutputDeviceFactory::Create(String DriverName, std::map<String,String> Parameters) throw (LinuxSamplerException) { |
AudioOutputDevice* AudioOutputDeviceFactory::Create(String DriverName, std::map<String,String> Parameters) throw (LinuxSamplerException) { |
75 |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no audio output driver '" + DriverName + "'."); |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no audio output driver '" + DriverName + "'."); |