"log-like" scale on spectrum visu

This commit is contained in:
philippe44
2020-02-18 18:37:03 -08:00
parent 4e7ff0a37a
commit d78c50f781
9 changed files with 83 additions and 45 deletions

Binary file not shown.

View File

@@ -16,6 +16,7 @@ my $VISUALIZER_SPECTRUM_ANALYZER = 2;
my $VISUALIZER_WAVEFORM = 3;
my $width = $prefs->get('width') || 128;
my $spectrum_scale = $prefs->get('spectrum_scale') || 0.5;
my @modes = (
# mode 0
@@ -55,7 +56,7 @@ my @modes = (
{ 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] },
params => [$VISUALIZER_SPECTRUM_ANALYZER, 32, 32, -32, 0, 2, 6, $spectrum_scale] },
# mode 9
{ desc => ['VISUALIZER_VUMETER'],
bar => 0, secs => 0, width => $width,
@@ -64,7 +65,7 @@ my @modes = (
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER'],
bar => 0, secs => 0, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16, $spectrum_scale] },
# mode 11
{ desc => ['VISUALIZER_VUMETER', 'AND', 'ELAPSED'],
bar => 0, secs => 1, width => $width,
@@ -73,7 +74,7 @@ my @modes = (
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'ELAPSED'],
bar => 0, secs => 1, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16, $spectrum_scale] },
# mode 13
{ desc => ['VISUALIZER_VUMETER', 'AND', 'REMAINING'],
bar => 0, secs => -1, width => $width,
@@ -82,7 +83,7 @@ my @modes = (
{ desc => ['VISUALIZER_SPECTRUM_ANALYZER', 'AND', 'REMAINING'],
bar => 0, secs => -1, width => $width,
# extra parameters (bars)
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16] },
params => [$VISUALIZER_SPECTRUM_ANALYZER, 16, $spectrum_scale] },
);
@@ -135,14 +136,6 @@ sub displayHeight {
return 32;
}
sub updateWidth {
my ($display, $width) = @_;
foreach my $mode (@{$display->modes}) {
$mode->{width} = $width + 1 + $mode->{_width} || 0;
}
}
sub vfdmodel {
return 'graphic-'.$width.'x32';
}

View File

@@ -6,6 +6,11 @@
<input type="text" class="stdedit" name="pref_width" id="pref_width" value="[% prefs.pref_width %]" size="3">
[% END %]
[% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE" desc="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE_DESC" %]
<input type="number" min="10" max= "50" step="5" class="stdedit" name="pref_spectrum_scale" id="pref_spectrum_scale" value="[% prefs.pref_spectrum_scale %]" size="3">
[% END %]
</div>
[% PROCESS settings/footer.html %]

View File

@@ -10,6 +10,7 @@ my $prefs = preferences('plugin.squeezeesp32');
$prefs->init({
width => 128,
spectrum_scale => 50,
});
my $log = Slim::Utils::Log->addLogCategory({

View File

@@ -17,13 +17,14 @@ sub page {
}
sub prefs {
return (preferences('plugin.SqueezeESP32'), qw(width));
return (preferences('plugin.SqueezeESP32'), qw(width spectrum_scale));
}
sub handler {
my ($class, $client, $params, $callback, @args) = @_;
$callback->($client, $params, $class->SUPER::handler($client, $params), @args);
$client->update();
}

View File

@@ -10,6 +10,6 @@
<name>PLUGIN_SQUEEZEESP32</name>
<description>PLUGIN_SQUEEZEESP32_DESC</description>
<module>Plugins::SqueezeESP32::Plugin</module>
<version>0.10</version>
<version>0.11</version>
<creator>Philippe</creator>
</extensions>

View File

@@ -9,3 +9,11 @@ PLUGIN_SQUEEZEESP32_DESC
PLUGIN_SQUEEZEESP32_WIDTH
EN Screen width
PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE
EN Spectrum scale
PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE_DESC
EN Sets the scale factor % of spectrum visualizer by halves for better representation.
EN For example, 50 means that 50% of spectrum is displayed in 1/2 of the screen, so it's linear...
EN But 25 means that only 25% of spectrum is displayed in 1/2 of the screen, so it's a sort of log

View File

@@ -1,10 +1,10 @@
<?xml version='1.0' standalone='yes'?>
<extensions>
<plugins>
<plugin version="0.10" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
<plugin version="0.11" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
<link>https://github.com/sle118/squeezelite-esp32</link>
<creator>Philippe</creator>
<sha>5a35a7b821e887baf869535f113b8b55bbc52a54</sha>
<sha>b923bd7dd412d1897eb8be2dec862f91f1e36dc4</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>