[SDL] SMPEG (0.4.4) with SDL_mixer(1.2.5): No Sound

Bettina Rathmann B.Rathmann at ping.de
Sun May 9 04:44:00 PDT 2004


Hi,

sorry to disturb, but I have a question regarding SMPEG 0.4.4 and
SDL_mixer 1.2.5 und Linux 2.4.x (Suse 8.1):
I have a programme (no game) which plays MP3 via SDL_mixer and on user
request a small mpeg video with sound. If I play a mp3 before I start
the video, all is well, if I try to play a mp3 after that, nothing can
be heard, playing the video again plays the sound of the video but mp3
won't be heard again without restarting the programme.
What I do:
1. Initialization:
  if ( SDL_Init(SDL_INIT_AUDIO) < 0 )
     ...
  if (Mix_OpenAudio(44100, AUDIO_S16, 2, 2048) < 0)
     ...
  Mix_VolumeMusic(MIX_MAX_VOLUME);

2. Playing the mp3 (plays fine):
Mix_Chunk *V_MA_music = Mix_LoadMUS(p_sfx);
if ( V_MA_music != NULL )
   /* Play and then exit */
   Mix_PlayMusic(V_MA_music,1);
...

3. Playing the video:

This is ripped from the plaympeg.c demo of the smpeg package, basically
I do (V_MA_Audio is true, if Audio was init, else false). Works fine
sound can be heard, allways:
   SMPEG *V_MI_mpeg = SMPEG_new("film.mpg", &info, (V_MA_Audio ? 1 :
0));
    if (V_MA_Audio)
       SMPEG_enableaudio(V_MI_mpeg, 1);
       else SMPEG_enableaudio(V_MI_mpeg, 0);
    SMPEG_enablevideo(V_MI_mpeg, 1);
/* update does SDL_Flip(screen) */
    SMPEG_setdisplay(V_MI_mpeg, screen, NULL, update);
    SMPEG_scaleXY(V_MI_mpeg, width, height);
    SMPEG_move(V_MI_mpeg, 100, 100);
    /* Play it, and wait for playback to complete */
    SMPEG_play(V_MI_mpeg);
    done = 0;
    while ( ! done && ( SMPEG_status(V_MI_mpeg) == SMPEG_PLAYING) )
      {
            SDL_Event event;

            while (SDL_PollEvent(&event) )
                {
                  /* Break loop if SDLK_Escape was pressed */
		}         
         SMPEG_play(V_MI_mpeg);
         SDL_Delay(10);
      }
        SMPEG_stop(V_MI_mpeg);
        SMPEG_delete(V_MI_mpeg);
        V_MI_mpeg = NULL;

4. Playing a mp3 (see 2. but I can't hear a thing)
5. Playing video is ok with sound

What I have tried:
 - Not Loading MUSic but Chunks (converted mp3 -> wav), same effect
 - Tested if sound / music is playing ->
   printf("music is%s playing.\n", Mix_PlayingMusic()?"":" not");
   says is playing
 - Setting volume to max (nothing can be heard).
 - Reinitiliazing audio subsystem:
        SDL_QuitSubSystem(SDL_INIT_AUDIO);
        SDL_InitSubSystem(SDL_INIT_AUDIO);
   No effect

I'm currently really out of ideas, I would be grateful for any help you
could offer
thanks
Bettina






More information about the SDL mailing list