deadbeef icon indicating copy to clipboard operation
deadbeef copied to clipboard

Can't use 96000hz format with PortAudio WASAPI device

Open bipface opened this issue 6 months ago • 0 comments

It seems that deadbeef won't configure PortAudio correctly when attempting to output 96khz via WASAPI, leading to an "Invalid sample rate" error from the PortAudio and playback not starting.

Config to reproduce the issue:

windows settings -> 'realtek digital output properties':
	'supported formats' -> 'sample rates': 96.0 khz
	'advanced' -> 'default format': 2 ch, 24 bit, 96000 hz
		
deadbeef preferences:
	sound:
		output plugin: portaudio
		output device: Windows WASAPI: Realtek Digital Output
		override bit depth: 24 bit
		override samplerate: 96000
		based on input samplerate: false
	DSP:
		resampler (SRC):
			set samplerate directly: 96000
			autodetect samplerate: false

track properties:
	FILETYPE: FLAC
	CHANNELS: 2
	BPS: 24
	SAMPLERATE: 96000
				
log entries:
	selected output plugin: PortAudio output plugin
	portaudio_configchanged: config option changed, restarting
	> portaudio_free
	selected output plugin: PortAudio output plugin
	> portaudio_setformat
	portaudio_setformat 16bit int 2ch 44100Hz channelmask=3
	switching format: (requested->actual)
	bps 16 -> 16
	is_float 0 -> 0
	channels 2 -> 2
	samplerate 44100 -> 44100
	channelmask 3 -> 3
	> portaudio_stream_destroy
	> portaudio_stream_start
	portaudio_stream_start
	portaudio_stream_create: Device: 4, Buffer size: 8192
	Failed to open stream. Invalid sample rate
	> portaudio_stop
	> portaudio_play
	portaudio_play

For comparison, this is a working configuration using 44.1khz:

windows settings -> 'realtek digital output properties':
	'supported formats' -> 'sample rates': 44.1 khz, 96.0 khz
	'advanced' -> 'default format': 2 ch, 24 bit, 44100 hz

deadbeef preferences:
	sound:
		output plugin: portaudio
		output device: Windows WASAPI: Realtek Digital Output
		override bit depth: 24 bit
		override samplerate: 44100
		based on input samplerate: false
	DSP:
		resampler (SRC):
			set samplerate directly: 44100
			autodetect samplerate: false

track properties:
	FILETYPE: FLAC
	CHANNELS: 2
	BPS: 24
	SAMPLERATE: 96000

log entries:
	selected output plugin: PortAudio output plugin
	portaudio_configchanged: config option changed, restarting
	> portaudio_free
	selected output plugin: PortAudio output plugin
	> portaudio_setformat
	portaudio_setformat 16bit int 2ch 44100Hz channelmask=3
	switching format: (requested->actual)
	bps 16 -> 16
	is_float 0 -> 0
	channels 2 -> 2
	samplerate 44100 -> 44100
	channelmask 3 -> 3
	> portaudio_stream_destroy
	> portaudio_stream_start
	portaudio_stream_start
	portaudio_stream_create: Device: 4, Buffer size: 8192
	portaudio_enum_soundcards have 11 devices
	portaudio: converting device names from charset UTF-8
	> portaudio_stop
	> portaudio_play
	portaudio_play
	portaudio_play: Resumed stream.
	portaudio_callback: stream not ok, wait
	portaudio_callback: got 0 frames instead of 4
	portaudio_callback: stream not ok, wait
	portaudio_callback: got 0 frames instead of 4
	> portaudio_setformat
	portaudio_callback: got 0 frames instead of 4
	portaudio_setformat 24bit int 2ch 44100Hz channelmask=3
	switching format: (requested->actual)
	bps 24 -> 16
	is_float 0 -> 0
	channels 2 -> 2
	samplerate 44100 -> 44100
	channelmask 3 -> 3
	> portaudio_stream_destroy
	> portaudio_stream_start
	portaudio_stream_destroy: closing stream
	portaudio_stream_start
	portaudio_stream_create: Device: 4, Buffer size: 8192
	portaudio_stream_create: continuing stream

I've tried almost every possible combination of settings between deadbeef and Windows. Ultimately it only seems to work when the whole chain is set to 44.1khz.

What leads me to think this is a bug in deadbeef is the log entries seem to indicate that portaudio_setformat is being called with 16bit 44100Hz despite override samplerate being set to 96000.

DirectSound output seems to work fine in all cases but it introduces annoying click sounds when pausing/playing so I'd prefer to use WASAPI.

Information about the software:

Deadbeef version: 1.9.6 and current nightly release OS: Windows 10 19045.3570

I also tried using a libportaudio binary built from the latest snapshot (12-Dec-2023 01:23:02) however this made no difference.

bipface avatar Dec 12 '23 05:12 bipface