Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: Rock Band Drum Controller Player

by hardburn (Abbot)
on Oct 17, 2008 at 03:15 UTC ( #717645=note: print w/replies, xml ) Need Help??

in reply to Re: Rock Band Drum Controller Player
in thread Rock Band Drum Controller Player

Perhaps you have an old version of SDL? That symbol is exported by SDL_perl v2.1.3.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^3: Rock Band Drum Controller Player
by Anonymous Monk on Jan 19, 2009 at 01:19 UTC
    didn't work for me. maybe you are using the event fh? I didn't want to give permissions on it, so I refactored to use the Joystick class. Forgive me, I never hack perl :P Here's some code:
    #!/usr/bin/perl # Rock Band Drum Controller Player # Copyright (C) 2008 Timm Murray # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <> # use strict; use warnings; use Linux::Input::Joystick; use IO::Select; use SDL; use SDL::Sound; use SDL::Mixer; use YAML; use constant DEBUG => 0; my $DEV = shift; die "Need a device\n" unless $DEV; my %SOUNDS = ( snare => 'rock_band_drums/snare.wav', drum => 'rock_band_drums/drum.wav', hi_hat => 'rock_band_drums/hi_hat.wav', smash => 'rock_band_drums/crash.wav', bass => 'rock_band_drums/bass.wav', ); # 4 = foot # left to right # 2, 3, 0, 1 my %EVENTS = ( 4 => $SOUNDS{bass}, # Foot 2 => $SOUNDS{snare}, # Red 3 => $SOUNDS{hi_hat}, # Yellow 0 => $SOUNDS{drum}, # Blue 1 => $SOUNDS{smash}, # Green ); { my $ret = SDL::MixOpenAudio( 44100, AUDIO_S16, 2, 4096 ); die "Can't open audio: " . SDL_GetError() . "\n" if 0 > $ret; } sub debug { my (@in) = @_; return unless DEBUG; print @in, "\n"; } sub do_event { my ($event) = @_; my $type = $$event{type} || 0; my $value = $$event{value} || 0; my $number = $$event{number} || 0; debug( "Type [$type], value [$value], number [$number]" ); return 0 if ! exists $EVENTS{$number}; return 0 if $value == 0; my $file = $EVENTS{$number}; my $sound = SDL::MixLoadWAV( $file ); SDL::MixPlayChannel( -1, $sound, 0 ); return 1; } { my $js1 = Linux::Input::Joystick->new( $DEV ); my $selector = IO::Select->new; $selector->add( $js1->fh ); while (1) { while( my @events = $js1->poll ) { # print Dump($_) foreach (@events); foreach (@events) { next unless $$_{type} == 1; do_event( $_ ); } } } }
Re^3: Rock Band Drum Controller Player
by Anonymous Monk on Apr 07, 2009 at 06:33 UTC
    I had the same problem try replacing AUDIO_S16 with its value 32784 of course I don't get any sound, but I don't get any errors either.
      Ok I got it working I just had some paths messed up so yea use my $ret = SDL::MixOpenAudio( 44100, 32784, 2, 4096 ); Now I just have to try it on a better computer or something because I have a bit of delay
      I got it working I had some paths messed up. use the line my $ret = SDL::MixOpenAudio( 44100, 32784, 2, 4096 ); if you have errors with AUDIO_S16

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://717645]
[tye]: disable /proc and then see what it does?
[davido]: then it reads from /etc/passwd to decide who my uid is.
[davido]: sorry, typed that before you asked me to disable proc
[davido]: but you stumped me; don't know how to disable proc.
[tye]: I don't know if you can just dismount, but I thought so.
[davido]: yeah, umount -f isn't powerful enough.
[tye]: probably something in the init subsystem that does the mounting that you could disable and reboot.
davido needs to close laptop to board flight home from yapc.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-06-23 20:03 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (554 votes). Check out past polls.