sound: change audio_latency meaning similar to what it was before (20ms steps for portaudio, xaudio2, wasapi), old mame.ini default setting of 2 should work fine

This commit is contained in:
hap 2025-05-31 17:04:19 +02:00
parent d2bfb8c3f4
commit 01cdde101f
6 changed files with 17 additions and 14 deletions

View File

@ -948,11 +948,11 @@ Sets the startup volume. It can later be changed with the user interface
.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++ .\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
.TP .TP
.B \-audio_latency, \-alat \fIvalue .B \-audio_latency, \-alat \fIvalue
This controls the amount of latency in seconds built into the audio streaming. This controls the amount of latency built into the audio streaming.
Smaller values provide less audio delay while requiring better system Smaller values provide less audio delay while requiring better system
performance. Higher values increase audio delay but may help avoid performance. Higher values increase audio delay but may help avoid
buffer under-runs and audio interruptions. The default is 0.0 and will pick buffer under-runs and audio interruptions. The default is 0 and will
a sane duration. pick a sane duration.
.\" .\"
.\" ******************************************************* .\" *******************************************************
.SS Input options .SS Input options

View File

@ -3065,22 +3065,23 @@ Core Sound Options
**-audio_latency** *<value>* / **-alat** *<value>* **-audio_latency** *<value>* / **-alat** *<value>*
Audio latency in seconds, up to a maximum of 0.5 seconds. Smaller values Audio latency, conventionally in number of audio frames (1 audio frame is 20ms).
provide less audio delay while requiring better system performance. Larger It is not required to supply whole numbers, eg. a value of ``1.5`` is 30ms).
values increase audio delay but may help avoid buffer under-runs and audio Smaller values provide less audio delay while requiring better system
interruptions. A value of 0.0 will use the default for the selected sound performance. Larger values increase audio delay but may help avoid buffer
module. under-runs and audio interruptions. A value of ``0`` will use the default
for the selected sound module.
You may need to change the value of this option if you change the sound module You may need to change the value of this option if you change the sound module
using the :ref:`sound option <mame-commandline-sound>`. This option is using the :ref:`sound option <mame-commandline-sound>`. This option is
unsupported on sound modules ``pipewire``, ``pulse``, ``sdl``. unsupported on sound modules ``pipewire``, ``pulse``, ``sdl``.
The default is ``0.0``. The default is ``0``.
Example: Example:
.. code-block:: bash .. code-block:: bash
mame galaga -audio_latency 0.1 mame galaga -audio_latency 2
.. _mame-commandline-inputoptions: .. _mame-commandline-inputoptions:

View File

@ -144,7 +144,7 @@ const options_entry osd_options::s_option_entries[] =
{ nullptr, nullptr, core_options::option_type::HEADER, "OSD SOUND OPTIONS" }, { nullptr, nullptr, core_options::option_type::HEADER, "OSD SOUND OPTIONS" },
{ OSDOPTION_SOUND, OSDOPTVAL_AUTO, core_options::option_type::STRING, "sound output method: " }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, core_options::option_type::STRING, "sound output method: " },
{ OSDOPTION_AUDIO_LATENCY ";alat(0.0-0.5)", "0.0", core_options::option_type::FLOAT, "audio latency in seconds, 0.0 for default (increase to reduce glitches, decrease for responsiveness)" }, { OSDOPTION_AUDIO_LATENCY ";alat(0.0-50.0)", "0.0", core_options::option_type::FLOAT, "audio latency, 0 for default (increase to reduce glitches, decrease for responsiveness)" },
#ifdef SDLMAME_MACOSX #ifdef SDLMAME_MACOSX
{ nullptr, nullptr, core_options::option_type::HEADER, "CoreAudio-SPECIFIC OPTIONS" }, { nullptr, nullptr, core_options::option_type::HEADER, "CoreAudio-SPECIFIC OPTIONS" },

View File

@ -163,7 +163,7 @@ int sound_pa::init(osd_interface &osd, osd_options const &options)
m_info.m_default_source = dc(Pa_GetDefaultInputDevice()); m_info.m_default_source = dc(Pa_GetDefaultInputDevice());
m_stream_id = 1; m_stream_id = 1;
m_audio_latency = options.audio_latency(); m_audio_latency = options.audio_latency() / sound_manager::STREAMS_UPDATE_FREQUENCY;
m_machine = &downcast<osd_common_t &>(osd).machine(); m_machine = &downcast<osd_common_t &>(osd).machine();
return 0; return 0;

View File

@ -6,6 +6,7 @@
// //
//==================================================================== //====================================================================
#include "emu.h"
#include "sound_module.h" #include "sound_module.h"
#include "modules/osdmodule.h" #include "modules/osdmodule.h"
@ -499,7 +500,7 @@ int sound_wasapi::init(osd_interface &osd, osd_options const &options)
HRESULT result; HRESULT result;
// get relevant options // get relevant options
m_audio_latency = options.audio_latency(); m_audio_latency = options.audio_latency() / sound_manager::STREAMS_UPDATE_FREQUENCY;
if (m_audio_latency == 0.0F) if (m_audio_latency == 0.0F)
m_audio_latency = 0.03F; m_audio_latency = 0.03F;
m_audio_latency = std::clamp(m_audio_latency, 0.01F, 1.0F); m_audio_latency = std::clamp(m_audio_latency, 0.01F, 1.0F);

View File

@ -6,6 +6,7 @@
// //
//==================================================================== //====================================================================
#include "emu.h"
#include "sound_module.h" #include "sound_module.h"
#include "modules/osdmodule.h" #include "modules/osdmodule.h"
@ -387,7 +388,7 @@ int sound_xaudio2::init(osd_interface &osd, osd_options const &options)
} }
// get relevant options // get relevant options
m_audio_latency = options.audio_latency(); m_audio_latency = options.audio_latency() / sound_manager::STREAMS_UPDATE_FREQUENCY;
if (m_audio_latency == 0.0F) if (m_audio_latency == 0.0F)
m_audio_latency = 0.03F; m_audio_latency = 0.03F;
m_audio_latency = std::clamp(m_audio_latency, 0.01F, 1.0F); m_audio_latency = std::clamp(m_audio_latency, 0.01F, 1.0F);