1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2006 Christian Schoenebeck * |
4 |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
7 |
* the Free Software Foundation; either version 2 of the License, or * |
8 |
* (at your option) any later version. * |
9 |
* * |
10 |
* This library is distributed in the hope that it will be useful, * |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
* GNU General Public License for more details. * |
14 |
* * |
15 |
* You should have received a copy of the GNU General Public License * |
16 |
* along with this library; if not, write to the Free Software * |
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
18 |
* MA 02111-1307 USA * |
19 |
***************************************************************************/ |
20 |
|
21 |
#ifndef __LS_AUDIOOUTPUTDEVICEARTS_H__ |
22 |
#define __LS_AUDIOOUTPUTDEVICEARTS_H__ |
23 |
|
24 |
#include <artsc.h> |
25 |
|
26 |
#include "../../common/global.h" |
27 |
#include "../../common/Thread.h" |
28 |
#include "AudioOutputDevice.h" |
29 |
#include "AudioChannel.h" |
30 |
#include "../DeviceParameter.h" |
31 |
|
32 |
namespace LinuxSampler { |
33 |
|
34 |
/** aRts audio output driver |
35 |
* |
36 |
* Implements audio output to the Analog Realtime Synthesizer (aRts). |
37 |
*/ |
38 |
class AudioOutputDeviceArts : public AudioOutputDevice, protected Thread { |
39 |
public: |
40 |
AudioOutputDeviceArts(std::map<String,DeviceCreationParameter*> Parameters); |
41 |
~AudioOutputDeviceArts(); |
42 |
|
43 |
/** Audio Device Parameter 'NAME' |
44 |
* |
45 |
* Used to assign an arbitrary name to the aRts client of this |
46 |
* audio device. |
47 |
*/ |
48 |
class ParameterName : public DeviceCreationParameterString { |
49 |
public: |
50 |
ParameterName(); |
51 |
ParameterName(String s) throw (LinuxSamplerException); |
52 |
virtual String Description(); |
53 |
virtual bool Fix(); |
54 |
virtual bool Mandatory(); |
55 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
56 |
virtual std::vector<String> PossibilitiesAsString(std::map<String,String> Parameters); |
57 |
virtual optional<String> DefaultAsString(std::map<String,String> Parameters); |
58 |
virtual void OnSetValue(String s) throw (LinuxSamplerException); |
59 |
static String Name(); |
60 |
}; |
61 |
|
62 |
// derived abstract methods from class 'AudioOutputDevice' |
63 |
virtual void Play(); |
64 |
virtual bool IsPlaying(); |
65 |
virtual void Stop(); |
66 |
virtual uint MaxSamplesPerCycle(); |
67 |
virtual uint SampleRate(); |
68 |
virtual AudioChannel* CreateChannel(uint ChannelNr); |
69 |
|
70 |
virtual String Driver(); |
71 |
static String Name(); |
72 |
static String Description(); |
73 |
static String Version(); |
74 |
|
75 |
protected: |
76 |
int Main(); ///< Implementation of virtual method from class Thread |
77 |
|
78 |
private: |
79 |
unsigned int uiArtsChannels; |
80 |
unsigned int uiSampleRate; |
81 |
unsigned int FragmentSize; |
82 |
unsigned int uiPacketSize; |
83 |
arts_stream_t hStream; |
84 |
int16_t* pArtsOutputBuffer; |
85 |
}; |
86 |
}; |
87 |
|
88 |
#endif // __LS_AUDIOOUTPUTDEVICEARTS_H__ |