diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index 02775e03e38..41ba4a495b3 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -633,14 +633,13 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** int i, j; int op; INT32 *mixp; - INT32 mix[48000*2]; - memset(mix, 0, sizeof(mix[0])*samples*2); + memset(m_mix_buffer, 0, sizeof(m_mix_buffer[0])*samples*2); for (j = 0; j < 12; j++) { YMF271Group *slot_group = &m_groups[j]; - mixp = &mix[0]; + mixp = m_mix_buffer; if (slot_group->pfm && slot_group->sync != 3) { @@ -656,7 +655,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** int slot2 = j + (1*12); int slot3 = j + (2*12); int slot4 = j + (3*12); - mixp = &mix[0]; + mixp = m_mix_buffer; if (m_slots[slot1].active) { @@ -843,7 +842,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** int slot1 = j + ((op + 0) * 12); int slot2 = j + ((op + 2) * 12); - mixp = &mix[0]; + mixp = m_mix_buffer; if (m_slots[slot1].active) { for (i = 0; i < samples; i++) @@ -895,7 +894,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** int slot1 = j + (0*12); int slot2 = j + (1*12); int slot3 = j + (2*12); - mixp = &mix[0]; + mixp = m_mix_buffer; if (m_slots[slot1].active) { @@ -981,7 +980,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } } - mixp = &mix[0]; + mixp = m_mix_buffer; update_pcm(j + (3*12), mixp, samples); break; } @@ -997,7 +996,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } } - mixp = &mix[0]; + mixp = m_mix_buffer; for (i = 0; i < samples; i++) { outputs[0][i] = (*mixp++)>>2; @@ -1711,6 +1710,7 @@ void ymf271_device::device_start() init_state(); m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/384); + m_mix_buffer = auto_alloc_array(machine(), INT32, 44100*2); for (i = 0; i < 256; i++) { diff --git a/src/emu/sound/ymf271.h b/src/emu/sound/ymf271.h index 79ba56de527..db4d08b4411 100644 --- a/src/emu/sound/ymf271.h +++ b/src/emu/sound/ymf271.h @@ -65,7 +65,8 @@ private: UINT32 loopaddr; UINT32 endaddr; INT8 altloop; - INT8 fs, srcnote, srcb; + INT8 fs; + INT8 srcnote, srcb; INT64 step; INT64 stepptr; @@ -138,6 +139,7 @@ private: emu_timer *m_timA, *m_timB; sound_stream *m_stream; + INT32 *m_mix_buffer; devcb2_write_line m_irq_handler; devcb2_read8 m_ext_read_handler; diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index b4c67ba03ab..6e9f676c8eb 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -251,9 +251,8 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t * INT16 sample = 0; INT32 *mixp; INT32 vl, vr; - INT32 mix[44100*2]; - memset(mix, 0, sizeof(mix[0])*samples*2); + memset(m_mix_buffer, 0, sizeof(m_mix_buffer[0])*samples*2); for (i = 0; i < 24; i++) { @@ -261,7 +260,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t * if (slot->active) { - mixp = mix; + mixp = m_mix_buffer; for (j = 0; j < samples; j++) { @@ -320,7 +319,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t * } } - mixp = mix; + mixp = m_mix_buffer; vl = m_mix_level[m_pcm_l]; vr = m_mix_level[m_pcm_r]; for (i = 0; i < samples; i++) @@ -972,6 +971,7 @@ void ymf278b_device::device_start() } m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/768); + m_mix_buffer = auto_alloc_array(machine(), INT32, 44100*2); // rate tables precompute_rate_tables(); diff --git a/src/emu/sound/ymf278b.h b/src/emu/sound/ymf278b.h index 8a3c94ed84b..70a1a848c27 100644 --- a/src/emu/sound/ymf278b.h +++ b/src/emu/sound/ymf278b.h @@ -125,6 +125,7 @@ private: int m_clock; sound_stream * m_stream; + INT32 *m_mix_buffer; devcb2_write_line m_irq_handler; };