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 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
24 |
#ifndef __LS_AUDIOOUTPUTDEVICEJACK_H__ |
#ifndef __LS_AUDIOOUTPUTDEVICEJACK_H__ |
25 |
#define __LS_AUDIOOUTPUTDEVICEJACK_H__ |
#define __LS_AUDIOOUTPUTDEVICEJACK_H__ |
26 |
|
|
27 |
#include "../../common/global.h" |
#include "../../common/global_private.h" |
28 |
|
|
29 |
#if HAVE_JACK |
#if HAVE_JACK |
30 |
|
|
44 |
class AudioOutputDeviceJack : public AudioOutputDevice { |
class AudioOutputDeviceJack : public AudioOutputDevice { |
45 |
public: |
public: |
46 |
AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters); |
AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters); |
47 |
~AudioOutputDeviceJack(); |
virtual ~AudioOutputDeviceJack(); |
48 |
|
|
49 |
/** Audio Channel Parameter 'JACK_BINDINGS' |
/** |
50 |
* |
* Audio channel implementation for the JACK audio driver. |
|
* Used to connect to other JACK clients. |
|
51 |
*/ |
*/ |
52 |
class ParameterJackBindings : public DeviceRuntimeParameterStrings { |
class AudioChannelJack : public AudioChannel { |
53 |
public: |
public: |
54 |
ParameterJackBindings(AudioChannel* pChannel, std::vector<String> InitialBindings) : DeviceRuntimeParameterStrings(InitialBindings) { this->pChannel = pChannel; } |
/** Audio Channel Parameter 'NAME' |
55 |
virtual String Description() { return "Bindings to other JACK clients"; } |
* |
56 |
virtual bool Fix() { return false; } |
* Used to assign an arbitrary name to an audio channel. |
57 |
virtual std::vector<String> PossibilitiesAsString() { return std::vector<String>(); /* TODO: to be implemented */ } |
*/ |
58 |
virtual void OnSetValue(std::vector<String> vS) { /* TODO: code to connect to other jack clients */ } |
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: |
protected: |
83 |
AudioChannel* pChannel; |
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' |
// derived abstract methods from class 'AudioOutputDevice' |
114 |
virtual void Play(); |
virtual void Play(); |
115 |
virtual bool IsPlaying(); |
virtual bool IsPlaying(); |
116 |
virtual void Stop(); |
virtual void Stop(); |
|
virtual void AcquireChannels(uint uiChannels); |
|
117 |
virtual uint MaxSamplesPerCycle(); |
virtual uint MaxSamplesPerCycle(); |
118 |
virtual uint SampleRate(); |
virtual uint SampleRate(); |
119 |
|
virtual AudioChannel* CreateChannel(uint ChannelNr); |
120 |
|
|
121 |
|
|
122 |
static String Name(); |
static String Name(); |
123 |
|
|
125 |
|
|
126 |
static String Description(); |
static String Description(); |
127 |
static String Version(); |
static String Version(); |
|
static std::map<String,DeviceCreationParameter*> AvailableParameters(); |
|
128 |
|
|
129 |
int Process(uint Samples); // FIXME: should be private |
int Process(uint Samples); // FIXME: should be private |
130 |
protected: |
protected: |
131 |
AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0); |
AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0); |
132 |
private: |
private: |
133 |
ConditionServer csIsPlaying; |
ConditionServer csIsPlaying; |
134 |
uint uiMaxSamplesPerCycle; |
uint uiMaxSamplesPerCycle; |
135 |
jack_client_t* hJackClient; |
jack_client_t* hJackClient; |
|
std::vector<jack_port_t*> hJackPorts; |
|
136 |
}; |
}; |
137 |
|
|
138 |
// Callback functions for the libjack API |
// Callback functions for the libjack API |