MP3 Playback issues
Reported by MadVillain | August 28th, 2009 @ 12:48 AM | in 2.6
MP3 playback will default to mono and in some cases play at the wrong bitrate.
Test program:
require "rubygame"
song = Rubygame::Music.load("test.mp3")
song.play()
while(song.playing?)
end
When running this test program, SMPEG prints "Warning: incorrect audio format".
The problem seems to be in rubygame_music.c at lines 196-200 and
in rg_music_load:
static intrg_music_play( RG_Music *music,
int fade_in, int repeats, double start_at )
{
/ Open audio if it's not already. Return -1 if it failed. / if( ensure_open_audio() != 0 ) {
return -1;
}
... }
static int _rg_music_load( RG_Music *music, char *file )
{
RG_WrapMusic *wrap = _rg_wrapmusic_alloc();
int result = _rg_wrapmusic_load( wrap, file );
_rg_music_associate( music, wrap );
return result;
}
I think the audio device needs to be opened in rg_music_load() in order for SMPEG to set the correct properties for playing the song. Adding this line to rg_music_load() fixed the problem for me:
if( ensure_open_audio() != 0 )
{
return -1;
}
Comments and changes to this ticket
-

John Croisant September 5th, 2009 @ 03:54 PM
- → Tag set to @bug, audio, mixer
- → Milestone set to 2.6
- → State changed from new to resolved
Thanks for the report. This will be fixed in the next version (2.6). In the meantime, you should be able to work around it by calling "Rubygame.open_audio" in your app before loading the music.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Flexible library for making games with the Ruby language.
http://rubygame.org