Alex Shinn > libao-perl > Ao

Download:
libao-perl_0.03-1.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Ao - Perl extension for ao cross-platform audio library

SYNOPSIS ^

  use Ao;

  $ao_id1 = Ao::get_driver_id('oss');
  %ao_info = %{Ao::get_driver_info($ao_id1)};
  $ao_endian = Ao::is_big_endian();
  $ao_dev1 = Ao::open($ao_id);
  Ao::play($ao_dev1, $buffer, $len);
  Ao::close($ao_dev1);

  $ao_id2 = Ao::get_driver_id('wav');
  %ao_options = ('file' => 'out.wav');
  $ao_dev2 = Ao::open($ao_id2, 16, 44100, 2, %ao_options);
  $ao_dev2->play($buffer, $len);
  $ao_dev2->close();

DESCRIPTION ^

This is a simple object-oriented wrapper around the ao audio library. Use Ao::get_driver_id to obtain an integer id from a short driver name. Currently supported drivers are oss, irix, solaris, esd, alsa and wav.

A small hash of driver info (with fields name, short_name, author and comments) can be obtained with Ao::get_driver_info.

Ao::is_big_endian can be used to test the byte-order of the machine.

Open a device with

  Ao::open($driver_id, $bits_per_sample, $rate, $channels, %options)

where the default values are 16 bits at 44100 Hz stereo, and no options. options is a hash of named parameters to pass to the specific driver. The wav driver defaults to writing output to the file output.wav - you can change this by passing the file option. Other options can be found in the ao documentation.

Play to a device with

  Ao::play($device, $buffer, $len)

where $device is the device returned from Ao::open, $buffer is a pointer to a buffer of sound input, and $len is the length of the buffered sound to play. To obtain sound input you will need to use a separate module such as Ogg::Vorbis.

When you are done, close the device with Ao::close($device).

Exported constants ^

  AO_ALSA
  AO_BEOS
  AO_DRIVERS
  AO_ESD
  AO_IRIX
  AO_NULL
  AO_OSS
  AO_RAW
  AO_SOLARIS
  AO_WAV
  AO_WIN32

AUTHOR ^

Alex Shinn, foof@debian.org

SEE ALSO ^

perl(1), Ogg::Vorbis(3pm), and the README distributed with ao.

syntax highlighting: