As discussed previously (http://forums.libsdl.org/viewtopic.php?t=7692), IMG_Load can access files in /assets/ via RWops. I also hacked together a system for loading XML files and passing them to TinyXML. Now I’m working on music, but Mix_LoadMUS doesn’t seem to work the way IMG_Load does. I think I’ll need to load the files manually using RWops, as with XML - trouble is music is not like text: I’m not sure quite how to handle it. Any advice?
Not sure what you mean, here is the example from the SDL_mixer docs:
// load the MP3 file “music.mp3” to play as music
Mix_Music *music;
music=Mix_LoadMUS(“music.mp3”);
if(!music) {
printf(“Mix_LoadMUS(“music.mp3”): %s\n”, Mix_GetError());
// this might be a critical error…
}
If you’re having trouble loading a file, perhaps the coded is not built
into SDL_Mixer? I just had to jump through hoops to get OGG support under
Mingw (couldn’t get SMPEG to compile), so you might want to take a look at
the build logs to see exactly what support is in your version of SDL_mixer.
Cheers.On Tue, Nov 22, 2011 at 11:06 PM, wilbefast wrote:
**
As discussed previously http://forums.libsdl.org/viewtopic.php?t=7692,
IMG_Load can access files in **/assets/ via RWops. I also hacked together
a system for loading XML files and passing them to TinyXML. Now I’m working
on music, but Mix_LoadMUS doesn’t seem to work the way IMG_Load does. I
think I’ll need to load the files manually using RWops, as with XML -
trouble is music is not like text: I’m not sure quite how to handle it. Any
advice?
Jonny DOn Wed, Nov 23, 2011 at 7:16 PM, Jeremy Jurksztowicz <jurksztowicz at gmail.com wrote:
Not sure what you mean, here is the example from the SDL_mixer docs:
// load the MP3 file “music.mp3” to play as music
Mix_Music *music;
music=Mix_LoadMUS(“music.mp3”);
if(!music) {
printf(“Mix_LoadMUS(“music.mp3”): %s\n”, Mix_GetError());
// this might be a critical error…
}
If you’re having trouble loading a file, perhaps the coded is not built
into SDL_Mixer? I just had to jump through hoops to get OGG support under
Mingw (couldn’t get SMPEG to compile), so you might want to take a look at
the build logs to see exactly what support is in your version of SDL_mixer.
Cheers.
On Tue, Nov 22, 2011 at 11:06 PM, wilbefast wrote:
**
As discussed previously http://forums.libsdl.org/viewtopic.php?t=7692,
IMG_Load can access files in **/assets/ via RWops. I also hacked
together a system for loading XML files and passing them to TinyXML. Now
I’m working on music, but Mix_LoadMUS doesn’t seem to work the way IMG_Load
does. I think I’ll need to load the files manually using RWops, as with XML
trouble is music is not like text: I’m not sure quite how to handle it.
Any advice?
// Load and play music on loop (-1)
music = Mix_LoadMUS(ASSET("music.ogg"));
//ASSERT_MIX(music, "Loading music file");
Mix_PlayMusic(music, -1);
ASSERT_MIX logs Mix_GetError() (depending on platform this can end up being just a printf) and returns EXIT_FAILURE if there’s a problem. On Linux there’s no trouble, but Android doesn’t find the .ogg, so I’m guessing it’s not using RWops by default for Android