mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 21:29:36 +02:00
feat(player): add direct USB audio and DSD transport
This commit is contained in:
1 parent
4e464b5b6b
commit
608675a255
31 files changed
+2875
-12
No files matched your search
@@ -93,6 +93,10 @@ class _MainShellState extends ConsumerState<MainShell>
|
||||
);
|
||||
setAutoMixEnabled(ref.read(settingsProvider).autoMix);
|
||||
setUsbBitPerfectEnabled(ref.read(settingsProvider).usbBitPerfect);
|
||||
setUsbOutputOptions(
|
||||
direct: ref.read(settingsProvider).usbDirect,
|
||||
allowDop: ref.read(settingsProvider).usbDsdOverPcm,
|
||||
);
|
||||
setAutoplayEnabled(
|
||||
ref.read(settingsProvider).autoplay,
|
||||
includeLocal: ref.read(settingsProvider).localLibraryEnabled,
|
||||
@@ -746,6 +750,10 @@ class _MainShellState extends ConsumerState<MainShell>
|
||||
ref.listen(settingsProvider.select((s) => s.usbBitPerfect), (_, enabled) {
|
||||
setUsbBitPerfectEnabled(enabled);
|
||||
});
|
||||
ref.listen(
|
||||
settingsProvider.select((s) => (s.usbDirect, s.usbDsdOverPcm)),
|
||||
(_, value) => setUsbOutputOptions(direct: value.$1, allowDop: value.$2),
|
||||
);
|
||||
ref.listen(
|
||||
settingsProvider.select((s) => (s.autoplay, s.localLibraryEnabled)),
|
||||
(_, value) => setAutoplayEnabled(value.$1, includeLocal: value.$2),
|
||||
|
||||
@@ -907,7 +907,14 @@ class _LibrarySettingsPageState extends ConsumerState<LibrarySettingsPage> {
|
||||
if (settings.usbBitPerfect)
|
||||
switch (status.reason) {
|
||||
'active' =>
|
||||
'${status.device} · ${status.bitDepth}-bit · ${(status.sampleRate! / 1000).toStringAsFixed(1)} kHz',
|
||||
'${status.device} · ${status.transport == 'pcm'
|
||||
? '${status.bitDepth}-bit PCM'
|
||||
: status.transport == 'dop'
|
||||
? 'DSD (DoP)'
|
||||
: 'DSD (Native)'} · ${(status.sampleRate! / 1000).toStringAsFixed(1)} kHz',
|
||||
'dsd_unsupported' => context.l10n.usbDsdUnsupported,
|
||||
'permission_denied' =>
|
||||
context.l10n.usbPermissionDenied,
|
||||
'no_usb' => context.l10n.usbBitPerfectNoDevice,
|
||||
'route_changed' =>
|
||||
context.l10n.usbBitPerfectRouteChanged,
|
||||
@@ -921,9 +928,31 @@ class _LibrarySettingsPageState extends ConsumerState<LibrarySettingsPage> {
|
||||
onChanged: (value) => ref
|
||||
.read(settingsProvider.notifier)
|
||||
.setUsbBitPerfect(value),
|
||||
showDivider: false,
|
||||
showDivider: settings.usbBitPerfect,
|
||||
),
|
||||
),
|
||||
if (Platform.isAndroid && settings.usbBitPerfect) ...[
|
||||
SettingsSwitchItem(
|
||||
icon: Icons.usb,
|
||||
title: context.l10n.usbDirect,
|
||||
subtitle: context.l10n.usbDirectDescription,
|
||||
value: settings.usbDirect,
|
||||
onChanged: (value) =>
|
||||
ref.read(settingsProvider.notifier).setUsbDirect(value),
|
||||
showDivider: settings.usbDirect,
|
||||
),
|
||||
if (settings.usbDirect)
|
||||
SettingsSwitchItem(
|
||||
icon: Icons.graphic_eq,
|
||||
title: context.l10n.usbDsdOverPcm,
|
||||
subtitle: context.l10n.usbDsdOverPcmDescription,
|
||||
value: settings.usbDsdOverPcm,
|
||||
onChanged: (value) => ref
|
||||
.read(settingsProvider.notifier)
|
||||
.setUsbDsdOverPcm(value),
|
||||
showDivider: false,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user