diff --git a/Dockerfile b/Dockerfile index 4aa12dc..9efb4f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -112,6 +112,8 @@ ENV ALSA_OUTPUT_OUTPUT_FORMAT "" ENV ALSA_OUTPUT_AUTO_RESAMPLE "" ENV ALSA_OUTPUT_THESYCON_DSD_WORKAROUND "" ENV ALSA_OUTPUT_INTEGER_UPSAMPLING "" +ENV ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED "" +ENV ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED_PRESET "" ENV ALSA_OUTPUT_DOP "" ENV PULSE_AUDIO_OUTPUT_CREATE "" @@ -222,6 +224,7 @@ COPY app/bin/get-value.sh /app/bin/ COPY app/bin/read-file.sh /app/bin/ COPY app/bin/build-soxr-presets.sh /app/bin/ COPY app/bin/build-allowed-formats-presets.sh /app/bin/ +COPY app/bin/build-integer-upsampling-allowed-presets.sh /app/bin/ COPY app/bin/load-alsa-presets.sh /app/bin/ COPY app/bin/build-additional.sh /app/bin/ COPY app/bin/user-management.sh /app/bin/ diff --git a/README.md b/README.md index fc43578..2cf7866 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ Images: [DockerHub](https://hub.docker.com/r/giof71/mpd-alsa) ## MPD Source code The source code is in this GitHub [repo](https://github.com/GioF71/MPD). -The `v0.23.x` branch is kept in-line with the GitHub [upstream repo](https://github.com/MusicPlayerDaemon/MPD). -The `v0.23.x-ups` branch contains a patch which is used when `INTEGER_UPSAMPLING` is set to `yes`. Use at your own risk. +The `version-0.23.12` tag is in-line with the GitHub [upstream repo](https://github.com/MusicPlayerDaemon/MPD) at version 0.23.12. +The `version-0.23.12-ups` tag contains a patch which is used when `INTEGER_UPSAMPLING` is set to `yes`. Use at your own risk. Two binaries are available in the container image: - /app/bin/compiled/mpd (stable version) - /app/bin/compiled/mpd-ups (patched version) -The current mpd version is `v0.23.11`. +The current mpd version is `v0.23.12`. ## Why @@ -249,6 +249,8 @@ ALSA_OUTPUT_OUTPUT_FORMAT|yes|Sets output format ALSA_OUTPUT_AUTO_RESAMPLE|yes|Sets auto resample ALSA_OUTPUT_THESYCON_DSD_WORKAROUND|yes|Enables workaround ALSA_OUTPUT_INTEGER_UPSAMPLING|yes|Enables integer upsampling +ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED|yes|Allows selection of sample rates to be upsampled. If set, only specified values are allowed. The values should respect the same format user for `ALSA_OUTPUT_ALLOWED_FORMATS` +ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED_PRESET|yes|Preset for `ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED`. Allowed values are `base` (for 44.1kHz and 48.0kHz) and `44` for 44.1kHz only ALSA_OUTPUT_DOP|yes|Enables Dsd-Over-Pcm. Possible values: `yes` or `no`. Empty by default: this it lets mpd handle dop setting. For the meaning, refer to the corresponding values in the first list of environment variables. diff --git a/app/bin/build-additional.sh b/app/bin/build-additional.sh index e629519..04000cc 100755 --- a/app/bin/build-additional.sh +++ b/app/bin/build-additional.sh @@ -202,6 +202,19 @@ build_alsa() { alsa_out_set_values[$alsa_set_key]="${c_allowed_formats}" fi fi + + # integer upsampling allowed presets + c_integer_upsampling_allowed_preset=$(get_named_env ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED_PRESET $idx) + if [ -n "${c_integer_upsampling_allowed_preset}" ]; then + echo "Integer Upsampling Allowed set for alsa output [$idx] -> [${c_integer_upsampling_allowed_preset}]" + c_integer_upsampling_allowed="${integer_upsampling_allowed_presets[${c_integer_upsampling_allowed_preset}]}" + echo " translates to [${c_integer_upsampling_allowed}]" + if [[ -n "${c_integer_upsampling_allowed}" ]]; then + alsa_set_key="integer_upsampling_allowed.${idx}" + alsa_out_set_values[$alsa_set_key]="${c_integer_upsampling_allowed}" + fi + fi + # debug dump values ## sz=`echo "${#alsa_out_set_values[@]}"` ## echo "There are [$sz] available alsa_presets" @@ -220,6 +233,7 @@ build_alsa() { add_output_parameter $out_file $idx ALSA_OUTPUT_AUTO_RESAMPLE auto_resample "" none add_output_parameter $out_file $idx ALSA_OUTPUT_THESYCON_DSD_WORKAROUND thesycon_dsd_workaround "" none add_output_parameter $out_file $idx ALSA_OUTPUT_INTEGER_UPSAMPLING integer_upsampling "" none + add_alsa_output_parameter $out_file $idx ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED integer_upsampling_allowed "" none "integer_upsampling_allowed" add_output_parameter $out_file $idx ALSA_OUTPUT_DOP dop "" none close_output $out_file # see if the ups version must be enforced diff --git a/app/bin/build-integer-upsampling-allowed-presets.sh b/app/bin/build-integer-upsampling-allowed-presets.sh new file mode 100644 index 0000000..2ccd30d --- /dev/null +++ b/app/bin/build-integer-upsampling-allowed-presets.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +declare -A integer_upsampling_allowed_presets + +integer_upsampling_allowed_44=44 +integer_upsampling_allowed_base=base + +integer_upsampling_allowed_presets[$integer_upsampling_allowed_44]="44100:*:*" +integer_upsampling_allowed_presets[$integer_upsampling_allowed_base]="44100:*:* 48000:*:*" + diff --git a/app/bin/run-mpd.sh b/app/bin/run-mpd.sh index 5a93425..49fa43e 100644 --- a/app/bin/run-mpd.sh +++ b/app/bin/run-mpd.sh @@ -37,6 +37,7 @@ declare -A file_dict source build-soxr-presets.sh source build-allowed-formats-presets.sh +source build-integer-upsampling-allowed-presets.sh source read-file.sh source get-value.sh source load-alsa-presets.sh diff --git a/build.sh b/build.sh index c8e77f2..c62b9b0 100755 --- a/build.sh +++ b/build.sh @@ -64,7 +64,7 @@ echo "Base Image Tag: ["$selected_image_tag"]" echo "Build Tag: ["$tag"]" echo "Proxy: ["$proxy"]" -docker build . --no-cache \ +docker build . \ --build-arg BASE_IMAGE_TAG=${selected_image_tag} \ --build-arg USE_APT_PROXY=${proxy} \ -t giof71/mpd-alsa:$tag diff --git a/doc/change-history.md b/doc/change-history.md index 1dd2b37..c85df99 100644 --- a/doc/change-history.md +++ b/doc/change-history.md @@ -2,6 +2,8 @@ Date|Major Changes :---|:--- +2023-02-03|Add support for `ALSA_OUTPUT_INTEGER_UPSAMPLING_ALLOWED` +2023-02-03|Bump to mpd version `v0.23.12` 2023-01-30|Add support for `AUDIO_BUFFER_SIZE` 2023-01-20|Player state enforced by default 2023-01-17|`HTTPD_OUTPUT_TAGS` had typo in name