Added jack audio support, building with cmake only currently, feel free to add scons...
[blender-staging.git] / intern / audaspace / SDL / AUD_SDLDevice.cpp
index 9ea5f1a74ee74b3ee89ff6280968228d92b8f78d..dd443e7f5c72559095b8b67515ddb27dff619e15 100644 (file)
 #include "AUD_SDLDevice.h"
 #include "AUD_IReader.h"
 
 #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;
 {
        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)
 }
 
 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.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)
        format.userdata = this;
 
        if(SDL_OpenAudio(&format, &obtained) != 0)
@@ -86,11 +84,6 @@ AUD_SDLDevice::~AUD_SDLDevice()
        destroy();
 }
 
        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);
 void AUD_SDLDevice::playing(bool playing)
 {
        SDL_PauseAudio(playing ? 0 : 1);