aboutsummaryrefslogtreecommitdiff
path: root/src/audio.c
blob: bc139a2bd3cf8620a1d8d14c8181464a5525dc03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}