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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 374 - (hide annotations) (download) (as text)
Sat Feb 12 00:36:08 2005 UTC (19 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 6444 byte(s)
* JACK audio driver: added device creation parameter 'NAME' which can be
  used to assign an arbitrary name to the JACK client, it's now possible to
  create multiple JACK audio output devices simultaniously for LS
* src/network/lscpserver.cpp: fixed little bug in
  'SET CHANNEL AUDIO_OUTPUT_CHANNEL' (altering of audio routing)
  implementation, cleanup of error messages

1 schoenebeck 200 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * *
7     * This program is free software; you can redistribute it and/or modify *
8     * it under the terms of the GNU General Public License as published by *
9     * the Free Software Foundation; either version 2 of the License, or *
10     * (at your option) any later version. *
11     * *
12     * This program is distributed in the hope that it will be useful, *
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15     * GNU General Public License for more details. *
16     * *
17     * You should have received a copy of the GNU General Public License *
18     * along with this program; if not, write to the Free Software *
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20     * MA 02111-1307 USA *
21     ***************************************************************************/
22    
23     #ifndef __LS_AUDIOOUTPUTDEVICEJACK_H__
24     #define __LS_AUDIOOUTPUTDEVICEJACK_H__
25    
26     #include "../../common/global.h"
27    
28     #if HAVE_JACK
29    
30     #include <vector>
31     #include <sstream>
32     #include <jack/jack.h>
33    
34     #include "AudioOutputDevice.h"
35     #include "../../common/ConditionServer.h"
36    
37     namespace LinuxSampler {
38    
39     /** JACK audio output driver
40     *
41     * Implements audio output to the JACK Audio Connection Kit (JACK).
42     */
43     class AudioOutputDeviceJack : public AudioOutputDevice {
44     public:
45     AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters);
46 schoenebeck 374 virtual ~AudioOutputDeviceJack();
47 schoenebeck 200
48 schoenebeck 226 /**
49     * Audio channel implementation for the JACK audio driver.
50 schoenebeck 221 */
51 schoenebeck 226 class AudioChannelJack : public AudioChannel {
52 schoenebeck 200 public:
53 schoenebeck 226 /** Audio Channel Parameter 'NAME'
54     *
55     * Used to assign an arbitrary name to an audio channel.
56     */
57     class ParameterName : public AudioChannel::ParameterName {
58     public:
59     ParameterName(AudioChannelJack* pChannel);
60     virtual void OnSetValue(String s);
61     protected:
62     AudioChannelJack* pChannel;
63     };
64    
65     /** Audio Channel Parameter 'JACK_BINDINGS'
66     *
67     * Used to connect to other JACK clients.
68     */
69     class ParameterJackBindings : public DeviceRuntimeParameterStrings {
70     public:
71     ParameterJackBindings(AudioChannelJack* pChannel);
72     virtual String Description();
73     virtual bool Fix();
74     virtual std::vector<String> PossibilitiesAsString();
75     virtual void OnSetValue(std::vector<String> vS);
76     static String Name();
77     protected:
78     AudioChannelJack* pChannel;
79     };
80 schoenebeck 200 protected:
81 schoenebeck 226 AudioChannelJack(uint ChannelNr, AudioOutputDeviceJack* pDevice) throw (AudioOutputException);
82     ~AudioChannelJack();
83     friend class AudioOutputDeviceJack;
84     private:
85     AudioOutputDeviceJack* pDevice;
86     jack_port_t* hJackPort;
87     uint ChannelNr;
88    
89     float* CreateJackPort(uint ChannelNr, AudioOutputDeviceJack* pDevice) throw (AudioOutputException);
90 schoenebeck 200 };
91    
92 schoenebeck 374 /** Audio Device Parameter 'NAME'
93     *
94     * Used to assign an arbitrary name to the JACK client of this
95     * audio device.
96     */
97     class ParameterName : public DeviceCreationParameterString {
98     public:
99     ParameterName();
100     ParameterName(String s) throw (LinuxSamplerException);
101     virtual String Description();
102     virtual bool Fix();
103     virtual bool Mandatory();
104     virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
105     virtual std::vector<String> PossibilitiesAsString(std::map<String,String> Parameters);
106     virtual optional<String> DefaultAsString(std::map<String,String> Parameters);
107     virtual void OnSetValue(String s) throw (LinuxSamplerException);
108     static String Name();
109     };
110    
111 schoenebeck 200 // derived abstract methods from class 'AudioOutputDevice'
112     virtual void Play();
113     virtual bool IsPlaying();
114     virtual void Stop();
115     virtual uint MaxSamplesPerCycle();
116     virtual uint SampleRate();
117 schoenebeck 226 virtual AudioChannel* CreateChannel(uint ChannelNr);
118 schoenebeck 200
119 schoenebeck 226
120 schoenebeck 200 static String Name();
121    
122     virtual String Driver();
123    
124     static String Description();
125     static String Version();
126    
127     int Process(uint Samples); // FIXME: should be private
128     protected:
129     AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0);
130     private:
131 schoenebeck 226 ConditionServer csIsPlaying;
132     uint uiMaxSamplesPerCycle;
133     jack_client_t* hJackClient;
134 schoenebeck 200 };
135    
136     // Callback functions for the libjack API
137     int __libjack_process_callback(jack_nframes_t nframes, void* arg);
138     void __libjack_shutdown_callback(void* arg);
139     }
140    
141     #endif // HAVE_JACK
142     #endif // __LS_AUDIOOUTPUTDEVICEJACK_H__

  ViewVC Help
Powered by ViewVC