summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/tms3615.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/tms3615.cpp')
-rw-r--r--src/devices/sound/tms3615.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/devices/sound/tms3615.cpp b/src/devices/sound/tms3615.cpp
index 85f1ec5ece0..e59c64eab04 100644
--- a/src/devices/sound/tms3615.cpp
+++ b/src/devices/sound/tms3615.cpp
@@ -3,9 +3,6 @@
#include "emu.h"
#include "tms3615.h"
-#define VMIN 0x0000
-#define VMAX 0x7fff
-
const int tms3615_device::divisor[TMS3615_TONES] = { 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253, 239 };
@@ -49,20 +46,22 @@ void tms3615_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tms3615_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- int samplerate = m_samplerate;
- stream_sample_t *buffer8 = outputs[FOOTAGE_8];
- stream_sample_t *buffer16 = outputs[FOOTAGE_16];
+ auto &buffer8 = outputs[FOOTAGE_8];
+ auto &buffer16 = outputs[FOOTAGE_16];
+
+ int samplerate = buffer8.sample_rate();
- while( samples-- > 0 )
+ constexpr stream_buffer::sample_t VMAX = 1.0f / stream_buffer::sample_t(TMS3615_TONES);
+ for (int sampindex = 0; sampindex < buffer8.samples(); sampindex++)
{
- int sum8 = 0, sum16 = 0, tone = 0;
+ stream_buffer::sample_t sum8 = 0, sum16 = 0;
- for (tone = 0; tone < TMS3615_TONES; tone++)
+ for (int tone = 0; tone < TMS3615_TONES; tone++)
{
// 8'
@@ -95,11 +94,9 @@ void tms3615_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
}
- *buffer8++ = sum8 / TMS3615_TONES;
- *buffer16++ = sum16 / TMS3615_TONES;
+ buffer8.put(sampindex, sum8);
+ buffer16.put(sampindex, sum16);
}
-
- m_enable = 0;
}