equalizer w/o display

This commit is contained in:
Philippe G
2020-04-17 14:54:39 -07:00
parent 30454bbd0c
commit e0e309c4ed
7 changed files with 83 additions and 69 deletions

Binary file not shown.

View File

@@ -1,5 +1,6 @@
[% PROCESS settings/header.html %] [% PROCESS settings/header.html %]
[% IF prefs.pref_width %]
[% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %] [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %]
<!--<input type="text" readonly class="stdedit" name="pref_width" id="width" value="[% prefs.pref_width %]" size="3">--> <!--<input type="text" readonly class="stdedit" name="pref_width" id="width" value="[% prefs.pref_width %]" size="3">-->
[% prefs.pref_width %] [% prefs.pref_width %]
@@ -34,6 +35,8 @@
[% END %] [% END %]
<hr> <hr>
[% END %]
[% WRAPPER setting title="PLUGIN_SQUEEZEESP32_EQUALIZER" desc="" %] [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_EQUALIZER" desc="" %]
[% END %] [% END %]

View File

@@ -15,12 +15,6 @@ sub hasIR { 0 }
sub init { sub init {
my $client = shift; my $client = shift;
$prefs->client($client)->init( {
eq => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
}
);
$client->SUPER::init(@_); $client->SUPER::init(@_);
Plugins::SqueezeESP32::Plugin::config_artwork($client); Plugins::SqueezeESP32::Plugin::config_artwork($client);
} }
@@ -61,7 +55,6 @@ sub reconnect {
my $client = shift; my $client = shift;
$client->pluginData('artwork_md5', ''); $client->pluginData('artwork_md5', '');
$client->SUPER::reconnect(@_); $client->SUPER::reconnect(@_);
Plugins::SqueezeESP32::Plugin::send_equalizer($client);
} }
1; 1;

View File

@@ -21,7 +21,7 @@ sub needsClient {
sub validFor { sub validFor {
my ($class, $client) = @_; my ($class, $client) = @_;
return $client->model eq 'squeezeesp32' && $client->displayWidth; return $client->model eq 'squeezeesp32';
} }
sub page { sub page {
@@ -40,6 +40,7 @@ sub handler {
my ($cprefs, @prefs) = $class->prefs($client); my ($cprefs, @prefs) = $class->prefs($client);
if ($paramRef->{'saveSettings'}) { if ($paramRef->{'saveSettings'}) {
if ($client->displayWidth) {
$cprefs->set('small_VU', $paramRef->{'pref_small_VU'}); $cprefs->set('small_VU', $paramRef->{'pref_small_VU'});
my $spectrum = { scale => $paramRef->{'pref_spectrum_scale'}, my $spectrum = { scale => $paramRef->{'pref_spectrum_scale'},
small => { size => $paramRef->{'pref_spectrum_small_size'}, small => { size => $paramRef->{'pref_spectrum_small_size'},
@@ -47,6 +48,7 @@ sub handler {
full => { band => $paramRef->{'pref_spectrum_full_band'} }, full => { band => $paramRef->{'pref_spectrum_full_band'} },
}; };
$cprefs->set('spectrum', $spectrum); $cprefs->set('spectrum', $spectrum);
my $artwork = { enable => $paramRef->{'pref_artwork_enable'}, my $artwork = { enable => $paramRef->{'pref_artwork_enable'},
x => $paramRef->{'pref_artwork_x'}, x => $paramRef->{'pref_artwork_x'},
y => $paramRef->{'pref_artwork_y'}, y => $paramRef->{'pref_artwork_y'},
@@ -55,13 +57,6 @@ sub handler {
$client->display->modes($client->display->build_modes); $client->display->modes($client->display->build_modes);
$client->display->update; $client->display->update;
my $eq = $cprefs->get('eq');
for my $i (0 .. $#{$eq}) {
$eq->[$i] = $paramRef->{"pref_eq.$i"};
}
$cprefs->set('eq', $eq);
Plugins::SqueezeESP32::Plugin::send_equalizer($client);
# force update or disable artwork # force update or disable artwork
if ($artwork->{'enable'}) { if ($artwork->{'enable'}) {
Plugins::SqueezeESP32::Plugin::update_artwork($client, 1); Plugins::SqueezeESP32::Plugin::update_artwork($client, 1);
@@ -70,6 +65,15 @@ sub handler {
} }
} }
my $eq = $cprefs->get('eq');
for my $i (0 .. $#{$eq}) {
$eq->[$i] = $paramRef->{"pref_eq.$i"};
}
$cprefs->set('eq', $eq);
Plugins::SqueezeESP32::Plugin::send_equalizer($client);
}
if ($client->displayWidth) {
# as there is nothing captured, we need to re-set these variables # as there is nothing captured, we need to re-set these variables
$paramRef->{'pref_width'} = $cprefs->get('width'); $paramRef->{'pref_width'} = $cprefs->get('width');
@@ -79,6 +83,8 @@ sub handler {
# logic of "Settings" is beyond me and I really hate it # logic of "Settings" is beyond me and I really hate it
$paramRef->{'pref_spectrum'} = $cprefs->get('spectrum'); $paramRef->{'pref_spectrum'} = $cprefs->get('spectrum');
$paramRef->{'pref_artwork'} = $cprefs->get('artwork'); $paramRef->{'pref_artwork'} = $cprefs->get('artwork');
}
$paramRef->{'pref_eq'} = $cprefs->get('eq'); $paramRef->{'pref_eq'} = $cprefs->get('eq');
return $class->SUPER::handler($client, $paramRef); return $class->SUPER::handler($client, $paramRef);

View File

@@ -36,6 +36,7 @@ sub initPlugin {
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] ); Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] );
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]); Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]);
Slim::Control::Request::subscribe( \&onStopClear, [ ['playlist'], ['stop', 'clear'] ]); Slim::Control::Request::subscribe( \&onStopClear, [ ['playlist'], ['stop', 'clear'] ]);
Slim::Control::Request::subscribe( \&onPlayer,[ ['client'], [ 'new', 'reconnect' ] ] );
} }
sub onStopClear { sub onStopClear {
@@ -50,6 +51,17 @@ sub onStopClear {
} }
} }
sub onPlayer {
my $request = shift;
my $client = $request->client;
if ($client->model eq 'squeezeesp32') {
$prefs->client($client)->init( {
eq => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
} );
Plugins::SqueezeESP32::Plugin::send_equalizer($client);
}
}
sub onNotification { sub onNotification {
my $request = shift; my $request = shift;

View File

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

View File

@@ -1,10 +1,10 @@
<?xml version='1.0' standalone='yes'?> <?xml version='1.0' standalone='yes'?>
<extensions> <extensions>
<plugins> <plugins>
<plugin version="0.81" name="SqueezeESP32" minTarget="7.5" maxTarget="*"> <plugin version="0.82" name="SqueezeESP32" minTarget="7.5" maxTarget="*">
<link>https://github.com/sle118/squeezelite-esp32</link> <link>https://github.com/sle118/squeezelite-esp32</link>
<creator>Philippe</creator> <creator>Philippe</creator>
<sha>dcd91eaeb065cf3e90e964ea40a883ed5480093e</sha> <sha>55eb14f12790d71306d143689d9b3d47f9820731</sha>
<email>philippe_44@outlook.com</email> <email>philippe_44@outlook.com</email>
<desc lang="EN">SqueezeESP32 additional player id (100)</desc> <desc lang="EN">SqueezeESP32 additional player id (100)</desc>
<url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url> <url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url>