wwmm / easyeffects

Limiter, compressor, convolver, equalizer and auto volume and many other plugins for PipeWire applications
GNU General Public License v3.0
6.5k stars 269 forks source link

Equalizer's "Load APO Preset" feature is locale dependent #1479

Closed vhborges closed 2 years ago

vhborges commented 2 years ago

EasyEffects Version

6.2.4

What package are you using?

Arch (easyeffects)

Distribution

ArcoLinux (Arch Linux based)

Describe the bug

The "Load APO Preset" feature in the Equalizer plugin is dependent on the system's Numeric Locale.

My OS is configured to use the pt-BR Numeric Locale, if I try to read an eq text file on EasyEffects it ignores all the decimal digits and just reads the integer part. When I change my locale to en-US this feature works as expected.

Steps to reproduce:

  1. Change your system's numeric locale to pt-BR (restart if needed);
  2. Launch EasyEffects, go to plugins > Add Plugin > Equalizer > Load APO Preset;
  3. Save the text below to a file and read it on EasyEffects:
  4. See the result values of Quality, Gain and Input, all of them were rounded down, the decimal parts were ignored;
  5. Repeat the steps above in the en-US numeric locale, all the values are now correct.

Preamp: -5.5 dB Filter 1: ON PK Fc 54 Hz Gain -2.3 dB Q 1.0 Filter 2: ON LS Fc 104 Hz Gain 5.5 dB Q 0.71 Filter 3: ON PK Fc 140 Hz Gain -1.4 dB Q 0.7 Filter 4: ON PK Fc 1350 Hz Gain -3.3 dB Q 1.5 Filter 5: ON PK Fc 1830 Hz Gain 2.4 dB Q 1.3 Filter 6: ON PK Fc 3230 Hz Gain -1.4 dB Q 4.0 Filter 7: ON PK Fc 4420 Hz Gain -3.1 dB Q 4.5 Filter 8: ON PK Fc 5600 Hz Gain -4.1 dB Q 2.5 Filter 9: ON PK Fc 7000 Hz Gain 2.5 dB Q 1.2 Filter 10: ON HS Fc 10000 Hz Gain -1.0 dB Q 0.71

Expected Behavior

The application shouldn't be locale dependent. The Load APO Preset feature should interpret the decimal values in the text file.

Debug Log

