[SDL] No Sound Output

Timm Murray tmurray-sdl at wumpus-cave.net
Wed Nov 2 14:38:32 PST 2005


On Wednesday 02 November 2005 01:20 pm, Bill Kendrick wrote:
> On Wed, Nov 02, 2005 at 11:32:14AM -0500, Timm Murray wrote:
> > I'm on Gentoo.  I emerged SDL_mixer again, but it still segfaults.
>
> What does your code look like now?  Before, you had:
>
>  printf( "Playing file: %s\n", file );
>  wav = Mix_LoadWAV( file );
>  ret = Mix_PlayChannel( -1, wav, -1 );
>  if( 0 > ret ) {
>   printf( "Error playing audio: %s\n", Mix_GetError() );

----
        printf( "Playing file: %s\n", file );
        wav = Mix_LoadWAV( file );
        if(! wav) {
                printf( "Can't load wav file: %s\n", Mix_GetError() );
                exit(1);
        }
        
        ret = Mix_PlayChannel( -1, wav, -1 );
        if( 0 > ret ) { 
                printf( "Error playing audio: %s\n", Mix_GetError() );
        }
        else {
                printf( "Played on channel %i\n", ret );
        }
        while(Mix_Playing(-1) > 0);
----

Compiled with: gcc `sdl-config --libs --cflags` -lSDL_mixer -o play_sound 
play_sound_mixer.c

Gives:

----
$ ./play_sound ../data/sound/plasma.wav  
Playing file: ../data/sound/plasma.wav
Played on channel 0
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
----

The 'wavplay' program on my system plays the sound successfully.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051102/6445c831/attachment-0008.pgp>


More information about the SDL mailing list