Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jan 16, 2025
2 parents 93a7127 + 612b7d9 commit 879a49b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 2 deletions.
Binary file added src/assets/DSP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/DSP_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 55 additions & 1 deletion src/components/QualityDetailsBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,42 @@
/>
{{ loudness }}
</div>

<!-- For now, a very simple DSP indicator -->
<div
v-if="dsp_state == DSPState.DISABLED_BY_UNSUPPORTED_GROUP"
style="height: 50px; display: flex; align-items: center"
>
<img
height="30"
width="50"
contain
src="@/assets/DSP_off.png"
:style="
$vuetify.theme.current.dark
? 'object-fit: contain;'
: 'object-fit: contain;filter: invert(100%);'
"
/>
{{ $t("dsp_disabled_by_unsupported_group") }}
</div>
<div
v-else-if="dsp_state == DSPState.ENABLED"
style="height: 50px; display: flex; align-items: center"
>
<img
height="30"
width="50"
contain
src="@/assets/DSP.png"
:style="
$vuetify.theme.current.dark
? 'object-fit: contain;'
: 'object-fit: contain;filter: invert(100%);'
"
/>
{{ $t("dsp_active") }}
</div>
</v-list>
</v-card>
</v-menu>
Expand All @@ -85,7 +121,11 @@ import { computed } from "vue";
import ProviderIcon from "@/components/ProviderIcon.vue";
import api from "@/plugins/api";
import { store } from "@/plugins/store";
import { ContentType, VolumeNormalizationMode } from "@/plugins/api/interfaces";
import {
ContentType,
DSPState,
VolumeNormalizationMode,
} from "@/plugins/api/interfaces";
import { $t } from "@/plugins/i18n";
// computed properties
Expand Down Expand Up @@ -123,6 +163,20 @@ const loudness = computed(() => {
return null;
}
});
// This is tempoary until the details show the whole DSP pipeline
const dsp_state = computed(() => {
const dsp = streamDetails.value?.dsp;
if (!dsp) return DSPState.DISABLED;
let at_least_one_working = Object.values(dsp).some(
(d) => d.state == DSPState.ENABLED,
);
let at_least_one_unsupported = Object.values(dsp).some(
(d) => d.state == DSPState.DISABLED_BY_UNSUPPORTED_GROUP,
);
if (at_least_one_unsupported) return DSPState.DISABLED_BY_UNSUPPORTED_GROUP;
else if (at_least_one_working) return DSPState.ENABLED;
else return DSPState.DISABLED;
});
const getContentTypeIcon = function (contentType: ContentType) {
if (contentType == ContentType.AAC) return iconAac;
if (contentType == ContentType.FLAC) return iconFlac;
Expand Down
25 changes: 25 additions & 0 deletions src/plugins/api/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ export interface DSPConfig {
output_limiter: boolean;
}

// DSPDetails used in StreamDetails
export enum DSPState {
ENABLED = "enabled",
DISABLED = "disabled",
DISABLED_BY_UNSUPPORTED_GROUP = "disabled_by_unsupported_group",
}

// This describes the DSP configuration as applied,
// even when the DSP state is disabled. For example,
// output_limiter can remain true while the DSP is disabled.
// All filters in the list are guaranteed to be enabled.
export interface DSPDetails {
state: DSPState;
is_leader: boolean;
input_gain: number;
filters: DSPFilter[];
output_gain: number;
output_limiter: boolean;
}

/// enums

export enum MediaType {
Expand Down Expand Up @@ -612,6 +632,11 @@ export interface StreamDetails {
prefer_album_loudness?: boolean;
target_loudness?: number;
volume_normalization_mode?: VolumeNormalizationMode;
// This contains the DSPDetails of all players in the group.
// In case of single player playback, dict will contain only one entry.
// The leader will have is_leader set to True.
// (keep in mind that PlayerGroups have no (explicit) leader!)
dsp?: Record<string, DSPDetails>;
}

// queue_item
Expand Down
4 changes: 3 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,5 +606,7 @@
"loudness_measurement": "{0} LUFS",
"loudness_measurement_album": "{0} LUFS (album)",
"loudness_dynamic": "Dynamic volume normalization",
"loudness_fixed": "Fixed gain correction"
"loudness_fixed": "Fixed gain correction",
"dsp_disabled_by_unsupported_group": "Not supported for this group type",
"dsp_active": "Active"
}

0 comments on commit 879a49b

Please sign in to comment.