Debug Log
``` (process:3803): easyeffects-DEBUG: 18:43:14.322: easyeffects version: 6.2.4 (process:3803): easyeffects-DEBUG: 18:43:14.324: main: locale directory: /usr/share/locale (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system input presets directory: "/etc/easyeffects/input"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system input presets directory: "/etc/xdg/easyeffects/input"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system input presets directory: "/home/vinicius/.config/kdedefaults/easyeffects/input"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system output presets directory: "/etc/easyeffects/output"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system output presets directory: "/etc/xdg/easyeffects/output"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: system output presets directory: "/home/vinicius/.config/kdedefaults/easyeffects/output"; (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: user presets directory already exists: /home/vinicius/.config/easyeffects/ (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: user presets directory already exists: /home/vinicius/.config/easyeffects/input (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: user presets directory already exists: /home/vinicius/.config/easyeffects/output (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: user presets directory already exists: /home/vinicius/.config/easyeffects/autoload/input (easyeffects:3803): easyeffects-DEBUG: 18:43:14.328: presets_manager: user presets directory already exists: /home/vinicius/.config/easyeffects/autoload/output (easyeffects:3803): Adwaita-WARNING **: 18:43:14.611: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead. (easyeffects:3803): easyeffects-DEBUG: 18:43:14.633: pipe_manager: compiled with PipeWire: 0.3.48 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.633: pipe_manager: linked to PipeWire: 0.3.50 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.643: pipe_manager: core version: 0.3.50 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.643: pipe_manager: core name: pipewire-0 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.643: pipe_manager: found metadata: settings (easyeffects:3803): easyeffects-DEBUG: 18:43:14.643: pipe_manager: found metadata: default (easyeffects:3803): easyeffects-DEBUG: 18:43:14.643: pipe_manager: found metadata: route-settings (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: Audio/Sink 43 alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1 with timestamp 1650231794644000820 was added (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: Audio/Sink 35 alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo with timestamp 1650231794644034223 was added (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: Audio/Source 44 alsa_input.pci-0000_00_1b.0.analog-stereo with timestamp 1650231794644049118 was added (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: Audio/Sink 95 easyeffects_sink with timestamp 1650231794644085524 was added (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: Audio/Source/Virtual 99 easyeffects_source with timestamp 1650231794644098749 was added (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: new metadata property: 0, default.configured.audio.source, Spa:String:JSON, { "name": "alsa_input.usb-FiiO_DigiHug_USB_Audio-01.analog-stereo" } (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: new metadata property: 0, default.configured.audio.sink, Spa:String:JSON, { "name": "alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo" } (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: new metadata property: 0, default.audio.sink, Spa:String:JSON, { "name": "alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo" } (easyeffects:3803): easyeffects-DEBUG: 18:43:14.644: pipe_manager: new metadata property: 0, default.audio.source, Spa:String:JSON, { "name": "alsa_input.pci-0000_00_1b.0.analog-stereo" } (easyeffects:3803): easyeffects-DEBUG: 18:43:14.645: pipe_manager: easyeffects_sink node successfully retrieved with id 95 and timestamp 1650231794644085524 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.645: pipe_manager: easyeffects_source node successfully retrieved with id 99 and timestamp 1650231794644098749 (easyeffects:3803): easyeffects-WARNING **: 18:43:14.674: lv2_wrapper: Could not find the plugin: http://drobilla.net/plugins/mda/Loudness (easyeffects:3803): easyeffects-DEBUG: 18:43:14.675: soe: http://drobilla.net/plugins/mda/Loudness is not installed (easyeffects:3803): easyeffects-WARNING **: 18:43:14.675: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: loudness (easyeffects:3803): easyeffects-WARNING **: 18:43:14.675: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: output (easyeffects:3803): easyeffects-WARNING **: 18:43:14.675: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: link (easyeffects:3803): easyeffects-DEBUG: 18:43:14.692: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_compressor_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:14.724: lv2_wrapper: http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:14.772: lv2_wrapper: http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:14.848: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_limiter_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:14.864: lv2_wrapper: http://lsp-plug.in/plugins/lv2/loud_comp_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-WARNING **: 18:43:14.878: lv2_wrapper: Could not find the plugin: urn:zamaudio:ZaMaximX2 (easyeffects:3803): easyeffects-DEBUG: 18:43:14.878: soe: urn:zamaudio:ZaMaximX2 is not installed (easyeffects:3803): easyeffects-WARNING **: 18:43:14.878: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: thresh (easyeffects:3803): easyeffects-WARNING **: 18:43:14.878: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: ceil (easyeffects:3803): easyeffects-WARNING **: 18:43:14.878: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: rel (easyeffects:3803): easyeffects-DEBUG: 18:43:14.905: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_mb_compressor_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:14.940: soe: rnnoise using the default model (easyeffects:3803): easyeffects-DEBUG: 18:43:14.959: soe: output_level successfully connected to PipeWire graph (easyeffects:3803): easyeffects-DEBUG: 18:43:14.960: soe: spectrum successfully connected to PipeWire graph (easyeffects:3803): easyeffects-DEBUG: 18:43:14.962: soe: equalizer successfully connected to PipeWire graph (easyeffects:3803): easyeffects-WARNING **: 18:43:15.013: lv2_wrapper: Could not find the plugin: http://drobilla.net/plugins/mda/Loudness (easyeffects:3803): easyeffects-DEBUG: 18:43:15.013: sie: http://drobilla.net/plugins/mda/Loudness is not installed (easyeffects:3803): easyeffects-WARNING **: 18:43:15.013: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: loudness (easyeffects:3803): easyeffects-WARNING **: 18:43:15.013: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: output (easyeffects:3803): easyeffects-WARNING **: 18:43:15.014: lv2_wrapper: http://drobilla.net/plugins/mda/Loudness port symbol not found: link (easyeffects:3803): easyeffects-DEBUG: 18:43:15.030: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_compressor_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:15.062: lv2_wrapper: http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:15.111: lv2_wrapper: http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:15.181: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_limiter_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:15.197: lv2_wrapper: http://lsp-plug.in/plugins/lv2/loud_comp_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-WARNING **: 18:43:15.211: lv2_wrapper: Could not find the plugin: urn:zamaudio:ZaMaximX2 (easyeffects:3803): easyeffects-DEBUG: 18:43:15.211: sie: urn:zamaudio:ZaMaximX2 is not installed (easyeffects:3803): easyeffects-WARNING **: 18:43:15.211: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: thresh (easyeffects:3803): easyeffects-WARNING **: 18:43:15.211: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: ceil (easyeffects:3803): easyeffects-WARNING **: 18:43:15.211: lv2_wrapper: urn:zamaudio:ZaMaximX2 port symbol not found: rel (easyeffects:3803): easyeffects-DEBUG: 18:43:15.237: lv2_wrapper: http://lsp-plug.in/plugins/lv2/sc_mb_compressor_stereo requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:3803): easyeffects-DEBUG: 18:43:15.272: sie: rnnoise using the default model (easyeffects:3803): easyeffects-DEBUG: 18:43:15.289: sie: output_level successfully connected to PipeWire graph (easyeffects:3803): easyeffects-DEBUG: 18:43:15.291: sie: spectrum successfully connected to PipeWire graph easyeffects-INFO: 18:43:15.297: application: disabling global bypass (easyeffects:3803): easyeffects-DEBUG: 18:43:15.324: application_ui: Icon Theme Papirus-Dark detected (easyeffects:3803): easyeffects-DEBUG: 18:43:15.785: new default output device: alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo (easyeffects:3803): easyeffects-DEBUG: 18:43:15.789: new default input device: alsa_input.pci-0000_00_1b.0.analog-stereo (easyeffects:3803): easyeffects-DEBUG: 18:43:15.791: application: device alsa_card.pci-0000_01_00.1 has changed its output route to: hdmi-output-1 (easyeffects:3803): easyeffects-DEBUG: 18:43:15.791: application: output autoloading: the target node name does not match the output device name (easyeffects:3803): easyeffects-DEBUG: 18:43:15.791: application: device alsa_card.usb-FiiO_DigiHug_USB_Audio-01 has changed its output route to: iec958-stereo-output (easyeffects:3803): easyeffects-DEBUG: 18:43:15.791: application: device alsa_card.pci-0000_00_1b.0 has changed its input route to: analog-input-rear-mic (easyeffects:3803): easyeffects-DEBUG: 18:43:26.134: soe: No app linked to our device wants to play. Unlinking our filters. (easyeffects:3803): easyeffects-DEBUG: 18:43:26.139: sie: No app linked to our device wants to play. Unlinking our filters ```

