Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re: SDL::Mixer - How to specify the device? by zentara
in thread SDL::Mixer - How to specify the device? by shotgunefx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-16 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found