It's working! Well kind of. It plays the modules fine now :-)
I still need to get the mikmod interface to work to try to get correct
duration information. As I suspected I had a syntax error in the perl
script. It was missing "my" in front of a few variables I declared. I
assume that the proper way to declare local variables in perl :-P
Here's the corrected Mod.pm:
Code:
--------------------
package Slim::Formats::Mod;
# SlimServer Copyright (c) 2001-2004 Sean Adams, Slim Devices Inc.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License,
# version 2.
use strict;
# Given a file, return a hash of name value pairs,
# where each name is a tag name.
sub getTag {
my $file = shift || "";
my $filesize = -s $file;
$::d_formats && msg( "Opening Module information for $file\n");
# Make sure the file exists.
return undef unless $filesize && -r $file;
$::d_formats && msg( "Reading Module information for $file\n");
my $tags = {};
my $f;
open $f, "<$file" || return undef;
$::d_formats && msg("opened file $file\n");
# Settings that mikmod uses to convert the module (matches what's in
convert.conf)
my $endian = 0; # Modules converted by mikmod are little-endian
my $numChannels = 2; # Stereo.
my $sampleSize = 16;
my $samplesPerSecond = 44100;
my $numSampleFrames = 999999; # Will need to use the libmikmod interface to
get that later
$tags->{'ENDIAN'} = $endian;
$tags->{'FS'} = $filesize;
$tags->{'CHANNELS'} = $numChannels;
$tags->{'SAMPLESIZE'} = $sampleSize;
$tags->{'SIZE'} = $numSampleFrames * $numChannels * $sampleSize / 8;
$tags->{'OFFSET'} = 0;
$tags->{'RATE'} = $samplesPerSecond;
$tags->{'BITRATE'} = $samplesPerSecond * $numChannels * $sampleSize;
$tags->{'SECS'} = $numSampleFrames / $samplesPerSecond;
$tags->{'BLOCKALIGN'} = $numChannels * $sampleSize / 8;
return $tags;
}
1;
--------------------
On to duration now...
-WildCoder
--
WildCoder
------------------------------------------------------------------------
WildCoder's Profile: http://forums.slimdevices.com/member.php?userid=1827
View this thread: http://forums.slimdevices.com/showthread.php?t=17845
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix