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

Contents of /linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceJack.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 880 - (show annotations) (download) (as text)
Tue Jun 27 22:57:37 2006 UTC (17 years, 9 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 6557 byte(s)
just some refactoring work:
- renamed class LinuxSamplerException -> Exception
- encapsulated LS API relevant files into LS namespace
- removed unnecessary header inclusions

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * 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 *
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_AUDIOOUTPUTDEVICEJACK_H__
25 #define __LS_AUDIOOUTPUTDEVICEJACK_H__
26
27 #include "../../common/global.h"
28
29 #if HAVE_JACK
30
31 #include <vector>
32 #include <sstream>
33 #include <jack/jack.h>
34
35 #include "AudioOutputDevice.h"
36 #include "../../common/ConditionServer.h"
37
38 namespace LinuxSampler {
39
40 /** JACK audio output driver
41 *
42 * Implements audio output to the JACK Audio Connection Kit (JACK).
43 */
44 class AudioOutputDeviceJack : public AudioOutputDevice {
45 public:
46 AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters);
47 virtual ~AudioOutputDeviceJack();
48
49 /**
50 * Audio channel implementation for the JACK audio driver.
51 */
52 class AudioChannelJack : public AudioChannel {
53 public:
54 /** Audio Channel Parameter 'NAME'
55 *
56 * Used to assign an arbitrary name to an audio channel.
57 */
58 class ParameterName : public AudioChannel::ParameterName {
59 public:
60 ParameterName(AudioChannelJack* pChannel);
61 virtual void OnSetValue(String s);
62 protected:
63 AudioChannelJack* pChannel;
64 };
65
66 /** Audio Channel Parameter 'JACK_BINDINGS'
67 *
68 * Used to connect to other JACK clients.
69 */
70 class ParameterJackBindings : public DeviceRuntimeParameterStrings {
71 public:
72 ParameterJackBindings(AudioChannelJack* pChannel);
73 virtual String Description();
74 virtual bool Fix();
75 virtual std::vector<String> PossibilitiesAsString();
76 virtual void OnSetValue(std::vector<String> vS);
77 static String Name();
78 protected:
79 AudioChannelJack* pChannel;
80 std::vector<String> Bindings;
81 };
82 protected:
83 AudioChannelJack(uint ChannelNr, AudioOutputDeviceJack* pDevice) throw (AudioOutputException);
84 ~AudioChannelJack();
85 friend class AudioOutputDeviceJack;
86 private:
87 AudioOutputDeviceJack* pDevice;
88 jack_port_t* hJackPort;
89 uint ChannelNr;
90
91 float* CreateJackPort(uint ChannelNr, AudioOutputDeviceJack* pDevice) throw (AudioOutputException);
92 };
93
94 /** Audio Device Parameter 'NAME'
95 *
96 * Used to assign an arbitrary name to the JACK client of this
97 * audio device.
98 */
99 class ParameterName : public DeviceCreationParameterString {
100 public:
101 ParameterName();
102 ParameterName(String s) throw (Exception);
103 virtual String Description();
104 virtual bool Fix();
105 virtual bool Mandatory();
106 virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
107 virtual std::vector<String> PossibilitiesAsString(std::map<String,String> Parameters);
108 virtual optional<String> DefaultAsString(std::map<String,String> Parameters);
109 virtual void OnSetValue(String s) throw (Exception);
110 static String Name();
111 };
112
113 // derived abstract methods from class 'AudioOutputDevice'
114 virtual void Play();
115 virtual bool IsPlaying();
116 virtual void Stop();
117 virtual uint MaxSamplesPerCycle();
118 virtual uint SampleRate();
119 virtual AudioChannel* CreateChannel(uint ChannelNr);
120
121
122 static String Name();
123
124 virtual String Driver();
125
126 static String Description();
127 static String Version();
128
129 int Process(uint Samples); // FIXME: should be private
130 protected:
131 AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0);
132 private:
133 ConditionServer csIsPlaying;
134 uint uiMaxSamplesPerCycle;
135 jack_client_t* hJackClient;
136 };
137
138 // Callback functions for the libjack API
139 int __libjack_process_callback(jack_nframes_t nframes, void* arg);
140 void __libjack_shutdown_callback(void* arg);
141 }
142
143 #endif // HAVE_JACK
144 #endif // __LS_AUDIOOUTPUTDEVICEJACK_H__

  ViewVC Help
Powered by ViewVC