NAME
Audio::ScratchLive v0.01 - this class provides 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 Scratch LIVE'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_version()
-
Returns the string version of the database or crate file you provided after using
parse
- get_num_tracks()
-
Returns the number of tracks found in the file you provided after using
parse
- get_type()
-
After running
parse
, this will tell you whether you provided a 'crate' or a 'database' file. - 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";
#this part is actually a no-no. I will provide a method for this later
#we are peeking into the Audio::ScratchLive object to steal the tracks
#each track is an Audio::ScratchLive::Track object
my $count = 0;
for my $track ( @{$sl->{_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>
ScratchTools (Java app)
L<http://www.scratchtools.de>
AUTHORS
Chase Whitener <cwhitener at gmail dot com>
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.