aboutsummaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
new file mode 100644
index 0000000..bc139a2
--- /dev/null
+++ b/src/audio.c
@@ -0,0 +1,33 @@
+#include <SDL2/SDL_audio.h>
+#include <stdio.h>
+
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_mixer.h>
+
+#include "base.h"
+
+#define MIXER_FLAGS MIX_INIT_OGG | MIX_INIT_FLAC
+
+int main (int argc, char *argv[] ) {
+
+ // initialization of SDLs audio system and the mixer
+ if (SDL_Init(SDL_INIT_AUDIO) != 0) {
+ fprintf(stderr, "error initializing sdl_mixer: %s\n", SDL_GetError());
+ }
+
+ s32 mixflags = Mix_Init(MIXER_FLAGS);
+ if ((mixflags & MIXER_FLAGS) != mixflags) {
+ fprintf(stderr, "error initializing sdl_mixer: %s\n", Mix_GetError());
+ }
+
+ // setting up the default audio device for playback (using common defaults)
+ Mix_OpenAudio(48000, AUDIO_F32SYS, 2, 2048);
+
+
+
+ Mix_CloseAudio();
+ Mix_Quit();
+ SDL_Quit();
+ return 0;
+}
+