diff options
author | Chris Robinson <[email protected]> | 2013-06-05 20:12:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-06-05 20:12:13 -0700 |
commit | 9fd87314800f27d626f25688a69587166a809dd0 (patch) | |
tree | 9ea27e551ffd80acc9b2e44c67975518a101d4fa /examples/alreverb.c | |
parent | 056fa2a47443eb40cf40eadae5721c847015813e (diff) |
Use SDL_sound for the other examples
Diffstat (limited to 'examples/alreverb.c')
-rw-r--r-- | examples/alreverb.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/examples/alreverb.c b/examples/alreverb.c index 453db79d..420b1c55 100644 --- a/examples/alreverb.c +++ b/examples/alreverb.c @@ -26,13 +26,6 @@ #include <stdio.h> #include <assert.h> -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#else -#include <unistd.h> -#define Sleep(x) usleep((x)*1000) -#endif #include "AL/al.h" #include "AL/alc.h" @@ -40,7 +33,7 @@ #include "AL/efx-presets.h" #include "common/alhelpers.h" -#include "common/alffmpeg.h" +#include "common/sdl_sound.h" static LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = wrap_BufferSamples; @@ -159,24 +152,21 @@ static ALuint LoadSound(const char *filename) ALuint rate, buffer; size_t datalen; void *data; - FilePtr audiofile; - StreamPtr sound; + FilePtr sound; /* Open the file and get the first stream from it */ - audiofile = openAVFile(filename); - sound = getAVAudioStream(audiofile, 0); + sound = openAudioFile(filename, 1000); if(!sound) { fprintf(stderr, "Could not open audio in %s\n", filename); - closeAVFile(audiofile); return 0; } /* Get the sound format, and figure out the OpenAL format */ - if(getAVAudioInfo(sound, &rate, &channels, &type) != 0) + if(getAudioInfo(sound, &rate, &channels, &type) != 0) { fprintf(stderr, "Error getting audio info for %s\n", filename); - closeAVFile(audiofile); + closeAudioFile(sound); return 0; } @@ -185,16 +175,16 @@ static ALuint LoadSound(const char *filename) { fprintf(stderr, "Unsupported format (%s, %s) for %s\n", ChannelsName(channels), TypeName(type), filename); - closeAVFile(audiofile); + closeAudioFile(sound); return 0; } /* Decode the whole audio stream to a buffer. */ - data = decodeAVAudioStream(sound, &datalen); + data = decodeAudioStream(sound, &datalen); if(!data) { fprintf(stderr, "Failed to read audio from %s\n", filename); - closeAVFile(audiofile); + closeAudioFile(sound); return 0; } @@ -205,7 +195,7 @@ static ALuint LoadSound(const char *filename) alBufferSamplesSOFT(buffer, rate, format, BytesToFrames(datalen, channels, type), channels, type, data); free(data); - closeAVFile(audiofile); + closeAudioFile(sound); /* Check if an error occured, and clean up if so. */ err = alGetError(); |