1 |
schoenebeck |
838 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
schoenebeck |
2434 |
* Copyright (C) 2006, 2007, 2013 Christian Schoenebeck * |
4 |
schoenebeck |
838 |
* * |
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 |
schoenebeck |
1424 |
#include "../../common/global_private.h" |
27 |
schoenebeck |
838 |
#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 |
schoenebeck |
880 |
ParameterName(String s) throw (Exception); |
52 |
schoenebeck |
2434 |
virtual String Description() OVERRIDE; |
53 |
|
|
virtual bool Fix() OVERRIDE; |
54 |
|
|
virtual bool Mandatory() OVERRIDE; |
55 |
|
|
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() OVERRIDE; |
56 |
|
|
virtual std::vector<String> PossibilitiesAsString(std::map<String,String> Parameters) OVERRIDE; |
57 |
|
|
virtual optional<String> DefaultAsString(std::map<String,String> Parameters) OVERRIDE; |
58 |
|
|
virtual void OnSetValue(String s) throw (Exception) OVERRIDE; |
59 |
schoenebeck |
838 |
static String Name(); |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
// derived abstract methods from class 'AudioOutputDevice' |
63 |
schoenebeck |
2434 |
virtual void Play() OVERRIDE; |
64 |
|
|
virtual bool IsPlaying() OVERRIDE; |
65 |
|
|
virtual void Stop() OVERRIDE; |
66 |
|
|
virtual uint MaxSamplesPerCycle() OVERRIDE; |
67 |
|
|
virtual uint SampleRate() OVERRIDE; |
68 |
|
|
virtual AudioChannel* CreateChannel(uint ChannelNr) OVERRIDE; |
69 |
|
|
virtual String Driver() OVERRIDE; |
70 |
|
|
|
71 |
schoenebeck |
838 |
static String Name(); |
72 |
|
|
static String Description(); |
73 |
|
|
static String Version(); |
74 |
|
|
|
75 |
|
|
protected: |
76 |
schoenebeck |
2434 |
virtual int Main() OVERRIDE; ///< Implementation of virtual method from class Thread |
77 |
schoenebeck |
838 |
|
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__ |