mirror of
https://github.com/RetroDECK/org.mamedev.MAME.git
synced 2025-01-19 11:05:37 +00:00
Merge pull request #9 from flathub/248
Avoid position > end for floppy sample playback
This commit is contained in:
commit
b1badb043a
41
floppy.patch
Normal file
41
floppy.patch
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
|
||||||
|
index 3c00336d..cda94d92 100644
|
||||||
|
--- a/src/devices/imagedev/floppy.cpp
|
||||||
|
+++ b/src/devices/imagedev/floppy.cpp
|
||||||
|
@@ -1707,9 +1707,10 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
|
||||||
|
{
|
||||||
|
idx = m_spin_playback_sample;
|
||||||
|
sampleend = m_sample[idx].data.size();
|
||||||
|
- out = m_sample[idx].data[m_spin_samplepos++];
|
||||||
|
-
|
||||||
|
- if (m_spin_samplepos >= sampleend)
|
||||||
|
+ m_spin_samplepos++;
|
||||||
|
+ if (m_spin_samplepos < sampleend)
|
||||||
|
+ out = m_sample[idx].data[m_spin_samplepos];
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
// Motor sample has completed
|
||||||
|
switch (m_spin_playback_sample)
|
||||||
|
@@ -1763,7 +1764,8 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
|
||||||
|
idx = m_step_base + m_seek_playback_sample;
|
||||||
|
sampleend = m_sample[idx].data.size();
|
||||||
|
// Mix it into the stream value
|
||||||
|
- out += m_sample[idx].data[(int)m_seek_samplepos];
|
||||||
|
+ if (m_seek_samplepos < sampleend)
|
||||||
|
+ out += m_sample[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;
|
||||||
|
@@ -1781,8 +1783,10 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<
|
||||||
|
sampleend = m_sample[idx].data.size();
|
||||||
|
|
||||||
|
// Mix it into the stream value
|
||||||
|
- out += m_sample[idx].data[m_step_samplepos++];
|
||||||
|
- if (m_step_samplepos >= sampleend)
|
||||||
|
+ m_step_samplepos++;
|
||||||
|
+ if (m_step_samplepos < sampleend)
|
||||||
|
+ out += m_sample[idx].data[m_step_samplepos];
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
// Step sample done
|
||||||
|
m_step_samplepos = 0;
|
|
@ -79,3 +79,5 @@ modules:
|
||||||
path: org.mamedev.MAME.metainfo.xml
|
path: org.mamedev.MAME.metainfo.xml
|
||||||
- type: file
|
- type: file
|
||||||
path: mame.ini
|
path: mame.ini
|
||||||
|
- type: patch
|
||||||
|
path: floppy.patch
|
||||||
|
|
Loading…
Reference in a new issue