Dan Pemstein > Audio-Ao-0.01 > Audio::Ao

Download:
Audio-Ao-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Audio::Ao - A Perl wrapper for the Ao audio library.

SYNOPSIS ^

  use Audio::Ao qw(:all);
  
        initialize_ao;
        my $device = open_live(default_driver_id(), 16, $rate, $channels,
                is_big_endian(), {});
        while (#have data) {
                play($device, $data_buffer, $len_of_buffer);
        }
        close_ao($device($device));
        shutdown_ao;

DESCRIPTION ^

Provides access to Libao, "a cross-platform library that allows programs to output PCM audio data to the native audio devices on a wide variety of platforms." Libao currently supports OSS, ESD, ALSA, Sun audio, and aRts.

SUBROUTINES ^

initialize_ao ()

Initializes the underlying library. This must be called before any other Ao operations are performed.

shutdown_ao ()

Closes down the underlying libraries. Call this when you're done.

open_live ($driver_id, $bits, $rate, $channels, $byte_format, %options)

Opens a live playback audio device for output. Takes driver id number, bits per sample, sample rate, number of channels, and byte format (big or little endian). The options hash is optional, although you must pass at least and empty hash to the function. Options differ based on driver, see http://docs.meg.nu/local-docs/libao/drivers.html for more information. Returns undef on failure and a device (passed to play) on success.

open_file ($driver_id, $filename, $overwrite, $bits, $rate, $channles, $byte_format, %options)

This function is equivalent to open_live except that it writes to a file given by $filename. Set $overwrite to true to automatically overwrite existing files.

play ($device, $buffer, $length)

Plays the specified number of bytes from $buffer to the device. Returns nonzero on success, 0 on failure.

close_ao ($device)

Closes the given device. Returns 0 on failure.

driver_id ($short_name)

Returns the id number of the driver with the given $short_name. Returns -1 on failure. Non-negative numbers are driver ids.

default_driver_id ()

Returns the id number of the default driver on this system. Returns -1 on failure.

driver_info ($driver_id)

Returns a hash containing various information about the driver with the specified id. An empty hash represents failure. See http://docs.meg.nu/local-docs/libao/ao_info.html for a list of key values (same as in the struct). Note that char **options is held as a nested array within the hash and the int option_count is ignored.

driver_info_list ()

Returns an array containing the driver_info hashes for every driver supported by the system.

is_big_endian ()

Returns true if the system is big endian, false otherwrise.

REQUIRES ^

Inline::C, libao

AUTHOR ^

Dan Pemstein <dan@lcws.org>

COPYRIGHT ^

Copyright (c) 2003, Dan Pemstein. All Rights Reserved.

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 2 of the License, or (at your option) any later version. A copy of this license is included with this module (LICENSE.GPL).

SEE ALSO ^

Inline::C. libao-perl

syntax highlighting: