From 58ee4eb6c1b43cc84c8a2bc0a60b8059b1a080f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 24 Oct 2014 15:48:51 +0200 Subject: [PATCH] fixed usage of initialized members in dave_device() (nw) also fixes signed integer overflow in dave_device::sound_stream_update() with ep128 and others --- src/mess/audio/dave.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mess/audio/dave.c b/src/mess/audio/dave.c index 6322ef5a4f8..0c8b4a2cab5 100644 --- a/src/mess/audio/dave.c +++ b/src/mess/audio/dave.c @@ -96,12 +96,23 @@ void dave_device::device_start() save_item(NAME(m_level_and)); save_item(NAME(m_mame_volumes)); - for (int i = 0; i < 3; i++) - { - m_period[i] = (STEP * machine().sample_rate()) / 125000; + for (int i = 0; i < ARRAY_LENGTH(m_period); i++) + m_period[i] = (STEP * machine().sample_rate()) / 125000; + + for (int i = 0; i < ARRAY_LENGTH(m_count); i++) m_count[i] = (STEP * machine().sample_rate()) / 125000; + + for (int i = 0; i < ARRAY_LENGTH(m_level); i++) m_level[i] = 0; - } + + for (int i = 0; i < ARRAY_LENGTH(m_level_or); i++) + m_level_or[i] = 0; + + for (int i = 0; i < ARRAY_LENGTH(m_level_and); i++) + m_level_and[i] = 0; + + for (int i = 0; i < ARRAY_LENGTH(m_mame_volumes); i++) + m_mame_volumes[i] = 0; /* dave has 3 tone channels and 1 noise channel. the volumes are mixed internally and output as left and right volume */