mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-14 15:37:10 +03:00
Compare commits
3 Commits
v0.5.654-v
...
v0.5.657-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3df6568b6a | ||
|
|
ca97b8045e | ||
|
|
5e8a3fd755 |
@@ -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);
|
int scale = 8 - GDS_GetDepth(display);
|
||||||
|
|
||||||
// use "fast" version as we are not beyond screen boundaries
|
// use "fast" version as we are not beyond screen boundaries
|
||||||
if (visu.rotate) {
|
if (rotate) {
|
||||||
for (int r = 0; r < width; r++) {
|
for (int r = 0; r < width; r++) {
|
||||||
for (int c = VU_HEIGHT; --c >= 0;) {
|
for (int c = VU_HEIGHT; --c >= 0;) {
|
||||||
GDS_DrawPixelFast(display, c + x, r + y, *data++ >> scale);
|
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 {
|
} else {
|
||||||
for (int r = 0; r < width; r++) {
|
for (int r = 0; r < width; r++) {
|
||||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
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 {
|
} else {
|
||||||
// use "fast" version as we are not beyond screen boundaries
|
// use "fast" version as we are not beyond screen boundaries
|
||||||
if (visu.rotate) {
|
if (rotate) {
|
||||||
for (int r = 0; r < width; r++) {
|
for (int r = 0; r < width; r++) {
|
||||||
for (int c = VU_HEIGHT; --c >= 0;) {
|
for (int c = VU_HEIGHT; --c >= 0;) {
|
||||||
GDS_DrawPixelFast(display, c + x, r + y, grayMap[*data++]);
|
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 {
|
} else {
|
||||||
for (int r = 0; r < width; r++) {
|
for (int r = 0; r < width; r++) {
|
||||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
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
|
// 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) {
|
} else if (displayer.width / 2 > 3 * VU_WIDTH / 4) {
|
||||||
int width = visu.rotate ? visu.height : visu.width;
|
if (visu.rotate) {
|
||||||
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, width / 2, 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, width / 2, visu.row, width / 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 {
|
} else {
|
||||||
int level = (visu.bars[0].current + visu.bars[1].current) / 2;
|
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);
|
draw_VU(display, vu_bitmap, level, 0, visu.row, visu.rotate ? visu.height : visu.width, visu.rotate);
|
||||||
|
|||||||
@@ -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)
|
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)
|
",ws=" STR(CONFIG_I2S_WS_IO) ",do=" STR(CONFIG_I2S_DO_IO)
|
||||||
",sda=" STR(CONFIG_I2C_SDA) ",scl=" STR(CONFIG_I2C_SCL)
|
",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;
|
i2s_pin_config_t i2s_dac_pin, i2s_spdif_pin;
|
||||||
set_i2s_pin(spdif_config, &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";
|
char model[32] = "i2s";
|
||||||
if ((p = strcasestr(dac_config, "model")) != NULL) sscanf(p, "%*[^=]=%31[^,]", model);
|
if ((p = strcasestr(dac_config, "model")) != NULL) sscanf(p, "%*[^=]=%31[^,]", model);
|
||||||
if ((p = strcasestr(dac_config, "mute")) != NULL) {
|
if ((p = strcasestr(dac_config, "mute")) != NULL) {
|
||||||
char mute[8];
|
char mute[8] = "";
|
||||||
sscanf(p, "%*[^=]=%7[^,]", mute);
|
sscanf(p, "%*[^=]=%7[^,]", mute);
|
||||||
mute_control.gpio = atoi(mute);
|
mute_control.gpio = atoi(mute);
|
||||||
if ((p = strchr(mute, ':')) != NULL) mute_control.active = atoi(p + 1);
|
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];
|
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 = 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_driver_install(CONFIG_I2S_NUM, &i2s_config, 0, NULL);
|
||||||
res |= i2s_set_pin(CONFIG_I2S_NUM, &i2s_dac_pin);
|
res |= i2s_set_pin(CONFIG_I2S_NUM, &i2s_dac_pin);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -21,7 +21,7 @@ sub new {
|
|||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $client = $class->SUPER::new(@_);
|
my $client = $class->SUPER::new(@_);
|
||||||
$client->init_accessor(
|
$client->init_accessor(
|
||||||
tone_update => 0,
|
tone_update => 0,
|
||||||
);
|
);
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,6 @@ sub hasIR { 1 }
|
|||||||
# TODO: add in settings when ready
|
# TODO: add in settings when ready
|
||||||
sub hasLineIn { 0 }
|
sub hasLineIn { 0 }
|
||||||
sub hasHeadSubOut { 1 }
|
sub hasHeadSubOut { 1 }
|
||||||
# TODO: LMS sliders are hard-coded in html file from -23 to +23
|
|
||||||
sub maxTreble { 20 }
|
sub maxTreble { 20 }
|
||||||
sub minTreble { -13 }
|
sub minTreble { -13 }
|
||||||
sub maxBass { 20 }
|
sub maxBass { 20 }
|
||||||
@@ -68,9 +67,6 @@ sub init {
|
|||||||
|
|
||||||
if (!$handlersAdded) {
|
if (!$handlersAdded) {
|
||||||
|
|
||||||
$sprefs->setChange( \&change_tone, 'bass');
|
|
||||||
$sprefs->setChange( \&change_tone, 'treble');
|
|
||||||
|
|
||||||
# Add a handler for line-in/out status changes
|
# Add a handler for line-in/out status changes
|
||||||
Slim::Networking::Slimproto::addHandler( LIOS => \&lineInOutStatus );
|
Slim::Networking::Slimproto::addHandler( LIOS => \&lineInOutStatus );
|
||||||
|
|
||||||
@@ -132,47 +128,41 @@ sub playerSettingsFrame {
|
|||||||
$client->SUPER::playerSettingsFrame($data_ref);
|
$client->SUPER::playerSettingsFrame($data_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub change_tone {
|
sub bass {
|
||||||
my ($type, $new, $client, $old) = @_;
|
my ($client, $new) = @_;
|
||||||
return $client->$type($new) unless $client->isa('Plugins::SqueezeESP32::Player') && !$client->tone_update;
|
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');
|
my $equalizer = $prefs->client($client)->get('equalizer');
|
||||||
|
$equalizer->[$index->[0]] = $value;
|
||||||
if ($type eq 'bass') {
|
$equalizer->[$index->[1]] = int($value / 2 + 0.5);
|
||||||
$c = 2;
|
$equalizer->[$index->[2]] = int($value / 4 + 0.5);
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$prefs->client($client)->set('equalizer', $equalizer);
|
$prefs->client($client)->set('equalizer', $equalizer);
|
||||||
$sprefs->client($client)->set($type, $new);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub update_tones {
|
sub update_tones {
|
||||||
my ($client, $equalizer) = @_;
|
my ($client, $equalizer) = @_;
|
||||||
|
|
||||||
$client->tone_update(1);
|
$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('bass', int(($equalizer->[1] * 2 + $equalizer->[2] + $equalizer->[3] * 4) / 7 + 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('treble', int(($equalizer->[7] * 4 + $equalizer->[8] + $equalizer->[9] * 2) / 7 + 0.5));
|
||||||
$client->tone_update(0);
|
$client->tone_update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.102</version>
|
<version>0.103</version>
|
||||||
<creator>Philippe</creator>
|
<creator>Philippe</creator>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version='1.0' standalone='yes'?>
|
<?xml version='1.0' standalone='yes'?>
|
||||||
<extensions>
|
<extensions>
|
||||||
<plugins>
|
<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>
|
<link>https://github.com/sle118/squeezelite-esp32</link>
|
||||||
<creator>Philippe</creator>
|
<creator>Philippe</creator>
|
||||||
<sha>f9c8fbc60812bed4e3989e6dfa3e99fb1a2869c3</sha>
|
<sha>d07bb3b0a283fbde50e5533dca695a4505971f03</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user