mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
sound: Fix edge case where pending sample rate matches output.
This commit is contained in:
parent
44ea7782c1
commit
949da6a0b0
@ -498,8 +498,8 @@ read_stream_view sound_stream_input::update(attotime start, attotime end)
|
||||
bool resampled = false;
|
||||
if (m_resampler_source != nullptr)
|
||||
{
|
||||
// if sample rates differ, then yet
|
||||
if (m_owner->sample_rate() != m_native_source->stream().sample_rate())
|
||||
// if sample rates differ, then yes
|
||||
if (m_owner->sample_rate() != m_native_source->buffer_sample_rate())
|
||||
resampled = true;
|
||||
|
||||
// if not, keep the resampler's end time up to date
|
||||
@ -552,6 +552,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output
|
||||
m_input_adaptive(sample_rate == SAMPLE_RATE_INPUT_ADAPTIVE),
|
||||
m_output_adaptive(sample_rate == SAMPLE_RATE_OUTPUT_ADAPTIVE),
|
||||
m_synchronous((flags & STREAM_SYNCHRONOUS) != 0),
|
||||
m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0),
|
||||
m_sync_timer(nullptr),
|
||||
m_input(inputs),
|
||||
m_input_array(inputs),
|
||||
@ -580,7 +581,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output
|
||||
{
|
||||
// allocate a resampler stream if needed, and get a pointer to its output
|
||||
sound_stream_output *resampler = nullptr;
|
||||
if ((flags & STREAM_DISABLE_INPUT_RESAMPLING) == 0)
|
||||
if (!m_resampling_disabled)
|
||||
{
|
||||
m_resampler_list.push_back(std::make_unique<default_resampler_stream>(m_device));
|
||||
resampler = &m_resampler_list.back()->m_output[0];
|
||||
@ -736,6 +737,7 @@ read_stream_view sound_stream::update_view(attotime start, attotime end, u32 out
|
||||
m_input_view[inputnum] = m_input[inputnum].update(update_start, end);
|
||||
else
|
||||
m_input_view[inputnum] = empty_view(update_start, end);
|
||||
sound_assert(m_resampling_disabled || m_input_view[inputnum].sample_rate() == m_sample_rate);
|
||||
}
|
||||
|
||||
#if (SOUND_DEBUG)
|
||||
|
@ -455,6 +455,7 @@ public:
|
||||
attotime end_time() const { return m_buffer.end_time(); }
|
||||
u32 index() const { return m_index; }
|
||||
stream_buffer::sample_t gain() const { return m_gain; }
|
||||
u32 buffer_sample_rate() const { return m_buffer.sample_rate(); }
|
||||
|
||||
// simple setters
|
||||
void set_gain(float gain) { m_gain = gain; }
|
||||
@ -580,9 +581,10 @@ public:
|
||||
sound_stream *next() const { return m_next; }
|
||||
device_t &device() const { return m_device; }
|
||||
std::string name() const { return m_name; }
|
||||
bool synchronous() const { return m_synchronous; }
|
||||
bool input_adaptive() const { return m_input_adaptive || m_synchronous; }
|
||||
bool output_adaptive() const { return m_output_adaptive; }
|
||||
bool synchronous() const { return m_synchronous; }
|
||||
bool resampling_disabled() const { return m_resampling_disabled; }
|
||||
|
||||
// input and output getters
|
||||
u32 input_count() const { return m_input.size(); }
|
||||
@ -654,6 +656,7 @@ private:
|
||||
bool m_input_adaptive; // adaptive stream that runs at the sample rate of its input
|
||||
bool m_output_adaptive; // adaptive stream that runs at the sample rate of its output
|
||||
bool m_synchronous; // synchronous stream that runs at the rate of its input
|
||||
bool m_resampling_disabled; // is resampling of input streams disabled?
|
||||
emu_timer *m_sync_timer; // update timer for synchronous streams
|
||||
|
||||
// input information
|
||||
|
Loading…
Reference in New Issue
Block a user