Compare commits

..

3 Commits

Author SHA1 Message Date
Philippe G
3df6568b6a dual vertical VU - release 2020-08-19 00:25:51 -07:00
Philippe G
ca97b8045e GPIO 7 might be used by error - release 2020-08-18 18:11:33 -07:00
Philippe G
5e8a3fd755 better synchronize bass/treble & equalizer
remove large fonts - release

finalize equalizer/tone interaction
2020-08-17 21:01:57 -07:00
6 changed files with 44 additions and 51 deletions

View File

@@ -585,7 +585,7 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
int scale = 8 - GDS_GetDepth(display);
// use "fast" version as we are not beyond screen boundaries
if (visu.rotate) {
if (rotate) {
for (int r = 0; r < width; r++) {
for (int c = VU_HEIGHT; --c >= 0;) {
GDS_DrawPixelFast(display, c + x, r + y, *data++ >> scale);
@@ -594,13 +594,13 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
} else {
for (int r = 0; r < width; r++) {
for (int c = 0; c < VU_HEIGHT; c++) {
GDS_DrawPixelFast(display, r + x, c + y, *data++ >> scale);
GDS_DrawPixelFast(display, r + x, c + y, *data++ >> scale);
}
}
}
} else {
// use "fast" version as we are not beyond screen boundaries
if (visu.rotate) {
if (rotate) {
for (int r = 0; r < width; r++) {
for (int c = VU_HEIGHT; --c >= 0;) {
GDS_DrawPixelFast(display, c + x, r + y, grayMap[*data++]);
@@ -609,11 +609,10 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
} else {
for (int r = 0; r < width; r++) {
for (int c = 0; c < VU_HEIGHT; c++) {
GDS_DrawPixelFast(display, r + x, c + y, grayMap[*data++]);
GDS_DrawPixelFast(display, r + x, c + y, grayMap[*data++]);
}
}
}
}
// need to manually set dirty flag as DrawPixel does not do it
@@ -966,9 +965,13 @@ static void visu_update(void) {
}
}
} else if (displayer.width / 2 > 3 * VU_WIDTH / 4) {
int width = visu.rotate ? visu.height : visu.width;
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, width / 2, visu.rotate);
draw_VU(display, vu_bitmap, visu.bars[1].current, width / 2, visu.row, width / 2, visu.rotate);
if (visu.rotate) {
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, visu.height / 2, visu.rotate);
draw_VU(display, vu_bitmap, visu.bars[1].current, 0, visu.row + visu.height / 2, visu.height / 2, visu.rotate);
} else {
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, visu.width / 2, visu.rotate);
draw_VU(display, vu_bitmap, visu.bars[1].current, visu.width / 2, visu.row, visu.width / 2, visu.rotate);
}
} else {
int level = (visu.bars[0].current + visu.bars[1].current) / 2;
draw_VU(display, vu_bitmap, level, 0, visu.row, visu.rotate ? visu.height : visu.width, visu.rotate);

View File

@@ -228,7 +228,7 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
char *dac_config = config_alloc_get_str("dac_config", CONFIG_DAC_CONFIG, "model=i2s,bck=" STR(CONFIG_I2S_BCK_IO)
",ws=" STR(CONFIG_I2S_WS_IO) ",do=" STR(CONFIG_I2S_DO_IO)
",sda=" STR(CONFIG_I2C_SDA) ",scl=" STR(CONFIG_I2C_SCL)
",mute" STR(CONFIG_MUTE_GPIO));
",mute=" STR(CONFIG_MUTE_GPIO));
i2s_pin_config_t i2s_dac_pin, i2s_spdif_pin;
set_i2s_pin(spdif_config, &i2s_spdif_pin);
@@ -284,7 +284,7 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
char model[32] = "i2s";
if ((p = strcasestr(dac_config, "model")) != NULL) sscanf(p, "%*[^=]=%31[^,]", model);
if ((p = strcasestr(dac_config, "mute")) != NULL) {
char mute[8];
char mute[8] = "";
sscanf(p, "%*[^=]=%7[^,]", mute);
mute_control.gpio = atoi(mute);
if ((p = strchr(mute, ':')) != NULL) mute_control.active = atoi(p + 1);
@@ -292,7 +292,7 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
for (int i = 0; adac == &dac_external && dac_set[i]; i++) if (strcasestr(dac_set[i]->model, model)) adac = dac_set[i];
res = adac->init(dac_config, I2C_PORT, &i2s_config) ? ESP_OK : ESP_FAIL;
res |= i2s_driver_install(CONFIG_I2S_NUM, &i2s_config, 0, NULL);
res |= i2s_set_pin(CONFIG_I2S_NUM, &i2s_dac_pin);

Binary file not shown.

View File

@@ -21,7 +21,7 @@ sub new {
my $class = shift;
my $client = $class->SUPER::new(@_);
$client->init_accessor(
tone_update => 0,
tone_update => 0,
);
return $client;
}
@@ -57,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 }
@@ -68,9 +67,6 @@ sub init {
if (!$handlersAdded) {
$sprefs->setChange( \&change_tone, 'bass');
$sprefs->setChange( \&change_tone, 'treble');
# Add a handler for line-in/out status changes
Slim::Networking::Slimproto::addHandler( LIOS => \&lineInOutStatus );
@@ -132,47 +128,41 @@ sub playerSettingsFrame {
$client->SUPER::playerSettingsFrame($data_ref);
}
sub change_tone {
my ($type, $new, $client, $old) = @_;
return $client->$type($new) unless $client->isa('Plugins::SqueezeESP32::Player') && !$client->tone_update;
sub bass {
my ($client, $new) = @_;
my $value = $client->SUPER::bass($new);
$client->update_equalizer($value, [2, 1, 3]) if defined $new;
return $value;
}
my ($c, $minValue, $maxValue);
sub treble {
my ($client, $new) = @_;
my $value = $client->SUPER::treble($new);
$client->update_equalizer($value, [8, 9, 7]) if defined $new;
return $value;
}
sub update_equalizer {
my ($client, $value, $index) = @_;
return if $client->tone_update;
my $equalizer = $prefs->client($client)->get('equalizer');
if ($type eq 'bass') {
$c = 2;
$minValue = minBass;
$maxValue = maxBass;
} else {
$c = 8;
$minValue = minTreble;
$maxValue = maxTreble;
}
$new = $minValue if $new < $minValue;
$new = $minValue if $new < $minValue;
if ($old - $minValue) {
my $ratio = ($new - $minValue) / ($old - $minValue) - 1;
$equalizer->[$c-1] = min(int(($equalizer->[$c-1] - $minValue) * (1 + 0.2 * $ratio) + 0.5 + $minValue), $maxValue);
$equalizer->[$c] = min(int(($equalizer->[$c] - $minValue) * (1 + 0.7 * $ratio) + 0.5 + $minValue), $maxValue);
$equalizer->[$c+1] = min(int(($equalizer->[$c+1] - $minValue) * (1 + 0.1 * $ratio) + 0.5 + $minValue), $maxValue);
} else {
$equalizer->[$c-1] = int($new * 0.2 + 0.5);
$equalizer->[$c] = int($new * 0.7 + 0.5);
$equalizer->[$c+1] = int($new * 0.1 + 0.5);
}
$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);
$sprefs->client($client)->set($type, $new);
}
sub update_tones {
my ($client, $equalizer) = @_;
$client->tone_update(1);
$sprefs->client($client)->set('bass', int($equalizer->[1]*0.2 + $equalizer->[2]*0.7 + $equalizer->[3]*0.1 + 0.5));
$sprefs->client($client)->set('treble', int($equalizer->[7]*0.2 + $equalizer->[8]*0.7 + $equalizer->[9]*0.1 + 0.5));
$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);
}

View File

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

View File

@@ -1,10 +1,10 @@
<?xml version='1.0' standalone='yes'?>
<extensions>
<plugins>
<plugin version="0.102" 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>f9c8fbc60812bed4e3989e6dfa3e99fb1a2869c3</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>