summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/wave.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/wave.cpp')
-rw-r--r--src/devices/sound/wave.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/devices/sound/wave.cpp b/src/devices/sound/wave.cpp
index ac564f70226..6506ef41d13 100644
--- a/src/devices/sound/wave.cpp
+++ b/src/devices/sound/wave.cpp
@@ -54,33 +54,27 @@ void wave_device::device_start()
void wave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
- cassette_state state;
- double time_index;
- double duration;
stream_sample_t *left_buffer = outputs[0];
stream_sample_t *right_buffer = nullptr;
- int i;
speaker_device_iterator spkiter(*owner());
int speakers = spkiter.count();
- if (speakers>1)
+ if (speakers > 1)
right_buffer = outputs[1];
- state = m_cass->get_state();
-
- state = (cassette_state)(state & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER));
+ cassette_state state = m_cass->get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER);
if (m_cass->exists() && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))))
{
cassette_image *cassette = m_cass->get_image();
- time_index = m_cass->get_position();
- duration = ((double) samples) / m_cass->machine().sample_rate();
+ double time_index = m_cass->get_position();
+ double duration = double(samples) / m_cass->machine().sample_rate();
cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT);
if (speakers > 1)
cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
- for (i = samples - 1; i >= 0; i--)
+ for (int i = samples - 1; i >= 0; i--)
{
left_buffer[i] = ((int16_t *) left_buffer)[i];
if (speakers > 1)