Additional Information

No response

vhborges commented 2 years ago

So I was inspecting the source code and doing some tests, but I'm unsure if the best solution would be to change the app's locale programmatically at runtime or to create a "locale independent" conversion function that looks at the decimal point character and, when it's a comma, replace the dots of with commas. I've already implemented the latter and it's working as expected, but I would like some advice here before creating a PR.

Digitalone1 commented 2 years ago

We already had this issue in the past with PulseEffects. A workaround was made to use string streams and set the C locale temporarily inside a custom method.

Then we switched to EasyEffects which was setting the C locale through Pipewire and we used std::stod which is locale dependent. Clearly the behaviour changed when Pipewire stopped to set C locale and now APO parsing is broke another time.

Let's hope we can use std::from_chars so this issue can be solved once and for all with a better and more efficient standard C++ locale independent feature.

Last time we tried, we had to roll back to string streams because of some compiler issues with old distributions.

Digitalone1 commented 2 years ago

I made it with std::from_chars. Will make the MR in the next hours.

wwmm commented 2 years ago

Based on what I can see here https://en.cppreference.com/w/cpp/utility/from_chars from_chars is supposed to be c++17. I wonder why we had compiler problems before if we are already requiring c++20 support.

wwmm commented 2 years ago

It seems there is a particular way of using it that requires something from c++20 Screenshot from 2022-04-18 11-34-33 Maybe it was just a matter of using it in a different way and we did not realize it.

Digitalone1 commented 2 years ago

@vhborges please test when the master will be updated.

wwmm commented 2 years ago

I have merged the last pull requests to the master branch. Now let's see what happens to people on older compilers.

Digitalone1 commented 2 years ago

charconv features were already implemented last August and we had to rollback because of Flatpak (#1098).

It seems at least gcc 11 is needed. @vchernin Is this still an issue?

vchernin commented 2 years ago

It seems at least gcc 11 is needed. @vchernin Is this still an issue?

Current SDK we use (GNOME 42) has GCC 11.2.0, so it shouldn't be a problem.

vhborges commented 2 years ago

@vhborges please test when the master will be updated.

I've updated my master and the issue is still there for me... I tried to debug with gdb to see if the problem was with std:from_chars but now when I start the app with gdb I'm getting this error (which was not happening before):

(easyeffects:8234): GLib-GIO-ERROR **: 22:37:19.383: Settings schema 'com.github.wwmm.easyeffects.pitch' does not contain a key named 'mode'

Full log: easyeffects-debug-gdb.txt

This error does not occur if I execute the application normally, though...

Digitalone1 commented 2 years ago

Gsettings schema not updated with the new Pitch parameters.

There's a way to solve this issue which I don't remember at the moment, but you can just install easyeffects-git from AUR that will update the schemas properly.

Digitalone1 commented 2 years ago

If there's an APO preset not working besides the one you already posted, please post the new one.

vhborges commented 2 years ago

I just saw that after I build the project the schemas folder (and all the folders inside "data") are being wiped out, was this supposed to happen?

Anyway, I regenerated the folders and now it's all working, including the APO preset loading! \o/

Apparently my previous build didn't get the changes, besides not showing any error.

vhborges commented 2 years ago

Apparently my previous build didn't get the changes, besides not showing any error.

Actually that doesn't make sense, because my binary contained changes I made that fixed the issue for me lol

vhborges commented 2 years ago

I figured it out, I was running my distro's package while thinking it was the repo's local binary 🤦‍♂️

It's all clear and working now, guys. I'll do some more tests later, but thanks for now!

wwmm commented 2 years ago

I was running my distro's package while thinking it was the repo's local binary

This has happened to me a few times :smile:

vhborges commented 2 years ago

I'm closing this issue as the fix appears to be working fine :+1: