PDA

View Full Version : Crossfade problems



ceepan
2006-01-03, 02:54
I received my Squeezebox 3 (Wired Only) last week and am really happy with it. Great job SLim Devices! I downloaded Slim Server 6.2.1 and have been using that. Everything is fine other than Crossfade. I enabled this and set the duration to 8 seconds. This works, however consecutive tracks from the same album are also being crossfaded. I didn't think that this was suposed to happen. Am I doing something wrong?

Paul

mattybain
2006-01-03, 05:25
I think this is supposed to happen with the default crossfade option (at least it does with mine).

To change it so it doesn't cross fade with tracks on the same album you need the dynamic transitions plugin.

http://www.sutula.us/james/slimserver/

ceepan
2006-01-03, 08:32
Works a treat. Thanks for the help.

mattybain
2006-01-03, 09:24
It is a strange name and possibly makes it hard to find. James could you be presuaded to change the name to something that specifically mentions crossfade?

ceepan
2006-09-11, 09:12
I have upgraded to 6.5b (uninstalled 6.2.1), got version 1.3 of the plugin, changed variables to what I had in old transitions.pm file and restarted SLimserver, but am getting no crossfade on playlists. I have pasted in my transition.pm file:

Any help appreciated.

Thanks,
Paul

# Updated by James Sutula (j2m2s (A_t) hotmail.com) December 5 2005
# Version 1.3
#
# This code is derived from code with the following copyright message:
#
# SlimServer Copyright (C) 2005 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.
#
package Plugins::Transitions;

use strict;
use vars qw($VERSION);
use Slim::Player::ReplayGain;
$VERSION = substr( q$Revision: 1.3 $, 10 );

# USER CONFIG START

# Change these variables to get the desired behavior when playing an album
# or random tracks
# Key:
# transition_type: '0' = none, '1' = crossfade, '2' = fade in, '3' = fade out, '4' fade in & fade out
# transition_duration: (seconds)
my $album_transition_type = 0;
my $album_transition_duration = 0;
my $random_transition_type = 1;
my $random_transition_duration = 8;

# Specify the default transition behavior for cases when a track is playing with an excluded genre
# (see next section)
my $default_transition_type = 1;
my $default_transition_duration = 8;

# Optionally specifiy genres you would like to exclude from being processed
# For example, if I wanted to exclude any tracks with genre 'Jazz', 'Bluegrass', or 'Blues' from having
# any transition behavior but the default, the following line would look like:
# my %exclude_genre = ('Jazz'=>'', 'Bluegrass'=>'', 'Blues'=>'');
my %exclude_genre = ();

# USER CONFIG END


sub getDisplayName {return 'PLUGIN_TRANSITIONS'}

sub strings() { return '
PLUGIN_TRANSITIONS
EN Dynamic Transition Updater

PLUGIN_TRANSITIONS_DESC
EN Changes the SB2 between-track transition to your preference based on whether an album is playing.
'};

sub initPlugin {
$::d_plugins && Slim::Utils::Misc::msg("Dynamic Transition Updater initialized.\n");
Slim::Control::Command::setExecuteCallback(\&commandCallback);
}

sub shutDownPlugin {
Slim::Control::Command::clearExecuteCallback(\&commandCallback);
}

sub commandCallback {
my $client = shift;
my $params_ref = shift;
my $ds = Slim::Music::Info::getCurrentDataStore();

my $slim_command = @$params_ref[0];

#only care about newsong command
if ($slim_command eq "newsong")
{
if (validGenre($client))
{
#if next or previous song is album match, use playing album options
if (Slim::Player::ReplayGain->trackAlbumMatch($ds, $client, -1) || Slim::Player::ReplayGain->trackAlbumMatch($ds, $client, 1))
{
Slim::Utils::Prefs::clientSet($client,"transitionDuration",$album_transition_duration);
Slim::Utils::Prefs::clientSet($client,"transitionType",$album_transition_type);
$::d_plugins && Slim::Utils::Misc::msg("DTU: Using transition preferences for playing an album.\n");
}
#else use playing random tracks option
else
{
Slim::Utils::Prefs::clientSet($client,"transitionDuration",$random_transition_duration);
Slim::Utils::Prefs::clientSet($client,"transitionType",$random_transition_type);
$::d_plugins && Slim::Utils::Misc::msg("DTU: Using transition preferences for random tracks.\n");
}
}
else
{
Slim::Utils::Prefs::clientSet($client,"transitionDuration",$default_transition_duration);
Slim::Utils::Prefs::clientSet($client,"transitionType",$default_transition_type);
$::d_plugins && Slim::Utils::Misc::msg("DTU: Genre for current or next track is excluded from transition processing. Using default transition preferences.\n");
}
}
}

sub validGenre {
my $client = shift;

my $ds = Slim::Music::Info::getCurrentDataStore();

my $current_index = Slim::Player::Source::streamingSongIndex($client);
my $current_fullpath = Slim::Player::Playlist::song($client, $current_index);
my $current_track;
my $current_genre;

my $next_index = Slim::Player::Source::streamingSongIndex($client) + 1;
my $next_fullpath = Slim::Player::Playlist::song($client, $next_index);
my $next_track;
my $next_genre;

if (defined $current_fullpath)
{
$current_track = $ds->objectForUrl($current_fullpath);
$current_genre = $current_track->genre();
if (defined $current_genre && exists($exclude_genre{$current_genre}))
{
return 0;
}
}

if (defined $next_fullpath)
{
$next_track = $ds->objectForUrl($next_fullpath);
$next_genre = $next_track->genre();
if (defined $next_genre && exists($exclude_genre{$next_genre}))
{
return 0;
}
}

# Genre not found in genre exclude list
return 1;
}

1;