summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/gb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/gb.cpp')
-rw-r--r--src/devices/sound/gb.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index 42944daf152..2fc1c81e5b0 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -142,7 +142,7 @@ cgb04_apu_device::cgb04_apu_device(const machine_config &mconfig, const char *ta
void gameboy_sound_device::device_start()
{
- m_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
+ m_channel = stream_alloc(0, 2, SAMPLE_RATE_OUTPUT_ADAPTIVE);
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameboy_sound_device::timer_callback),this));
m_timer->adjust(clocks_to_attotime(FRAME_CYCLES/128), 0, clocks_to_attotime(FRAME_CYCLES/128));
@@ -1211,18 +1211,18 @@ void cgb04_apu_device::apu_power_off()
//-------------------------------------------------
-// sound_stream_update_legacy - handle a stream update
+// sound_stream_update - handle a stream update
//-------------------------------------------------
-void gameboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void gameboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *outputl = outputs[0];
- stream_sample_t *outputr = outputs[1];
- while (samples-- > 0)
+ auto &outputl = outputs[0];
+ auto &outputr = outputs[1];
+ for (int sampindex = 0; sampindex < outputl.samples(); sampindex++)
{
- stream_sample_t sample;
- stream_sample_t left = 0;
- stream_sample_t right = 0;
+ s32 sample;
+ s32 left = 0;
+ s32 right = 0;
/* Mode 1 - Wave with Envelope and Sweep */
if (m_snd_1.on)
@@ -1269,12 +1269,8 @@ void gameboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
left *= m_snd_control.vol_left;
right *= m_snd_control.vol_right;
- /* pump up the volume */
- left <<= 6;
- right <<= 6;
-
/* Update the buffers */
- *outputl++ = left;
- *outputr++ = right;
+ outputl.put_int(sampindex, left, 32768 / 64);
+ outputr.put_int(sampindex, right, 32768 / 64);
}
}