mp3player broken in libogc 1.7.1a ?

Post Reply
toddy
Posts: 2
Joined: Sun Mar 01, 2009 12:12 pm

mp3player broken in libogc 1.7.1a ?

Post by toddy » Sun Mar 01, 2009 12:22 pm

After updating to v1.7.1a, the sound in my game has gone silent. The relevant bit of code is

Code: Select all

long BGMPlayer::lSize;
unsigned char * BGMPlayer::buffer;

void BGMPlayer::init(const string soundDir) {

	MP3Player_Init();

	string filename = soundDir + "ttbgm.mp3";
	//char * filename = (char *)"sd:/sounds/ttbgm.mp3";
	FILE *fd = fopen(filename.c_str(), "rb");

	// obtain file size:
	fseek(fd , 0 , SEEK_END);
	lSize = ftell(fd);
	rewind(fd);

	// read the file
	buffer = (unsigned char*) malloc (sizeof(unsigned char)*lSize);;
	fread (buffer, 1, lSize, fd);
	fclose(fd);
}

void BGMPlayer::process() {
	if (!MP3Player_IsPlaying()){
		MP3Player_PlayBuffer(buffer,lSize,NULL);
	}
}
with the process method being called in a loop. Full source code is available at http://www.themightystags.com/toddtris_wii/ . Reverting to v1.7.0 fixes the problem.

I assume there must have been some changes in this area as I have to link against libasnd in v1.7.1a whereas this isn't the case with 1.7.0.

There also seems to be a bit of a bug in the v1.7.0 mp3player. The last couple of seconds of the MP3 don't seem to get played for me so I have to add some silence to the end.

Any help appreciated.

Thanks,

Toddy

tribasic
Posts: 3
Joined: Tue Apr 21, 2009 1:18 pm

Re: mp3player broken in libogc 1.7.1a ?

Post by tribasic » Tue Apr 21, 2009 1:27 pm

I'm having the same problem. I'm just learning C programming, and I was trying out the MODPlay functions, but wasn't able to hear any audio. I spent 2 days trying to figure out what I was doing wrong when I found your message regarding 'silent mp3's'.

So I downloaded the libogc 1.7.0 library, and my .MOD files play fine!!

But what I want to know, is this a bug in the libogc library, or is there a new way to initialize sound playback with libogc 1.7.1??

Thanks!!

Tribasic

shagkur
Posts: 53
Joined: Thu Sep 08, 2005 8:40 pm

Re: mp3player broken in libogc 1.7.1a ?

Post by shagkur » Wed Apr 22, 2009 9:29 am

Hi,

call ASND_Init() prior to MP3Player_Init().

regards
shagkur

tribasic
Posts: 3
Joined: Tue Apr 21, 2009 1:18 pm

Re: mp3player broken in libogc 1.7.1a ?

Post by tribasic » Fri Apr 24, 2009 5:08 am

Thanks for your reply! I'll give that a try when I get home from work tommorrow!

I'm pretty sure it's going to work too :)

Thanks again!

Tribasic

toddy
Posts: 2
Joined: Sun Mar 01, 2009 12:12 pm

Re: mp3player broken in libogc 1.7.1a ?

Post by toddy » Sun Apr 26, 2009 10:13 am

Great, that works for me. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests