Fixes:
- settings the default sink (audio output) with `pactl` doesn't work like `pacmd`. The index of the sink is ignored and it's sink's `object.id` that's accepted by `pactl set-default-sink <id>`. As such, previous version didn't correctly set the audio output for Pipewire/Pulseaudio so a separate hash map was added to translate from `index` to the `object.id` of the sink.
- running `alsamixer` doesn't work correctly as `root` when Pipewire/Wireplumber are started as user services. Thus, run it as the install user in the Pulseaudio context
Tweaks:
- use `card.name` for the name of the card when listed in the dialog. This makes the name of the HDMI outputs nicer, instead of using the `alsa.name` property which outputs `MAI PCM i2s-hifi-0` as the card name (not very user friendly). With the new naming tweaks, the HDMI outputs are shown as `HDMI-0` or `HDMI-1`.
Fixed Pi5 detection by checking for `vc4hdmi` cards when determining if audio is enabled.
Since the Pi5 doesn't have the analog audio output (Headphones), the detection thinks there's no audio enabled (since `snd_bcm2835` module is not loaded), but it's wrong.
Also fixed a couple of things:
- the `pactl` listing parsing would enter an infinite loop if no audio was present
- when checking for Pulse/Pipewire use the `.service` instead of the `.socket`, since the socket can be disabled, but the service is always active.
Since PipeWire is the default sound server in RaspiOS 12 _bookworm_, make sure we account for its presence and we're able to choose a default card ('output sink') or disable/enable it.
At this time, PipeWire is using emulating a PulseAudio session manager through `pipewire-pulse`, while also running the native `wireplumber` session manager.
Most of the clients still think they speak to PulseAudio using the PulseAudio client API, while the actual backend is PipeWire.
Changed:
- use `pactl` instead of `pacmd`, since the latter is not working through PipeWire's PulseAudio emulation
- use `pactl` to set the PipeWire defaul output, instead of using the native `pw-cli`
- added a toggle functions for PipeWire and PulseAudio, chosen based on the detected sound server
NOTE: although techically possible, I haven't added an option to enable PulseAudio if PipeWire is also present, but I don't think it's needed.
On RaspiOS (10/11), the ALSA configurations folder doesn't exist, so make sure we're creating it before saving/moving the ALSA configuration file we generate with the scriptmodule.
Move resetting alsa to function to avoid duplication.
Add dialog when migrating ~/.asoundrc to the new location.
If ~/.asoundrc exists and there is no config in /etc/alsa/conf.d/99-retropie.conf then offer to move the file.
Asking the user is safer as we don't want to migrate a users own custom ALSA configuration.
Needed for configurations using the 'vc4-kms-v3d' overlay (default in RPI OS 11).
The names are (almost) similar, but the default order of the cards is different:
* (fkms/videocore) the order is HDMI, Headphones
* (kms) the order is Headphones, HDMI
The `vc4hdmi` driver also has an extra PCM (hdmi) that does the audio conversion, since the default one understands only the `IEC958_SUBFRAME_LE` format.
The new PCM is configured in `/usr/share/alsa/cards/vc4-hdmi.conf`, and it needs a recent `libasound2-data` package (on Buster, Bullseye already has the configuration included).
The default ALSA configuration may have a bug (?) in the definition of the volume control (mixer) for the `vc4hdmi` cards, so add a software volume control with a mute toggle for these cards. For compatibility with previous configurations, the control is named 'HDMI'.
`mawk` (default AWK on Debian) doesn't know about `gensub`, so use a Posix ERE instead.
Fix also the options index when choosing the PulseAudio sink so the correct audio output is chosen.
When PulseAudio is installed and active, it takes over as the default ALSA device.
Remove any `.asoundrc` when it's enabled and configure the PulseAudio default output sink instead.
Added the option to enable/disable PulseAudio, depending on the running configuration.
* fix some left over use of __depends_mode (now md_mode) - fixes pippleware kodi 16 repo install
* make sure we force an apt-get update in case one was done before the repo was added
* rp_module_menus is no more - instead use rp_module_section with one of
- core (core packages)
- main (main packages - which will be installed by default in the image)
- opt (optional packages)
- exp (experimental packages)
- driver (driver packages)
- config (configuration packages / tools)
* The setup menu organises the data based on the above sections. more could be added in the future if needed. Packages (internally modules), can be added / configured / removed individually, or as entire sections.
* The setup menu will automatically detect if a binary is available to be installed. the nobin flag is no longer needed. modules that install directly from binary via aptInstall or via a prebuilt binary need to use an install_bin_ function instead of install_
* rp_module_section of type "config" will have the "gui_" function called first if it's available, otherwise a standard depends/sources/build/install/configure will be called
* configure is no longer used for "gui" configuration function - use gui_ instead. Had already started to move to this before, but now it is required.