The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Allegro::Sample - Allegro digital sound routines

SYNOPSIS

   use Allegro;

   $al = Allegro->new() or die;
   $al->Sound(digi => 'auto') or die $al->error;

   $spl = $al->Sample(file => "test.wav") or die;
   $spl->play(loop => 1);

   sleep 10;

DESCRIPTION

The Allegro::Sample module provides an interface to the Allegro sample routines. An Allegro module should already be initialized for this to work.

METHODS

new - create a new sample

This method loads a new sample from disk.

   $spl = $al->Sample(file => $filename);

   I<file> is the name of the file to load, and is required.
play - play sample

Plays sample.

   $spl->play(volume => $vol,
              pan    => $pan,
              freq   => $freq,
              loop   => $loop);
volume (optional)

volume at which to play sample (0-255)

pan (optional)

left/right panning at which to play sample (0-255). 0 is hard left, 255 is hard right.

freq (optional)

relative frequency at which to play sample. 1000 is standard, 2000 double, 500 half, etc.

loop (optional)

sample will loop if this option is set. use $spl->stop() to end it.

adjust - adjusts a currently playing sample

Adjusts a currently playing sample. Takes the same arguments as Allegro::Sample::play().

   $spl->adjust(...);
stop - stops a currenlt playing sample

Stops a sample.

   $spl->stop;

AUTHOR

Colin O'Leary <colino@cpan.org>

COPYRIGHT

Copyright 2003 by Colin O'Leary. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The Allegro library is copyright its authors, and is giftware. See http://alleg.sf.net for more information.

SEE ALSO

Allegro - Base Allegro routines
Allegro - Allegro Sound initilization object