in reply to SDL::Mixer - How to specify the device?

Just helping you troubleshoot, but your script dosn't play on my linux box with the latest kernel and alsa. So I'm not sure, but there are 2 possible errors I see.

1. Try this script, it uses play_music instead of play_channel, and puts a loop at the end to keep the script from exiting prematurely.

#!/usr/bin/perl use strict; use warnings; use SDL; use SDL::Mixer; use SDL::Music; my $mixer = SDL::Mixer->new( -frequency => MIX_DEFAULT_FREQUENCY, # 22050 -format => MIX_DEFAULT_FORMAT, # AUDIO_S16 -channels => MIX_DEFAULT_CHANNELS, # 8 -size => 1024 #higher numbers give sloppy reponse #as buffers continue to empty ); # provides 8 channels of # 16 bit audio at 22050 Hz. and a single channel of music. #background can be mp3,ogg or wav (mp3 needs smpeg libs) my $mp3 = new SDL::Music('1bb.mp3'); $mixer->music_volume(MIX_MAX_VOLUME); #128 $mixer->play_music( $mp3, 100 ); my $done = 0; while (! $done && ( SDL::GetAudioStatus() == SDL_AUDIO_PLAYING())) {SDL::Delay(1); }

2. Look for /dev/sequencer in /dev. On my alsa setup there is a link to /dev/sound/sequencer, which is what alsa sets up. Maybe you are missing the link?

See Tk Game Sound demo

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: SDL::Mixer - How to specify the device?
by shotgunefx (Parson) on Dec 03, 2006 at 23:10 UTC
    A kick in the right direction.

    My example wasn't dying, it was just a warning. It just was exiting so quick as I wasn't delaying, I didn't even hear a pop on the speaker.

    Having said that, play_music is what I needed, as play_channel screetches for some seconds and then SEGFAULTs.

    I do have /dev/sequencer , maybe a driver problem, but I don't listen to MIDI so I'm not too concerned.


    "To be civilized is to deny one's nature."