mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
better
This commit is contained in:
parent
a08b1a7803
commit
4a8b1ab469
@ -222,9 +222,7 @@ int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, INT16 *buffer, in
|
||||
position++;
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -276,9 +274,7 @@ int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, INT16 *buffer, in
|
||||
}
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -322,9 +318,7 @@ int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, INT16 *buffer, int
|
||||
position += 2;
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -352,9 +346,7 @@ int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, INT16 *buffer, int
|
||||
}
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -396,9 +388,7 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, INT16 *buffer, in
|
||||
position += 4;
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -426,9 +416,7 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, INT16 *buffer, in
|
||||
}
|
||||
if (position >= voice->stop)
|
||||
{
|
||||
if (!samples)
|
||||
samples |= 0x10000;
|
||||
|
||||
voice->ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -514,13 +502,14 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
|
||||
default: samples_left = 0; memset(m_scratch, 0, new_samples * sizeof(m_scratch[0])); break;
|
||||
}
|
||||
|
||||
/* if there are leftovers, ramp back to 0 */
|
||||
if (samples_left)
|
||||
if (samples_left || voice->ended)
|
||||
{
|
||||
/* NOTE: samples_left bit 16 is set if the voice was finished at the same time the function ended */
|
||||
int base = new_samples - (samples_left & 0xffff);
|
||||
voice->ended = false;
|
||||
|
||||
/* if there are leftovers, ramp back to 0 */
|
||||
int base = new_samples - samples_left;
|
||||
int i, t = (base == 0) ? curr : m_scratch[base - 1];
|
||||
for (i = 0; i < (samples_left & 0xffff); i++)
|
||||
for (i = 0; i < samples_left; i++)
|
||||
{
|
||||
if (t < 0) t = -((-t * 15) >> 4);
|
||||
else if (t > 0) t = (t * 15) >> 4;
|
||||
@ -623,6 +612,7 @@ void ymz280b_device::device_start()
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
save_item(NAME(m_voice[j].playing), j);
|
||||
save_item(NAME(m_voice[j].ended), j);
|
||||
save_item(NAME(m_voice[j].keyon), j);
|
||||
save_item(NAME(m_voice[j].looping), j);
|
||||
save_item(NAME(m_voice[j].mode), j);
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
struct YMZ280BVoice
|
||||
{
|
||||
UINT8 playing; /* 1 if we are actively playing */
|
||||
bool ended; /* indicate voice has ended in case samples_left is 0 */
|
||||
|
||||
UINT8 keyon; /* 1 if the key is on */
|
||||
UINT8 looping; /* 1 if looping is enabled */
|
||||
|
Loading…
Reference in New Issue
Block a user