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/SDL | |
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/SDL')
-rw-r--r-- | intern/audaspace/SDL/AUD_SDLDevice.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/audaspace/SDL/AUD_SDLDevice.cpp b/intern/audaspace/SDL/AUD_SDLDevice.cpp index 1a385af8a0c..c1eb7bdf61e 100644 --- a/intern/audaspace/SDL/AUD_SDLDevice.cpp +++ b/intern/audaspace/SDL/AUD_SDLDevice.cpp @@ -33,6 +33,10 @@ void AUD_SDLDevice::SDL_mix(void *data, Uint8* buffer, int length) device->mix((data_t*)buffer,length/AUD_DEVICE_SAMPLE_SIZE(device->m_specs)); } +static const char* open_error = "AUD_SDLDevice: Device couldn't be opened."; +static const char* format_error = "AUD_SDLDevice: Obtained unsupported sample " + "format."; + AUD_SDLDevice::AUD_SDLDevice(AUD_DeviceSpecs specs, int buffersize) { if(specs.channels == AUD_CHANNELS_INVALID) @@ -57,7 +61,7 @@ AUD_SDLDevice::AUD_SDLDevice(AUD_DeviceSpecs specs, int buffersize) format.userdata = this; if(SDL_OpenAudio(&format, &obtained) != 0) - AUD_THROW(AUD_ERROR_SDL); + AUD_THROW(AUD_ERROR_SDL, open_error); m_specs.rate = (AUD_SampleRate)obtained.freq; m_specs.channels = (AUD_Channels)obtained.channels; @@ -66,7 +70,10 @@ AUD_SDLDevice::AUD_SDLDevice(AUD_DeviceSpecs specs, int buffersize) else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB) m_specs.format = AUD_FORMAT_S16; else - AUD_THROW(AUD_ERROR_SDL); + { + SDL_CloseAudio(); + AUD_THROW(AUD_ERROR_SDL, format_error); + } create(); } |