diff options
| author | 2026-03-12 12:58:43 +0100 | |
|---|---|---|
| committer | 2026-03-12 12:58:43 +0100 | |
| commit | 189b692e38d5d0b6542540956aea0c322f8247ca (patch) | |
| tree | f25811b98ce5f488979f4dfed775600d8131932b /src/osd | |
| parent | 70d4b9bc5d488bf71e571c14eec46615319e2c2c (diff) | |
sound_module: update notes
Diffstat (limited to 'src/osd')
| -rw-r--r-- | src/osd/modules/sound/sound_module.cpp | 10 | ||||
| -rw-r--r-- | src/osd/modules/sound/sound_module.h | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/osd/modules/sound/sound_module.cpp b/src/osd/modules/sound/sound_module.cpp index 20220cf2c77..486d4023d52 100644 --- a/src/osd/modules/sound/sound_module.cpp +++ b/src/osd/modules/sound/sound_module.cpp @@ -1,7 +1,6 @@ // license:BSD-3-Clause // copyright-holders:O. Galibert - #include "sound_module.h" #include <algorithm> @@ -94,11 +93,12 @@ void sound_module::abuffer::push(const int16_t *data, uint32_t samples) std::copy_n(data + ((samples - 1) * m_channels), m_channels, m_last_sample.data()); // maximum number of buffers relative to samples + // unless -speed or -refreshspeed is used, this is same as m_max_buffers const uint32_t max_buffers = std::max(m_max_buffers * 48000 / samples / 50, 4U); // minimum number of buffers after overrun - // (lower limit of 2 prevents buffer underruns with push(this), get, get, push) - const uint32_t min_buffers = std::max(max_buffers / 4, 2U); + // lower limit of 2 prevents buffer underruns with push(this), get, get, push + const uint32_t min_buffers = std::max(max_buffers / 3, 2U); m_history[m_hindex] = m_used_buffers_prev - m_used_buffers; m_hindex = (m_hindex + 1) % m_history.size(); @@ -115,13 +115,13 @@ void sound_module::abuffer::push(const int16_t *data, uint32_t samples) if(m_overrun && std::accumulate(m_history.begin(), m_history.end(), 0) >= -2) { if(m_used_buffers > min_buffers) { - // Once it's stabilized after an overrun, reduce buffers to minimum latency + // once it's stabilized after an overrun, reduce buffers to minimum latency flush_buffers(min_buffers); std::fill(m_history.begin(), m_history.end(), 0); } m_overrun = false; } else if(m_used_buffers > max_buffers) { - // If there are too many buffers, drop some and mark this event as an overrun + // if there are too many buffers, drop some and mark this event as an overrun flush_buffers(max_buffers); m_overrun = true; m_overruns++; diff --git a/src/osd/modules/sound/sound_module.h b/src/osd/modules/sound/sound_module.h index 8d1697931dc..dd24723ff1d 100644 --- a/src/osd/modules/sound/sound_module.h +++ b/src/osd/modules/sound/sound_module.h @@ -1,9 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Couriersud -/* - * sound_module.h - * - */ +// copyright-holders:O. Galibert + #ifndef MAME_OSD_SOUND_SOUND_MODULE_H #define MAME_OSD_SOUND_SOUND_MODULE_H |
