All pastes #473933 Raw Edit

Stuff

public cpp v1 · immutable
·published 2007-05-06 14:26 UTC
rendered paste body
#include <SDL/SDL.h>#include <SDL/SDL_mixer.h>#include <stdlib.h>#include <unistd.h>int main(){  if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {    fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());  }  const size_t buf_size = 1024;  if ( Mix_OpenAudio( 44100, MIX_DEFAULT_FORMAT, 2, buf_size) < 0 ) {    fprintf(stderr, "Warning: Couldn't set 11025 Hz 8-bit audio\n- Reason: %s\n", SDL_GetError() );  }  Mix_AllocateChannels(16);  Mix_Music * music;  music = Mix_LoadMUS( "music.ogg" );  if( music == NULL ) {    fprintf(stderr, "Warning: Couldn't load music: %s\n", Mix_GetError() );  }  Mix_PlayMusic( music, 1500 );  sleep( 2 );  Mix_HaltChannel( -1 );  Mix_FreeMusic(music);    Mix_CloseAudio();  if(SDL_WasInit(SDL_INIT_AUDIO) != 0) {    SDL_QuitSubSystem(SDL_INIT_AUDIO);  }  SDL_Quit();}