mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-01-31 14:51:11 +03:00
handle "generic" visualizer - release
This commit is contained in:
Binary file not shown.
@@ -14,6 +14,8 @@ my $VISUALIZER_NONE = 0;
|
||||
my $VISUALIZER_VUMETER = 1;
|
||||
my $VISUALIZER_SPECTRUM_ANALYZER = 2;
|
||||
my $VISUALIZER_WAVEFORM = 3;
|
||||
my $VISUALIZER_VUMETER_ESP32 = 0x11;
|
||||
my $VISUALIZER_SPECTRUM_ANALYZER_ESP32 = 0x12;
|
||||
|
||||
{
|
||||
#__PACKAGE__->mk_accessor('array', 'modes');
|
||||
@@ -72,7 +74,7 @@ sub displayWidth {
|
||||
|
||||
if ($display->widthOverride) {
|
||||
my $artwork = $prefs->client($client)->get('artwork');
|
||||
if ($artwork->{'enable'} && $artwork->{'y'} < 32) {
|
||||
if ($artwork->{'enable'} && $artwork->{'y'} < 32 && $client->isPlaying) {
|
||||
return $artwork->{x} + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
} else {
|
||||
return $display->widthOverride + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
@@ -105,7 +107,7 @@ sub build_modes {
|
||||
my $client = shift->client;
|
||||
my $cprefs = $prefs->client($client);
|
||||
|
||||
my $width = shift || $cprefs->get('width') || 128;
|
||||
my $width = $cprefs->get('width') || 128;
|
||||
my $artwork = $cprefs->get('artwork');
|
||||
|
||||
# if artwork is in main display, reduce width
|
||||
@@ -154,39 +156,39 @@ sub build_modes {
|
||||
{ desc => ['VISUALIZER_VUMETER_SMALL'],
|
||||
bar => 0, secs => 0, width => $width, _width => -$small_VU_pos->{'width'},
|
||||
# extra parameters (width, height, col (< 0 = from right), row (< 0 = from bottom), left_space)
|
||||
params => [$VISUALIZER_VUMETER, $small_VU_pos->{'width'}, 32, $small_VU_pos->{'x'}, 0, 2] },
|
||||
params => [$VISUALIZER_VUMETER_ESP32, $small_VU_pos->{'width'}, 32, $small_VU_pos->{'x'}, 0, 2] },
|
||||
# mode 8
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER_SMALL'],
|
||||
bar => 0, secs => 0, width => $width, _width => -$small_spectrum_pos->{'width'},
|
||||
# extra parameters (width, height, col (< 0 = from right), row (< 0 = from bottom), left_space, bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, $small_spectrum_pos->{width}, 32, $small_spectrum_pos->{'x'}, 0, 2, $small_spectrum_pos->{'width'} / $spectrum->{small}->{band}, $spectrum->{scale}] },
|
||||
# extra parameters (width, height, col (< 0 = from right), row (< 0 = from bottom), left_space, #bars, scale)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, $small_spectrum_pos->{width}, 32, $small_spectrum_pos->{'x'}, 0, 2, $small_spectrum_pos->{'width'} / $spectrum->{small}->{band}, $spectrum->{scale}] },
|
||||
# mode 9
|
||||
{ desc => ['VISUALIZER_VUMETER'],
|
||||
bar => 0, secs => 0, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
params => [$VISUALIZER_VUMETER_ESP32] },
|
||||
# mode 10
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER'],
|
||||
bar => 0, secs => 0, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
# mode 11
|
||||
{ desc => ['VISUALIZER_VUMETER', 'AND', 'ELAPSED'],
|
||||
bar => 0, secs => 1, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
params => [$VISUALIZER_VUMETER_ESP32] },
|
||||
# mode 12
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'ELAPSED'],
|
||||
bar => 0, secs => 1, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
# mode 13
|
||||
{ desc => ['VISUALIZER_VUMETER', 'AND', 'REMAINING'],
|
||||
bar => 0, secs => -1, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
params => [$VISUALIZER_VUMETER_ESP32] },
|
||||
# mode 14
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'REMAINING'],
|
||||
bar => 0, secs => -1, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER_ESP32, int ($width/$spectrum->{full}->{band}), $spectrum->{scale}] },
|
||||
);
|
||||
|
||||
return \@modes;
|
||||
|
||||
@@ -26,7 +26,7 @@ sub playerSettingsFrame {
|
||||
$value = (unpack('Cn', $$data_ref))[1];
|
||||
if ($value > 100 && $value < 400) {
|
||||
$prefs->client($client)->set('width', $value);
|
||||
$client->display->modes($client->display->build_modes($value));
|
||||
$client->display->modes($client->display->build_modes);
|
||||
$client->display->widthOverride(1, $value);
|
||||
$client->update;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ sub playerSettingsFrame {
|
||||
$client->SUPER::playerSettingsFrame($data_ref);
|
||||
}
|
||||
|
||||
sub hasScrolling {
|
||||
sub hasScrolling {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -48,10 +48,4 @@ sub reconnect {
|
||||
$client->SUPER::reconnect(@_);
|
||||
}
|
||||
|
||||
sub directMetadata {
|
||||
my $client = shift;
|
||||
$client->SUPER::directMetadata(@_);
|
||||
Slim::Control::Request::notifyFromArray( $client, [ 'newmetadata' ] );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -55,8 +55,12 @@ sub handler {
|
||||
$client->display->modes($client->display->build_modes);
|
||||
$client->display->update;
|
||||
|
||||
# force update
|
||||
Plugins::SqueezeESP32::Plugin::update_artwork($client, 1) if $artwork->{'enable'};
|
||||
# force update or disable artwork
|
||||
if ($artwork->{'enable'}) {
|
||||
Plugins::SqueezeESP32::Plugin::update_artwork($client, 1);
|
||||
} else {
|
||||
Plugins::SqueezeESP32::Plugin::disable_artwork($client);
|
||||
}
|
||||
}
|
||||
|
||||
# as there is nothing captured, we need to re-set these variables
|
||||
|
||||
@@ -95,4 +95,10 @@ sub send_artwork {
|
||||
}
|
||||
}
|
||||
|
||||
sub disable_artwork {
|
||||
my ($client) = @_;
|
||||
my $header = pack('N', 0);
|
||||
$client->sendFrame( grfa => \$header );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<name>PLUGIN_SQUEEZEESP32</name>
|
||||
<description>PLUGIN_SQUEEZEESP32_DESC</description>
|
||||
<module>Plugins::SqueezeESP32::Plugin</module>
|
||||
<version>0.43</version>
|
||||
<version>0.50</version>
|
||||
<creator>Philippe</creator>
|
||||
</extensions>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<extensions>
|
||||
<plugins>
|
||||
<plugin version="0.43" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
|
||||
<plugin version="0.50" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
|
||||
<link>https://github.com/sle118/squeezelite-esp32</link>
|
||||
<creator>Philippe</creator>
|
||||
<sha>3460f07b43dcdb2cbdf4d10e6536da7abd87b3a1</sha>
|
||||
<sha>47feaf69a40ad4f87c58b34212d71e60dca99d3e</sha>
|
||||
<email>philippe_44@outlook.com</email>
|
||||
<desc lang="EN">SqueezeESP32 additional player id (100)</desc>
|
||||
<url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url>
|
||||
|
||||
Reference in New Issue
Block a user