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

Diff of /linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceJack.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 289 by schoenebeck, Tue Oct 19 14:41:38 2004 UTC revision 374 by schoenebeck, Sat Feb 12 00:36:08 2005 UTC
# Line 29  Line 29 
29    
30  namespace LinuxSampler {  namespace LinuxSampler {
31    
32  // *************** ParameterName ***************      /// number of currently existing JACK audio output devices in LinuxSampler
33        static int existingJackDevices = 0;
34    
35    // *************** AudioChannelJack::ParameterName ***************
36  // *  // *
37    
38      AudioOutputDeviceJack::AudioChannelJack::ParameterName::ParameterName(AudioChannelJack* pChannel) : AudioChannel::ParameterName(ToString(pChannel->ChannelNr)) {      AudioOutputDeviceJack::AudioChannelJack::ParameterName::ParameterName(AudioChannelJack* pChannel) : AudioChannel::ParameterName(ToString(pChannel->ChannelNr)) {
# Line 42  namespace LinuxSampler { Line 45  namespace LinuxSampler {
45    
46    
47    
48  // *************** ParameterJackBindings ***************  // *************** AudioChannelJack::ParameterJackBindings ***************
49  // *  // *
50    
51      AudioOutputDeviceJack::AudioChannelJack::ParameterJackBindings::ParameterJackBindings(AudioChannelJack* pChannel) : DeviceRuntimeParameterStrings(std::vector<String>()) {      AudioOutputDeviceJack::AudioChannelJack::ParameterJackBindings::ParameterJackBindings(AudioChannelJack* pChannel) : DeviceRuntimeParameterStrings(std::vector<String>()) {
# Line 106  namespace LinuxSampler { Line 109  namespace LinuxSampler {
109    
110    
111    
112    // *************** AudioOutputDeviceJack::ParameterName ***************
113    // *
114    
115        AudioOutputDeviceJack::ParameterName::ParameterName() : DeviceCreationParameterString() {
116            InitWithDefault(); // use default name
117        }
118    
119        AudioOutputDeviceJack::ParameterName::ParameterName(String s) throw (LinuxSamplerException) : DeviceCreationParameterString(s) {
120        }
121    
122        String AudioOutputDeviceJack::ParameterName::Description() {
123            return "Arbitrary JACK client name";
124        }
125    
126        bool AudioOutputDeviceJack::ParameterName::Fix() {
127            return true;
128        }
129    
130        bool AudioOutputDeviceJack::ParameterName::Mandatory() {
131            return false;
132        }
133    
134        std::map<String,DeviceCreationParameter*> AudioOutputDeviceJack::ParameterName::DependsAsParameters() {
135            return std::map<String,DeviceCreationParameter*>(); // no dependencies
136        }
137    
138        std::vector<String> AudioOutputDeviceJack::ParameterName::PossibilitiesAsString(std::map<String,String> Parameters) {
139            return std::vector<String>();
140        }
141    
142        optional<String> AudioOutputDeviceJack::ParameterName::DefaultAsString(std::map<String,String> Parameters) {
143            return (existingJackDevices) ? "LinuxSampler" + ToString(existingJackDevices) : "LinuxSampler";
144        }
145    
146        void AudioOutputDeviceJack::ParameterName::OnSetValue(String s) throw (LinuxSamplerException) {
147            // not possible, as parameter is fix
148        }
149    
150        String AudioOutputDeviceJack::ParameterName::Name() {
151            return "NAME";
152        }
153    
154    
155    
156  // *************** AudioOutputDeviceJack ***************  // *************** AudioOutputDeviceJack ***************
157  // *  // *
158    
# Line 117  namespace LinuxSampler { Line 164  namespace LinuxSampler {
164       * @see AcquireChannels()       * @see AcquireChannels()
165       */       */
166      AudioOutputDeviceJack::AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters) : AudioOutputDevice(Parameters) {      AudioOutputDeviceJack::AudioOutputDeviceJack(std::map<String,DeviceCreationParameter*> Parameters) : AudioOutputDevice(Parameters) {
167          if ((hJackClient = jack_client_new("LinuxSampler")) == 0)          if (((DeviceCreationParameterString*)Parameters["NAME"])->ValueAsString().size() >= jack_client_name_size())
168                throw LinuxSamplerException("JACK client name too long");
169    
170            if ((hJackClient = jack_client_new(((DeviceCreationParameterString*)Parameters["NAME"])->ValueAsString().c_str())) == 0)
171              throw AudioOutputException("Seems Jack server not running.");              throw AudioOutputException("Seems Jack server not running.");
172    
173            existingJackDevices++;
174    
175          jack_set_process_callback(hJackClient, __libjack_process_callback, this);          jack_set_process_callback(hJackClient, __libjack_process_callback, this);
176          jack_on_shutdown(hJackClient, __libjack_shutdown_callback, this);          jack_on_shutdown(hJackClient, __libjack_shutdown_callback, this);
177          if (jack_activate(hJackClient))          if (jack_activate(hJackClient))
# Line 137  namespace LinuxSampler { Line 189  namespace LinuxSampler {
189      AudioOutputDeviceJack::~AudioOutputDeviceJack() {      AudioOutputDeviceJack::~AudioOutputDeviceJack() {
190          // destroy jack client          // destroy jack client
191          jack_client_close(hJackClient);          jack_client_close(hJackClient);
192            existingJackDevices--;
193      }      }
194    
195      /**      /**
# Line 191  namespace LinuxSampler { Line 244  namespace LinuxSampler {
244      }      }
245    
246      String AudioOutputDeviceJack::Version() {      String AudioOutputDeviceJack::Version() {
247         String s = "$Revision: 1.14 $";         String s = "$Revision: 1.15 $";
248         return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword         return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
249      }      }
250    

Legend:
Removed from v.289  
changed lines
  Added in v.374

  ViewVC Help
Powered by ViewVC