From 4d5e0c6c14a40baeed63b4275fd149dbbb0cef3e Mon Sep 17 00:00:00 2001 From: jonyluke Date: Fri, 17 May 2019 20:09:18 +0200 Subject: [PATCH] Update main.c --- audio/sdl2-audio/source/main.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/audio/sdl2-audio/source/main.c b/audio/sdl2-audio/source/main.c index adcff90..24382bd 100644 --- a/audio/sdl2-audio/source/main.c +++ b/audio/sdl2-audio/source/main.c @@ -11,34 +11,33 @@ #include // Main program entrypoint -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { // This example uses sdl2 library to play a mp3 file - - consoleInit(NULL); + consoleInit(NULL); Result rc = romfsInit(); if (R_FAILED(rc)) - printf("romfsInit: %08X\n", rc); - - else - printf("Press A button to play the sound!\n"); + printf("romfsInit: %08X\n", rc); + + else + printf("Press A button to play the sound!\n"); // Start SDL with audio support SDL_Init(SDL_INIT_AUDIO); - - // Load support for the MP3 format + + // Load support for the MP3 format Mix_Init(MIX_INIT_MP3); - + // open 44.1KHz, signed 16bit, system byte order, // stereo audio, using 4096 byte chunks Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096); - + // Load sound file to use - //Sound from https://freesound.org/people/jens.enk/sounds/434610/ + // Sound from https://freesound.org/people/jens.enk/sounds/434610/ Mix_Music *audio = Mix_LoadMUS("romfs:/test.mp3"); - + // Main loop while (appletMainLoop()) { @@ -53,18 +52,18 @@ int main(int argc, char* argv[]) break; // break in order to return to hbmenu if (kDown & KEY_A) - Mix_PlayMusic(audio, 1); //Play the audio file - + Mix_PlayMusic(audio, 1); //Play the audio file + // Update the console, sending a new frame to the display consoleUpdate(NULL); } // Free the loaded sound Mix_FreeMusic(audio); - + // Shuts down SDL subsystems SDL_Quit(); - + // Deinitialize and clean up resources used by the console (important!) consoleExit(NULL); return 0;