SMPEG Bug?

Hi,

When using SDL_Mixer to play MP3’s (via SMPEG)… It only seems to
play the
MP3 (correctly that is) if the mixer’s format (freq,bits,stereo) is
the same as the MP3’s format ??

Is this a known bug or not ? …

Thanx--------------------
Skrag
Dask

In article <3A5BFDB6.64A2A7FA at jhb.bbd.co.za>, johanj at jhb.bbd.co.za says…

Hi,

When using SDL_Mixer to play MP3’s (via SMPEG)… It only seems to
play the
MP3 (correctly that is) if the mixer’s format (freq,bits,stereo) is
the same as the MP3’s format ??

I am having the same problem. Code fragment follows:

{
// init
SDL_Init(SDL_INIT_AUDIO);

// open the audio device.
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY,
		  MIX_DEFAULT_FORMAT,
		  MIX_DEFAULT_CHANNELS,
		  4096);

{
	SMPEG *mpeg;

	// set up the mp3 audio ...
	{
		SMPEG_Info info;
		mpeg = SMPEG_new("FunkyMusic.mp3", &info, 0);
		assert(mpeg);
		assert(info.has_audio);

		// Tell SMPEG what the audio format is.
		{
			SDL_AudioSpec audioFmt;
			int			  frequency, channels;
			Uint16		  format;
			Mix_QuerySpec(&frequency, &format, &channels);
			audioFmt.format   = format;
			audioFmt.freq     = frequency;
			audioFmt.channels = channels;

			SMPEG_actualSpec(mpeg, &audioFmt);
		}

		// Hook in the MPEG music mixer.
		Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
		SMPEG_enableaudio(mpeg, 1);
		SMPEG_enablevideo(mpeg, 0);
		SMPEG_loop(mpeg, true /* repeat */);
	}

	SMPEG_play(mpeg);

	SDL_Delay(10000);

	SMPEG_stop(mpeg);

	Mix_HookMusic(NULL, NULL);
	SMPEG_delete(mpeg);
}

// clean up
Mix_CloseAudio();
SDL_Quit();

}

-dv