Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: SDL::Mixer - How to specify the device?

by zentara (Archbishop)
on Dec 03, 2006 at 13:26 UTC ( [id://587500]=note: print w/replies, xml ) Need Help??


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.

    Thanks.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://587500]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found