-
-
Save LaughingSun/e3450d28012a44182ebc to your computer and use it in GitHub Desktop.
Play a sound with SDL2 added lots of print information and the ability to specify the wav file as first argument. Woohoo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRCS = $(wildcard *.c) | |
.PHONY: all | |
all: $(patsubst %.c,%,$(SRCS)) | |
@echo found rules for: $^ | |
%: %.c | |
gcc -I/usr/local/include -L/usr/local/lib $< -Wl,-rpath,/usr/local/lib -lSDL2 -lm -o $@ | |
@echo built: $@ | |
clean: $(patsubst %.c,%,$(SRCS)) | |
rm $(patsubst %.c,%,$(SRCS)) | |
@echo cleaned: $^ | |
# gcc -I/usr/local/include -L/usr/local/lib $< -Wl,-rpath,/usr/local/lib -lSDL2 -lm -o $@ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View raw
(Sorry about that, but we can’t show files that are this big right now.)
I modified this a bit, so now it shows type of error at init and list devices.
int i;
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
printf("Audio driver %d: %s\n", i, SDL_GetAudioDriver(i));
}
..
// Initialize SDL.
int err = SDL_Init(SDL_INIT_AUDIO);
if ( err < 0) {
printf("SDL_Init(SDL_INIT_AUDIO) < 0, err = %s \n", SDL_GetError());
return 1;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It just spits out a bunch of things when I start it with one of the audio files and just doesn't play any help?