From 6fbb9dc728cdac7dc7a09c14ed35dbcf7af569cb Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 31 May 2025 12:25:31 +0200 Subject: [PATCH] sound: print verbose message if module doesn't support audio_latency option, docs: small update, remove references to dsound --- docs/man/mame.6 | 7 ++++--- docs/source/commandline/commandline-all.rst | 22 ++++++++++----------- src/osd/modules/sound/pipewire_sound.cpp | 3 +++ src/osd/modules/sound/pulse_sound.cpp | 3 +++ src/osd/modules/sound/sdl_sound.cpp | 3 +++ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/man/mame.6 b/docs/man/mame.6 index e45985a3011..fab6c3f22d8 100644 --- a/docs/man/mame.6 +++ b/docs/man/mame.6 @@ -907,7 +907,7 @@ Split full screen image across monitors. Default is OFF (\-nouseallheads). .SS Sound options .\" ******************************************************* .TP -.B \-sound\fR [\fIsdl\fR|\fIportaudio\fR|\fIcoreaudio\fR|\fIdsound\fR|\fIxaudio2\fR|\fInone\fR] +.B \-sound\fR [\fIsdl\fR|\fIportaudio\fR|\fIcoreaudio\fR|\fIwasapi\fR|\fIxaudio2\fR|\fInone\fR] Specifies which sound subsystem to use for audio output: .br \fBsdl\fR uses the Simple DirectMedia Layer audio output system @@ -919,14 +919,15 @@ output and multiple audio APIs. \fBcoreaudio\fR uses the Core Audio API which supports low-latency output and AudioUnit effects (only available on macOS). .br -\fBdsound\fR uses the DirectSound API (only available on Windows). +\fBwasapi\fR uses the Windows Audio Session API (WASAPI) (only available +on Windows). .br \fBxaudio2\fR uses the XAudio2 API which supports low-latency output (only available on Windows). .br \fBnone\fR produces no audio output. .br -Default is 'dsound' on Windows, 'coreaudio' on macOS or 'sdl' on other +Default is 'wasapi' on Windows, 'coreaudio' on macOS or 'sdl' on other platforms. .TP .B \-samplerate, \-srf \fIvalue diff --git a/docs/source/commandline/commandline-all.rst b/docs/source/commandline/commandline-all.rst index e9a0d79b2df..8ee84ae9a27 100644 --- a/docs/source/commandline/commandline-all.rst +++ b/docs/source/commandline/commandline-all.rst @@ -1937,9 +1937,9 @@ Core Performance Options half speed, and a ** of 2.0 means run at double speed. Note that changing this value affects sound playback as well, which will scale in pitch accordingly. A very low speed will introduce sound glitches, this - can be prevented by increasing **-audio_latency**. The internal precision - of the fraction is two decimal places, so a ** of ``1.002`` is - rounded to ``1.00``. + can be prevented by increasing the :ref:`audio latency + `. The internal precision of the fraction is + two decimal places, so a ** of ``1.002`` is rounded to ``1.00``. The default is ``1.0`` (normal speed). @@ -2977,17 +2977,16 @@ Core Sound Options Specifies which sound module to use. Selecting ``none`` disables sound output and input altogether (sound hardware is still emulated). - Available features, performance and latency vary between sound modules. The - exact interpretation and useful range of the :ref:`latency option - ` varies between sound modules. You may have - to change the value of the latency option if you change the sound module. + Available features, performance and latency vary between sound modules. + You may have to change the value of the :ref:`latency option + ` if you change the sound module. When using the ``sdl`` sound subsystem, the audio API to use may be selected by setting the *SDL_AUDIODRIVER* environment variable. Available audio APIs depend on the operating system. On Windows, it may be necessary to set ``SDL_AUDIODRIVER=directsound`` if no sound output is produced by default. - The default is ``dsound`` on Windows. On Mac, ``coreaudio`` is the default. + The default is ``wasapi`` on Windows. On Mac, ``coreaudio`` is the default. On all other platforms, ``sdl`` is the default. Example: @@ -3072,10 +3071,9 @@ Core Sound Options interruptions. A value of 0.0 will use the default for the selected sound module. - The exact interpretation and useful range of values for this option depends - on the selected sound module. You may need to change the value of this - option if you change the sound module using the :ref:`sound option - `. + You may need to change the value of this option if you change the sound module + using the :ref:`sound option `. This option is + unsupported on sound modules ``pipewire``, ``pulse``, ``sdl``. The default is ``0.0``. diff --git a/src/osd/modules/sound/pipewire_sound.cpp b/src/osd/modules/sound/pipewire_sound.cpp index 46218db327c..383398a28e6 100644 --- a/src/osd/modules/sound/pipewire_sound.cpp +++ b/src/osd/modules/sound/pipewire_sound.cpp @@ -497,6 +497,9 @@ int sound_pipewire::init(osd_interface &osd, osd_options const &options) if(!m_core) return 1; + if(options.audio_latency() > 0.0f) + osd_printf_verbose("Sound: %s module does not support audio_latency option\n", name()); + pw_core_add_listener(m_core, &m_core_listener, &core_events, this); m_registry = pw_core_get_registry(m_core, PW_VERSION_REGISTRY, 0); diff --git a/src/osd/modules/sound/pulse_sound.cpp b/src/osd/modules/sound/pulse_sound.cpp index c16aa03006b..77331fa5ce2 100644 --- a/src/osd/modules/sound/pulse_sound.cpp +++ b/src/osd/modules/sound/pulse_sound.cpp @@ -389,6 +389,9 @@ int sound_pulse::init(osd_interface &osd, osd_options const &options) if(m_generation >= 0x80000000) return 1; + if(options.audio_latency() > 0.0f) + osd_printf_verbose("Sound: %s module does not support audio_latency option\n", name()); + return 0; } diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp index 9c2ce1508bc..664a5783392 100644 --- a/src/osd/modules/sound/sdl_sound.cpp +++ b/src/osd/modules/sound/sdl_sound.cpp @@ -95,6 +95,9 @@ int sound_sdl::init(osd_interface &osd, const osd_options &options) char const *const audio_driver = SDL_GetCurrentAudioDriver(); osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized"); + if(options.audio_latency() > 0.0f) + osd_printf_verbose("Audio: %s module does not support audio_latency option\n", name()); + // Capture is not implemented in SDL2, and the enumeration // interface is different in SDL3 int dev_count = SDL_GetNumAudioDevices(0);