-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloppy.patch
More file actions
41 lines (39 loc) · 1.65 KB
/
floppy.patch
File metadata and controls
41 lines (39 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index b0a520a0..7f733635 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -1709,9 +1709,11 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
{
m_idx = m_spin_playback_sample;
sampleend = m_sample[m_idx].data.size();
- out = m_sample[m_idx].data[m_spin_samplepos++];
- if (m_spin_samplepos >= sampleend)
+ m_spin_samplepos++;
+ if (m_spin_samplepos < sampleend)
+ out = m_sample[m_idx].data[m_spin_samplepos];
+ else
{
// Motor sample has completed
switch (m_spin_playback_sample)
@@ -1765,7 +1767,8 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
m_idx = m_step_base + m_seek_playback_sample;
sampleend = m_sample[m_idx].data.size();
// Mix it into the stream value
- out += m_sample[m_idx].data[(int)m_seek_samplepos];
+ if (m_seek_samplepos < sampleend)
+ out += m_sample[m_idx].data[(int)m_seek_samplepos];
// By adding different values than 1, we can change the playback speed
// This will be used to adjust the seek sound
m_seek_samplepos += m_seek_pitch;
@@ -1783,8 +1786,10 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
sampleend = m_sample[m_idx].data.size();
// Mix it into the stream value
- out += m_sample[m_idx].data[m_step_samplepos++];
- if (m_step_samplepos >= sampleend)
+ m_step_samplepos++;
+ if (m_step_samplepos < sampleend)
+ out += m_sample[m_idx].data[m_step_samplepos];
+ else
{
// Step sample done
m_step_samplepos = 0;