Smpeg with --enable-mixer causes MPEG audio to go fast

Ok, I’ve got VidSlide compiled and running again. I configured smpeg
to use mixer ("./configure --enable-mixer").

However, when I run MPEGs with video and audio, the audio goes about
two times faster than it should.

When I run MPEGs with just audio (say, an MP3), the audio is just fine.

I’m using SDL 1.0.0, mixer 1.0.0 and smpeg 0.3.1.

First, I open the audio with:

Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
              MIX_DEFAULT_CHANNELS, 512)

Then, I load the MPEG:

mpeg = SMPEG_new(file, &info, 1);

I turn on audio and video:

SMPEG_enableaudio(mpeg, 1);
SMPEG_enablevideo(mpeg, 1);

I set the display with SMPEG_setdisplay(), then I start playing the MPEG:

SMPEG_play(mpeg);

Any ideas? Do I need to do anything different? I noticed the new
third argument to SMPEG_new(), “sdl_audio”. In smpeg.h, it says:

The sdl_audio parameter indicates if SMPEG should initialize the SDL audio
subsystem. If not, you will have to use the SMPEG_playaudio() function
below to extract the decoded data.

(Note: the function is actually called “SMPEG_playAudio()”, with a capital “A”)

Right now, like it says above, I’m just sending “1” in as the "sdl_audio"
argument.

(I looked at the source to “gtv”, and it does the same thing, and it plays
the MPEG in question fine*.)

From what the .h file says for this function (and SMPEG_wantedSpec and
SMPEG_actualSpec), I don’t really understand what I’m supposed to pass in
to any of these functions.

Thanks!

-bill!

    • The MPEG in question also played fine when I was using SDL 0.11.2 and
      the mixer from 0.11.2’s demos archive. Of course, --enable-mixer wasn’t
      set, so I had those weird problems with mixer audio sometimes playing
      and MPEG audio sometimes playing…

In article <8324n9$ouh$1 at news.lokigames.com>,
William Kendrick writes:

Ok, I’ve got VidSlide compiled and running again. I configured smpeg
to use mixer ("./configure --enable-mixer").

However, when I run MPEGs with video and audio, the audio goes about
two times faster than it should.

When I run MPEGs with just audio (say, an MP3), the audio is just fine.

I’m using SDL 1.0.0, mixer 1.0.0 and smpeg 0.3.1.

First, I open the audio with:

Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
              MIX_DEFAULT_CHANNELS, 512)

Then, I load the MPEG:

mpeg = SMPEG_new(file, &info, 1);

I turn on audio and video:

SMPEG_enableaudio(mpeg, 1);
SMPEG_enablevideo(mpeg, 1);

I set the display with SMPEG_setdisplay(), then I start playing the MPEG:

SMPEG_play(mpeg);

Any ideas? Do I need to do anything different? I noticed the new
third argument to SMPEG_new(), “sdl_audio”. In smpeg.h, it says:

The sdl_audio parameter indicates if SMPEG should initialize the SDL audio
subsystem. If not, you will have to use the SMPEG_playaudio() function
below to extract the decoded data.

(Note: the function is actually called “SMPEG_playAudio()”, with a capital “A”)

Right now, like it says above, I’m just sending “1” in as the "sdl_audio"
argument.

(I looked at the source to “gtv”, and it does the same thing, and it plays
the MPEG in question fine*.)

From what the .h file says for this function (and SMPEG_wantedSpec and
SMPEG_actualSpec), I don’t really understand what I’m supposed to pass in
to any of these functions.

Thanks!

-bill!

    • The MPEG in question also played fine when I was using SDL 0.11.2 and
      the mixer from 0.11.2’s demos archive. Of course, --enable-mixer wasn’t
      set, so I had those weird problems with mixer audio sometimes playing
      and MPEG audio sometimes playing…

Is your MPEG file a mono or stereo stream? I have found a bug in SMPEG where this would
actually happen with mono MPEG streams. Actually SMPEG as of now just can’t perform correctly
the conversion from a mono stream to a stereo one if the output audio format is stereo,
and you end up with the sound appearing to be twice as fast.

I’m trying to find a good fix for this, so hold on :-)–
Stephane Peter
Programmer
Loki Entertainment Software

“Microsoft has done to computers what McDonald’s has done to gastronomy”

Is your MPEG file a mono or stereo stream?

The one with video (which is playing twice as fast) sounds like it’s
mono.

The one without video (ie, an MP3) (which plays just fine) is stereo.

I have found a bug in SMPEG where this would
actually happen with mono MPEG streams. Actually SMPEG as of now just can’t perform correctly
the conversion from a mono stream to a stereo one if the output audio format is stereo,
and you end up with the sound appearing to be twice as fast.

I’m trying to find a good fix for this, so hold on :slight_smile:

Thanks! :slight_smile:

Sam & everyone else, any word on a “listen to SDL’s audio output” callback?
(For things like equalizer displays, virtual light machines ;), etc.)

-bill!