diff options
author | Joerg Mueller <nexyon@gmail.com> | 2010-08-03 12:07:21 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2010-08-03 12:07:21 +0400 |
commit | ce44d63ae1e6e76545bacd87ca8402b35a0317a0 (patch) | |
tree | 8f209fdbd889cee39f700cf092b0045f1f87ec3a /intern/audaspace/jack | |
parent | 8baeb4393c281b5c6765aa5ce4708a8221123b34 (diff) |
Audaspace:
* Added an error string for audaspace exceptions.
* Fixed PyAPI exceptions.
* Minor bugfixes.
* Added a name parameter to the Jack device, so that one can define an own name via Python.
Diffstat (limited to 'intern/audaspace/jack')
-rw-r--r-- | intern/audaspace/jack/AUD_JackDevice.cpp | 16 | ||||
-rw-r--r-- | intern/audaspace/jack/AUD_JackDevice.h | 6 |
2 files changed, 16 insertions, 6 deletions
diff --git a/intern/audaspace/jack/AUD_JackDevice.cpp b/intern/audaspace/jack/AUD_JackDevice.cpp index 08a1d5920e5..5aa3f7b3fc1 100644 --- a/intern/audaspace/jack/AUD_JackDevice.cpp +++ b/intern/audaspace/jack/AUD_JackDevice.cpp @@ -172,7 +172,13 @@ void AUD_JackDevice::jack_shutdown(void *data) device->m_valid = false; } -AUD_JackDevice::AUD_JackDevice(AUD_DeviceSpecs specs, int buffersize) +static const char* clientopen_error = "AUD_JackDevice: Couldn't connect to " + "jack server."; +static const char* port_error = "AUD_JackDevice: Couldn't create output port."; +static const char* activate_error = "AUD_JackDevice: Couldn't activate the " + "client."; + +AUD_JackDevice::AUD_JackDevice(std::string name, AUD_DeviceSpecs specs, int buffersize) { if(specs.channels == AUD_CHANNELS_INVALID) specs.channels = AUD_CHANNELS_STEREO; @@ -185,9 +191,9 @@ AUD_JackDevice::AUD_JackDevice(AUD_DeviceSpecs specs, int buffersize) jack_status_t status; // open client - m_client = jack_client_open("Blender", options, &status); + m_client = jack_client_open(name.c_str(), options, &status); if(m_client == NULL) - AUD_THROW(AUD_ERROR_JACK); + AUD_THROW(AUD_ERROR_JACK, clientopen_error); // set callbacks jack_set_process_callback(m_client, AUD_JackDevice::jack_mix, this); @@ -207,7 +213,7 @@ AUD_JackDevice::AUD_JackDevice(AUD_DeviceSpecs specs, int buffersize) JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); if(m_ports[i] == NULL) - AUD_THROW(AUD_ERROR_JACK); + AUD_THROW(AUD_ERROR_JACK, port_error); } } catch(AUD_Exception&) @@ -249,7 +255,7 @@ AUD_JackDevice::AUD_JackDevice(AUD_DeviceSpecs specs, int buffersize) pthread_cond_destroy(&m_mixingCondition); destroy(); - AUD_THROW(AUD_ERROR_JACK); + AUD_THROW(AUD_ERROR_JACK, activate_error); } const char** ports = jack_get_ports(m_client, NULL, NULL, diff --git a/intern/audaspace/jack/AUD_JackDevice.h b/intern/audaspace/jack/AUD_JackDevice.h index abd32147246..418992e0db1 100644 --- a/intern/audaspace/jack/AUD_JackDevice.h +++ b/intern/audaspace/jack/AUD_JackDevice.h @@ -30,6 +30,8 @@ #include "AUD_SoftwareDevice.h" #include "AUD_Buffer.h" +#include <string> + #include <jack.h> #include <ringbuffer.h> @@ -127,11 +129,13 @@ protected: public: /** * Creates a Jack client for audio output. + * \param name The client name. * \param specs The wanted audio specification, where only the channel count * is important. + * \param buffersize The size of the internal buffer. * \exception AUD_Exception Thrown if the audio device cannot be opened. */ - AUD_JackDevice(AUD_DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE); + AUD_JackDevice(std::string name, AUD_DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE); /** * Closes the Jack client. |