NAME

Audio::ScratchLive - Simple way to read/write ScratchLIVE crates and databases

SYNOPSIS

use Audio::ScratchLive;
my $sl = WWW::ScratchLive->new( filename => '/path/Reggae.crate' )
    or die $!;

DESCRIPTION

This class provides a way to open and parse ScratchLIVE's binary crate and database files.

METHODS

new( HASH )

The new method returns an object of type Audio::Scratchlive if everything was successful, and 0 otherwise. Upon failure, $! is set containing the error and a 0 is returned.

The following are the accepted input parameters:

filename

The path to a crate or database file

parse()

The parse method reads through the file you provided, getting the header and track information. 1 on success, 0 otherwise. $! is set containing any error messages.

get_headers()

Returns the header info (hash-ref) found in the file you provided after using parse

get_num_tracks()

Returns the number of tracks found in the file you provided after using parse

get_tracks()

Returns a reference to an array of Audio::ScratchLive::Track objects. Provided after using parse

get_type()

After running parse, this will tell you whether you provided a 'crate' or a 'database' file.

get_version()

Returns the string version of the database or crate file you provided after using parse

set_filename( $path )

Provides a way to clear any parsed information and setup the object again like new for parsing a new file. Returns 0 and sets $! on failure.

EXAMPLES

parse a file

#!/usr/bin/perl
use strict;
use warnings;
use Audio::ScratchLive;
my $sl = Audio::ScratchLive->new( 'filename' => '/path/to/Reggae.crate' )
    or die $!;
$sl->parse() or die $!

print "Found ", $sl->get_num_tracks(), " tracks\n";

#each track is an Audio::ScratchLive::Track object
my $count = 0;
my $a_tracks = $sl->get_tracks();
for my $track ( @{$a_tracks} ) {
    print "Info for track ", ++$count, "\n";
    my $a_keys = $track->get_keys();
    for my $key ( @{$a_keys} ) {
        print $key, " == ", $track->get_value($key), "\n";
    }
    print "\n";
}

SUPPORT

Please visit EFNet #perl for assistance with this module. "genio" is the author.

CAVEATS

Not enough test cases built into the install yet. More to be added.

No way yet to cleanly access the tracks.

A few of the fields for the tracks in a DB file are still unknown as to what they do.

The fields at the beginning of a crate file aren't yet parsed, I kind of skip them to just get the track information.

No way to write crate or DB files yet.

A lot of other problems probably.

Not enough documentation.

SEE ALSO

Author's Web site that will eventually contain a cookbook
L<http://www.cwhitener.org>

Rane/Serato's ScratchLIVE web site (with forums)
L<http://www.scratchlive.net>

ScratchTools (Java app)
L<http://www.scratchtools.de>

AUTHORS

Chase Whitener <cwhitener at gmail dot com>

Thanks to:

q[Caelum] (EFNet #perl) - Finding and fixing the Solaris problem.

COPYRIGHT

Copyright 2009, Chase Whitener. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.