Muskovitz has asked for the wisdom of the Perl Monks concerning the following question:
I got this problem using SDL::Mixer i got this error: 'No available audio device at test.pl ...' i tried googling it creating bash file 'SDL_AUDIODRIVER="alsa" export SDL_AUDIODRIVER' but no effect any ideas? here's my code:
Thanks in advance!#!/usr/bin/perl use strict; use warnings; use SDL; use SDL::App; use SDL::Surface; use SDL::Rect; use SDL::Event qw/:all/; use SDL::Music; use SDL::Mixer; use SDL::Sound; my $app=SDL::App->new( -title=>"Lunar Lander", -width=>640, -height=>480, -depth=>32, ); my $mixer = SDL::Mixer->new( -frequency => 44100, # 22050 -format => AUDIO_S16, # AUDIO_S16 -channels => 2, # 8 -size => 1024 ); my $music=new SDL::Music('images/music.ogg'); $mixer->music_volume(MIX_MAX_VOLUME); SDL::MixPlayMusic($music,0); #0 for single play my $frame=SDL::Surface->new(-name=>'images/policecar.png'); my $bg=SDL::Surface->new(-name=>'images/bg.png'); my $bg_rect=SDL::Rect->new( -height=>$bg->height(), -width=>$bg->width(), ); my $frame_rect=SDL::Rect->new( -height=>$frame->height(), -width=>$frame->width(), ); sub draw{ my($x,$y)=@_; $y=450*(1000-$y)/1000; $bg->blit($bg_rect,$app,$bg_rect); my $frame_dest=SDL::Rect->new( -height=>$frame->height(), -width=>$frame->width(), -x=>$x, -y=>$y, ); $frame->blit($frame_rect,$app,$frame_dest); $app->update($bg_rect); } my $counter=1; while($counter<=100){ $counter++; draw($counter, 46); $app->delay(10); } my $event=new SDL::Event; $event->pump(); $event->poll(); while($event->wait()){ my $type=$event->type(); print "left arrow pressed\n" if $type==SDLK_LEFT; exit if $type==SDL_QUIT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: No available audio device error SDL::Mixer
by Anonymous Monk on Dec 14, 2016 at 00:25 UTC |