summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/bus/msx_cart/moonsound.cpp6
-rw-r--r--src/devices/sound/ymf278b.cpp42
-rw-r--r--src/devices/sound/ymf278b.h3
-rw-r--r--src/mame/drivers/fuukifg3.cpp6
-rw-r--r--src/mame/includes/fuukifg3.h1
5 files changed, 44 insertions, 14 deletions
diff --git a/src/devices/bus/msx_cart/moonsound.cpp b/src/devices/bus/msx_cart/moonsound.cpp
index 8289a086a18..2909c7c8f1f 100644
--- a/src/devices/bus/msx_cart/moonsound.cpp
+++ b/src/devices/bus/msx_cart/moonsound.cpp
@@ -45,10 +45,12 @@ MACHINE_CONFIG_START(msx_cart_moonsound_device::device_add_mconfig)
MCFG_YMF278B_IRQ_HANDLER(WRITELINE(*this, msx_cart_moonsound_device, irq_w))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.50)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
- MCFG_SOUND_ROUTE(2, "lspeaker", 0.40)
- MCFG_SOUND_ROUTE(3, "rspeaker", 0.40)
+ MCFG_SOUND_ROUTE(2, "lspeaker", 0.50)
+ MCFG_SOUND_ROUTE(3, "rspeaker", 0.50)
MCFG_SOUND_ROUTE(4, "lspeaker", 0.40)
MCFG_SOUND_ROUTE(5, "rspeaker", 0.40)
+ MCFG_SOUND_ROUTE(6, "lspeaker", 0.40)
+ MCFG_SOUND_ROUTE(7, "rspeaker", 0.40)
MACHINE_CONFIG_END
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index e0e0dae40d2..274b9e2c95e 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -50,6 +50,8 @@
#include "ymf278b.h"
#include "ymf262.h"
+#include <algorithm>
+
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
@@ -225,7 +227,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
return;
}
- memset(m_mix_buffer.get(), 0, sizeof(m_mix_buffer[0])*samples*2);
+ std::fill(m_mix_buffer.begin(), m_mix_buffer.end(), 0);
for (i = 0; i < 24; i++)
{
@@ -233,7 +235,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
if (slot->active)
{
- mixp = m_mix_buffer.get();
+ mixp = &m_mix_buffer[0];
for (j = 0; j < samples; j++)
{
@@ -274,8 +276,20 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
break;
}
- *mixp++ += (sample * m_volume[slot->TL+m_pan_left [slot->pan]+(slot->env_vol>>23)])>>17;
- *mixp++ += (sample * m_volume[slot->TL+m_pan_right[slot->pan]+(slot->env_vol>>23)])>>17;
+ if (slot->CH) // DO1 out
+ {
+ mixp++;
+ mixp++;
+ *mixp++ += (sample * m_volume[slot->TL+m_pan_left [slot->pan]+(slot->env_vol>>23)])>>17;
+ *mixp++ += (sample * m_volume[slot->TL+m_pan_right[slot->pan]+(slot->env_vol>>23)])>>17;
+ }
+ else // DO2 out
+ {
+ *mixp++ += (sample * m_volume[slot->TL+m_pan_left [slot->pan]+(slot->env_vol>>23)])>>17;
+ *mixp++ += (sample * m_volume[slot->TL+m_pan_right[slot->pan]+(slot->env_vol>>23)])>>17;
+ mixp++;
+ mixp++;
+ }
// update frequency
slot->stepptr += slot->step;
@@ -293,13 +307,15 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
}
- mixp = m_mix_buffer.get();
+ mixp = &m_mix_buffer[0];
vl = m_mix_level[m_pcm_l];
vr = m_mix_level[m_pcm_r];
for (i = 0; i < samples; i++)
{
outputs[0][i] = (*mixp++ * vl) >> 16;
outputs[1][i] = (*mixp++ * vr) >> 16;
+ outputs[2][i] = *mixp++;
+ outputs[3][i] = *mixp++;
}
}
@@ -780,6 +796,7 @@ READ8_MEMBER( ymf278b_device::read )
//-------------------------------------------------
// device_post_load - device-specific post load
//-------------------------------------------------
+
void ymf278b_device::device_post_load()
{
ymf262_post_load(m_ymf262);
@@ -851,7 +868,15 @@ void ymf278b_device::device_stop()
void ymf278b_device::device_clock_changed()
{
- m_stream->set_sample_rate(clock()/768);
+ int old_rate = m_rate;
+ m_clock = clock();
+ m_rate = m_clock/768;
+
+ if (m_rate > old_rate)
+ {
+ m_mix_buffer.resize(m_rate*4,0);
+ }
+ m_stream->set_sample_rate(m_rate);
// YMF262 related
@@ -966,6 +991,7 @@ void ymf278b_device::device_start()
int i;
m_clock = clock();
+ m_rate = m_clock / 768;
m_irq_handler.resolve();
m_timer_base = attotime::from_hz(m_clock) * (19*36);
@@ -979,8 +1005,8 @@ void ymf278b_device::device_start()
m_slots[i].num = i;
}
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/768);
- m_mix_buffer = std::make_unique<int32_t[]>(44100*2);
+ m_stream = machine().sound().stream_alloc(*this, 0, 4, m_rate);
+ m_mix_buffer.resize(m_rate*4,0);
// rate tables
precompute_rate_tables();
diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h
index 7b12ae322f9..f6c0b5ba2c6 100644
--- a/src/devices/sound/ymf278b.h
+++ b/src/devices/sound/ymf278b.h
@@ -130,9 +130,10 @@ private:
emu_timer *m_timer_a, *m_timer_b;
int m_clock;
+ int m_rate;
sound_stream * m_stream;
- std::unique_ptr<int32_t[]> m_mix_buffer;
+ std::vector<int32_t> m_mix_buffer;
devcb_write_line m_irq_handler;
uint8_t m_last_fm_data;
diff --git a/src/mame/drivers/fuukifg3.cpp b/src/mame/drivers/fuukifg3.cpp
index cf3cf8f50c6..40f3a732242 100644
--- a/src/mame/drivers/fuukifg3.cpp
+++ b/src/mame/drivers/fuukifg3.cpp
@@ -564,10 +564,12 @@ MACHINE_CONFIG_START(fuuki32_state::fuuki32)
MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.50)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
- MCFG_SOUND_ROUTE(2, "lspeaker", 0.40)
- MCFG_SOUND_ROUTE(3, "rspeaker", 0.40)
+ MCFG_SOUND_ROUTE(2, "lspeaker", 0.50)
+ MCFG_SOUND_ROUTE(3, "rspeaker", 0.50)
MCFG_SOUND_ROUTE(4, "lspeaker", 0.40)
MCFG_SOUND_ROUTE(5, "rspeaker", 0.40)
+ MCFG_SOUND_ROUTE(6, "lspeaker", 0.40)
+ MCFG_SOUND_ROUTE(7, "rspeaker", 0.40)
MACHINE_CONFIG_END
/***************************************************************************
diff --git a/src/mame/includes/fuukifg3.h b/src/mame/includes/fuukifg3.h
index 5f5677955d2..64d13ce5953 100644
--- a/src/mame/includes/fuukifg3.h
+++ b/src/mame/includes/fuukifg3.h
@@ -8,7 +8,6 @@
#define CPU_CLOCK (XTAL(40'000'000) / 2) /* clock for 68020 */
#define SOUND_CPU_CLOCK (XTAL(12'000'000) / 2) /* clock for Z80 sound CPU */
-#define FM_SOUND_CLOCK (XTAL(33'868'800) / 2) /* FM clock */
/* NOTE: YMF278B_STD_CLOCK is defined in /src/emu/sound/ymf278b.h */