aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--README.md3
-rw-r--r--src/audio.c33
-rw-r--r--src/base.h19
4 files changed, 75 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4f6a822
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+CC=gcc
+CFLAGS=-std=c99 -Wall -Werror -O2 -march=native $(shell pkg-config --cflags SDL2_mixer)
+LDFLAGS=$(shell pkg-config --libs SDL2_mixer)
+
+
+SRC=$(wildcard src/*.c)
+OBJ=$(SRC:.c=.o)
+
+LIBS=$(wildcard $(LIB)/*.c)
+
+BIN=audio
+
+$(BIN): $(OBJ)
+ $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
+
+*.o: *.c
+ $(CC) -o $@ -c $< $(CFLAGS)
+
+clean:
+ $(RM) -r obj/* src/*.o $(BIN)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8916e58
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+audio thing
+
+only ogg and flac support (flip other filetypes)
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;
+}
+
diff --git a/src/base.h b/src/base.h
new file mode 100644
index 0000000..8807c53
--- /dev/null
+++ b/src/base.h
@@ -0,0 +1,19 @@
+#ifndef BASE_H
+#define BASE_H
+
+#include <stdint.h>
+
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
+typedef int8_t s8;
+typedef int16_t s16;
+typedef int32_t s32;
+typedef int64_t s64;
+
+typedef float f32;
+typedef double f64;
+
+#endif // BASE_H