2
0
Эх сурвалжийг харах

better synchronize bass/treble & equalizer

remove large fonts - release

finalize equalizer/tone interaction
Philippe G 4 жил өмнө
parent
commit
5e8a3fd755

+ 8 - 0
components/display/core/gds_text.c

@@ -35,12 +35,20 @@ static const struct GDS_FontDef *GuessFont( struct GDS_Device *Device, int FontT
 	case GDS_FONT_MEDIUM:			
 	default:		
 		return &Font_droid_sans_fallback_15x17;	
+#ifdef USE_LARGE_FONTS
 	case GDS_FONT_LARGE:	
 		return &Font_droid_sans_fallback_24x28;
 		break;		
 	case GDS_FONT_SEGMENT:			
 		if (Device->Height == 32) return &Font_Tarable7Seg_16x32;
 		else return &Font_Tarable7Seg_32x64;
+#else
+	case GDS_FONT_LARGE:	
+	case GDS_FONT_SEGMENT:			
+		ESP_LOGW(TAG, "large fonts disabled");
+		return &Font_droid_sans_fallback_15x17;
+		break;		
+#endif	
 	}
 }
 

BIN
plugin/SqueezeESP32.zip


+ 43 - 15
plugin/SqueezeESP32/Player.pm

@@ -13,6 +13,19 @@ my $sprefs = preferences('server');
 my $prefs = preferences('plugin.squeezeesp32');
 my $log   = logger('plugin.squeezeesp32');
 
+{
+	__PACKAGE__->mk_accessor('rw', 'tone_update');
+}
+
+sub new {
+	my $class = shift;
+	my $client = $class->SUPER::new(@_);
+	$client->init_accessor(
+		tone_update	=> 0,
+	);
+	return $client;
+}
+
 our $defaultPrefs = {
 	'analogOutMode'        => 0,
 	'bass'                 => 0,
@@ -44,7 +57,6 @@ sub hasIR { 1 }
 # TODO: add in settings when ready
 sub hasLineIn { 0 }
 sub hasHeadSubOut { 1 }
-# TODO: LMS sliders are hard-coded in html file from -23 to +23 
 sub maxTreble {	20 }
 sub minTreble {	-13 }
 sub maxBass { 20 }
@@ -54,7 +66,7 @@ sub init {
 	my $client = shift;
 	
 	if (!$handlersAdded) {
-
+	
 		# Add a handler for line-in/out status changes
 		Slim::Networking::Slimproto::addHandler( LIOS => \&lineInOutStatus );
 	
@@ -117,25 +129,41 @@ sub playerSettingsFrame {
 }
 
 sub bass {
-	return tone(2, @_);
-}	
+	my ($client, $new) = @_;
+	my $value = $client->SUPER::bass($new);
+	
+	$client->update_equalizer($value, [2, 1, 3]) if defined $new;
+	
+	return $value;
+}
 
 sub treble {
-	return tone(8, @_);
+	my ($client, $new) = @_;
+	my $value = $client->SUPER::treble($new);
+	
+	$client->update_equalizer($value, [8, 9, 7]) if defined $new;
+
+	return $value;
 }
 
-sub tone {
-	my ($center, $client, $value) = @_;
-	my $equalizer = $prefs->client($client)->get('equalizer');
+sub update_equalizer {
+	my ($client, $value, $index) = @_;
+	return if $client->tone_update;
 	
-	if (defined($value)) {
-		$equalizer->[$center-1] = int($value * 0.2 + 0.5);
-		$equalizer->[$center] = int($value * 0.7 + 0.5);
-		$equalizer->[$center+1] = int($value * 0.1 + 0.5);
-		$prefs->client($client)->set('equalizer', $equalizer);
-	}
+	my $equalizer = $prefs->client($client)->get('equalizer');	
+	$equalizer->[$index->[0]] = $value;
+	$equalizer->[$index->[1]] = int($value / 2 + 0.5);
+	$equalizer->[$index->[2]] = int($value / 4 + 0.5);
+	$prefs->client($client)->set('equalizer', $equalizer);
+}
+
+sub update_tones {
+	my ($client, $equalizer) = @_;
 
-	return int($equalizer->[$center-1] * 0.2 + $equalizer->[$center] * 0.7 + $equalizer->[$center+1] * 0.1);
+	$client->tone_update(1);
+	$sprefs->client($client)->set('bass', int(($equalizer->[1] * 2 + $equalizer->[2] + $equalizer->[3] * 4) / 7 + 0.5));
+	$sprefs->client($client)->set('treble', int(($equalizer->[7] * 4 + $equalizer->[8] + $equalizer->[9] * 2) / 7 + 0.5));
+	$client->tone_update(0);	
 }
 
 sub update_artwork {

+ 1 - 0
plugin/SqueezeESP32/PlayerSettings.pm

@@ -73,6 +73,7 @@ sub handler {
 			$equalizer->[$i] = $paramRef->{"pref_equalizer.$i"} || 0;
 		}
 		$cprefs->set('equalizer', $equalizer);
+		$client->update_tones($equalizer);
 	}
 
 	if ($client->displayWidth) {

+ 1 - 1
plugin/SqueezeESP32/install.xml

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

+ 2 - 2
plugin/repo.xml

@@ -1,10 +1,10 @@
 <?xml version='1.0' standalone='yes'?>
 <extensions>
   <plugins>
-    <plugin version="0.101" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
+    <plugin version="0.103" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
       <link>https://github.com/sle118/squeezelite-esp32</link>
       <creator>Philippe</creator>
-      <sha>49cb70db3a3d4359360332f1f49a845e2e4970b8</sha>
+      <sha>d07bb3b0a283fbde50e5533dca695a4505971f03</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>