diff options
author | Joerg Mueller <nexyon@gmail.com> | 2009-08-16 18:53:11 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2009-08-16 18:53:11 +0400 |
commit | 1ee26d45b58c4544c25899763e83ec06349ad780 (patch) | |
tree | c71e27b732e296e06e1f5cc8159614f7635c8876 /intern/audaspace/SDL | |
parent | f250a92808a10f81abef1459223dbb5be40753b8 (diff) |
Added jack audio support, building with cmake only currently, feel free to add scons and maybe cmake.
Diffstat (limited to 'intern/audaspace/SDL')
-rw-r--r-- | intern/audaspace/SDL/AUD_SDLDevice.cpp | 15 | ||||
-rw-r--r-- | intern/audaspace/SDL/AUD_SDLDevice.h | 19 |
2 files changed, 15 insertions, 19 deletions
diff --git a/intern/audaspace/SDL/AUD_SDLDevice.cpp b/intern/audaspace/SDL/AUD_SDLDevice.cpp index 9ea5f1a74ee..dd443e7f5c7 100644 --- a/intern/audaspace/SDL/AUD_SDLDevice.cpp +++ b/intern/audaspace/SDL/AUD_SDLDevice.cpp @@ -27,13 +27,11 @@ #include "AUD_SDLDevice.h" #include "AUD_IReader.h" -#include <SDL.h> - -// this is the callback function for SDL, it only calls the class -void mixAudio(void *data, Uint8* buffer, int length) +void AUD_SDLDevice::SDL_mix(void *data, Uint8* buffer, int length) { AUD_SDLDevice* device = (AUD_SDLDevice*)data; - device->SDLmix((sample_t *)buffer, length); + + device->mix((sample_t*)buffer, length/AUD_SAMPLE_SIZE(device->m_specs)); } AUD_SDLDevice::AUD_SDLDevice(AUD_Specs specs, int buffersize) @@ -56,7 +54,7 @@ AUD_SDLDevice::AUD_SDLDevice(AUD_Specs specs, int buffersize) format.format = AUDIO_S16SYS; format.channels = m_specs.channels; format.samples = buffersize; - format.callback = &mixAudio; + format.callback = AUD_SDLDevice::SDL_mix; format.userdata = this; if(SDL_OpenAudio(&format, &obtained) != 0) @@ -86,11 +84,6 @@ AUD_SDLDevice::~AUD_SDLDevice() destroy(); } -void AUD_SDLDevice::SDLmix(sample_t* buffer, int length) -{ - mix(buffer, length/AUD_SAMPLE_SIZE(m_specs)); -} - void AUD_SDLDevice::playing(bool playing) { SDL_PauseAudio(playing ? 0 : 1); diff --git a/intern/audaspace/SDL/AUD_SDLDevice.h b/intern/audaspace/SDL/AUD_SDLDevice.h index 3eb93d28762..e2c6f7631b7 100644 --- a/intern/audaspace/SDL/AUD_SDLDevice.h +++ b/intern/audaspace/SDL/AUD_SDLDevice.h @@ -28,11 +28,22 @@ #include "AUD_SoftwareDevice.h" +#include <SDL.h> + /** * This device plays back through SDL, the simple direct media layer. */ class AUD_SDLDevice : public AUD_SoftwareDevice { +private: + /** + * Mixes the next bytes into the buffer. + * \param data The SDL device. + * \param buffer The target buffer. + * \param length The length in bytes to be filled. + */ + static void SDL_mix(void *data, Uint8* buffer, int length); + protected: virtual void playing(bool playing); @@ -50,14 +61,6 @@ public: * Closes the SDL audio device. */ virtual ~AUD_SDLDevice(); - - /** - * Mixes the next bytes into the buffer. - * \param buffer The target buffer. - * \param length The length in bytes to be filled. - * \warning This function shall not be called from outside! - */ - void SDLmix(sample_t* buffer, int length); }; #endif //AUD_SDLDEVICE |