aboutsummaryrefslogtreecommitdiffstats
path: root/examples/allatency.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-26 07:06:02 +0100
committerSven Gothel <[email protected]>2014-01-26 07:06:02 +0100
commite6f4251945c228a775649b5ccd7f11dd4519c28d (patch)
tree8454b34363358cf9bb502021a68c6985c97daac4 /examples/allatency.c
parent389ae1f767bfad6116e21306fc3cdf89a4cbcc0a (diff)
parent49baa9128dd98e986639def4f24c7522d9ec6b56 (diff)
Merge branch 'UPSTREAM'
Diffstat (limited to 'examples/allatency.c')
-rw-r--r--examples/allatency.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/examples/allatency.c b/examples/allatency.c
index 48bf5b51..deb13d3b 100644
--- a/examples/allatency.c
+++ b/examples/allatency.c
@@ -26,37 +26,30 @@
#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"
#include "AL/alext.h"
#include "common/alhelpers.h"
-#include "common/alffmpeg.h"
+#include "common/sdl_sound.h"
-LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = wrap_BufferSamples;
-LPALISBUFFERFORMATSUPPORTEDSOFT alIsBufferFormatSupportedSOFT;
+static LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = wrap_BufferSamples;
+static LPALISBUFFERFORMATSUPPORTEDSOFT alIsBufferFormatSupportedSOFT;
-LPALSOURCEDSOFT alSourcedSOFT;
-LPALSOURCE3DSOFT alSource3dSOFT;
-LPALSOURCEDVSOFT alSourcedvSOFT;
-LPALGETSOURCEDSOFT alGetSourcedSOFT;
-LPALGETSOURCE3DSOFT alGetSource3dSOFT;
-LPALGETSOURCEDVSOFT alGetSourcedvSOFT;
-LPALSOURCEI64SOFT alSourcei64SOFT;
-LPALSOURCE3I64SOFT alSource3i64SOFT;
-LPALSOURCEI64VSOFT alSourcei64vSOFT;
-LPALGETSOURCEI64SOFT alGetSourcei64SOFT;
-LPALGETSOURCE3I64SOFT alGetSource3i64SOFT;
-LPALGETSOURCEI64VSOFT alGetSourcei64vSOFT;
+static LPALSOURCEDSOFT alSourcedSOFT;
+static LPALSOURCE3DSOFT alSource3dSOFT;
+static LPALSOURCEDVSOFT alSourcedvSOFT;
+static LPALGETSOURCEDSOFT alGetSourcedSOFT;
+static LPALGETSOURCE3DSOFT alGetSource3dSOFT;
+static LPALGETSOURCEDVSOFT alGetSourcedvSOFT;
+static LPALSOURCEI64SOFT alSourcei64SOFT;
+static LPALSOURCE3I64SOFT alSource3i64SOFT;
+static LPALSOURCEI64VSOFT alSourcei64vSOFT;
+static LPALGETSOURCEI64SOFT alGetSourcei64SOFT;
+static LPALGETSOURCE3I64SOFT alGetSource3i64SOFT;
+static LPALGETSOURCEI64VSOFT alGetSourcei64vSOFT;
/* LoadBuffer loads the named audio file into an OpenAL buffer object, and
* returns the new buffer ID. */
@@ -66,24 +59,22 @@ 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);
+ /* Open the audio file */
+ sound = openAudioFile(filename, 1000);
if(!sound)
{
fprintf(stderr, "Could not open audio in %s\n", filename);
- closeAVFile(audiofile);
+ closeAudioFile(sound);
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;
}
@@ -92,16 +83,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;
}
@@ -112,7 +103,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();