mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 14:07:11 +03:00
Add spectrum visualizer
This commit is contained in:
Binary file not shown.
@@ -11,6 +11,10 @@ my $prefs = preferences('plugin.squeezeesp32');
|
||||
my $log = logger('plugin.squeezeesp32');
|
||||
|
||||
my $VISUALIZER_NONE = 0;
|
||||
my $VISUALIZER_VUMETER = 1;
|
||||
my $VISUALIZER_SPECTRUM_ANALYZER = 2;
|
||||
my $VISUALIZER_WAVEFORM = 3;
|
||||
|
||||
my $width = $prefs->get('width') || 128;
|
||||
|
||||
my @modes = (
|
||||
@@ -42,6 +46,44 @@ my @modes = (
|
||||
{ desc => ['SETUP_SHOWBUFFERFULLNESS'],
|
||||
bar => 0, secs => 0, width => $width, fullness => 1,
|
||||
params => [$VISUALIZER_NONE] },
|
||||
# mode 7
|
||||
{ desc => ['VISUALIZER_VUMETER_SMALL'],
|
||||
bar => 0, secs => 0, width => $width, _width => -20,
|
||||
# extra parameters (width, height, col (< 0 = from right), row (< 0 = from bottom), bars, left space)
|
||||
params => [$VISUALIZER_VUMETER, 20, 32, -20, 0, 2] },
|
||||
# mode 8
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER_SMALL'],
|
||||
bar => 0, secs => 0, width => $width, _width => -32,
|
||||
# extra parameters (width, height, col (< 0 = from right), row (< 0 = from bottom), bars, left space)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, 32, 32, -32, 0, 2, 6] },
|
||||
# mode 9
|
||||
{ desc => ['VISUALIZER_VUMETER'],
|
||||
bar => 0, secs => 0, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
# mode 10
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER'],
|
||||
bar => 0, secs => 0, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
|
||||
# mode 11
|
||||
{ desc => ['VISUALIZER_VUMETER', 'AND', 'ELAPSED'],
|
||||
bar => 0, secs => 1, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
# mode 12
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'ELAPSED'],
|
||||
bar => 0, secs => 1, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
|
||||
# mode 13
|
||||
{ desc => ['VISUALIZER_VUMETER', 'AND', 'REMAINING'],
|
||||
bar => 0, secs => -1, width => $width,
|
||||
params => [$VISUALIZER_VUMETER] },
|
||||
# mode 14
|
||||
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'REMAINING'],
|
||||
bar => 0, secs => -1, width => $width,
|
||||
# extra parameters (bars)
|
||||
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
|
||||
|
||||
);
|
||||
|
||||
sub modes {
|
||||
@@ -52,6 +94,27 @@ sub nmodes {
|
||||
return $#modes;
|
||||
}
|
||||
|
||||
sub displayWidth {
|
||||
my $display = shift;
|
||||
my $client = $display->client;
|
||||
|
||||
# if we're showing the always-on visualizer & the current buttonmode
|
||||
# hasn't overridden, then use the playing display mode to index
|
||||
# into the display width, otherwise, it's fullscreen.
|
||||
my $mode = 0;
|
||||
|
||||
if ( $display->showVisualizer() && !defined($client->modeParam('visu')) ) {
|
||||
my $cprefs = preferences('server')->client($client);
|
||||
$mode = $cprefs->get('playingDisplayModes')->[ $cprefs->get('playingDisplayMode') ];
|
||||
}
|
||||
|
||||
if ($display->widthOverride) {
|
||||
return $display->widthOverride + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
} else {
|
||||
return $display->modes->[$mode || 0]{width};
|
||||
}
|
||||
}
|
||||
|
||||
# I don't think LMS renderer handles properly screens other than 32 pixels. It
|
||||
# seems that all we get is a 32 pixel-tall data with anything else padded to 0
|
||||
# i.e. if we try 64 pixels height, bytes 0..3 and 4..7 will contains the same
|
||||
@@ -72,8 +135,12 @@ sub displayHeight {
|
||||
return 32;
|
||||
}
|
||||
|
||||
sub displayWidth {
|
||||
return shift->widthOverride(@_) || $width;
|
||||
sub updateWidth {
|
||||
my ($display, $width) = @_;
|
||||
|
||||
foreach my $mode (@{$display->modes}) {
|
||||
$mode->{width} = $width + 1 + $mode->{_width} || 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub vfdmodel {
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<name>PLUGIN_SQUEEZEESP32</name>
|
||||
<description>PLUGIN_SQUEEZEESP32_DESC</description>
|
||||
<module>Plugins::SqueezeESP32::Plugin</module>
|
||||
<version>0.9</version>
|
||||
<version>0.10</version>
|
||||
<creator>Philippe</creator>
|
||||
</extensions>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<extensions>
|
||||
<plugins>
|
||||
<plugin version="0.9" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
|
||||
<plugin version="0.10" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
|
||||
<link>https://github.com/sle118/squeezelite-esp32</link>
|
||||
<creator>Philippe</creator>
|
||||
<sha>89c68b54ad4373df6c0cd37222a07b53013c4815</sha>
|
||||
<sha>5a35a7b821e887baf869535f113b8b55bbc52a54</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