[% END %]
+
[% WRAPPER settingSection %]
[% WRAPPER settingGroup title='31Hz' desc="" %]
diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm
index 48ff8c01..e7e3a779 100644
--- a/plugin/SqueezeESP32/Plugin.pm
+++ b/plugin/SqueezeESP32/Plugin.pm
@@ -43,6 +43,9 @@ sub initPlugin {
Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeezeesp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' });
main::INFOLOG && $log->is_info && $log->info("Added class 100 for SqueezeESP32");
+ # register a command to set the EQ - without saving the values! Send params as single comma separated list of values
+ Slim::Control::Request::addDispatch(['squeezeesp32', 'seteq', '_eq'], [1, 0, 0, \&setEQ]);
+
# Note for some forgetful know-it-all: we need to wrap the callback to make it unique. Otherwise subscriptions would overwrite each other.
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] );
Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]);
@@ -84,11 +87,31 @@ sub onNotification {
}
}
+sub setEQ {
+ my $request = shift;
+
+ # check this is the correct command.
+ if ($request->isNotCommand([['squeezeesp32'],['seteq']])) {
+ $request->setStatusBadDispatch();
+ return;
+ }
+
+ # get our parameters
+ my $client = $request->client();
+ my @eqParams = split(/,/, $request->getParam('_eq') || '');
+
+ for (my $x = 0; $x < 10; $x++) {
+ $eqParams[$x] ||= 0;
+ }
+
+ send_equalizer($client, \@eqParams);
+}
+
sub send_equalizer {
- my ($client) = @_;
+ my ($client, $equalizer) = @_;
if ($client->model eq 'squeezeesp32') {
- my $equalizer = $prefs->client($client)->get('equalizer') || [(0) x 10];
+ $equalizer ||= $prefs->client($client)->get('equalizer') || [(0) x 10];
my $size = @$equalizer;
my $data = pack("c[$size]", @{$equalizer});
$client->sendFrame( eqlz => \$data );
diff --git a/plugin/SqueezeESP32/strings.txt b/plugin/SqueezeESP32/strings.txt
index 268752e9..0ab48a8c 100644
--- a/plugin/SqueezeESP32/strings.txt
+++ b/plugin/SqueezeESP32/strings.txt
@@ -97,3 +97,6 @@ PLUGIN_SQUEEZEESP32_EQUALIZER
DE Parametrischer Equalizer
EN Parametric equalizer
+PLUGIN_SQUEEZEESP32_EQUALIZER_SAVE
+ DE Bitte speichern Sie die Equalizer Einstellungen, falls das Gerät diese dauerhaft verwenden soll. Ansonsten werden sie beim nächsten Start zurückgesetzt.
+ EN Don't forget to save the Equalizer settings if you want them to stick. Otherwise they'll be reset next time you restart the device.
\ No newline at end of file