mirror of
https://github.com/holub/mame
synced 2025-05-13 17:38:21 +03:00
attotime::from_ticks: on 0hz return attotime::never instead of crashing (nw)
This commit is contained in:
parent
46f38a9d67
commit
f4f390a538
@ -343,6 +343,8 @@ inline u64 attotime::as_ticks(u32 frequency) const
|
|||||||
|
|
||||||
/** Create an attotime from a tick count @ticks at the given frequency @frequency */
|
/** Create an attotime from a tick count @ticks at the given frequency @frequency */
|
||||||
inline attotime attotime::from_ticks(u64 ticks, u32 frequency)
|
inline attotime attotime::from_ticks(u64 ticks, u32 frequency)
|
||||||
|
{
|
||||||
|
if (frequency > 0)
|
||||||
{
|
{
|
||||||
attoseconds_t attos_per_tick = HZ_TO_ATTOSECONDS(frequency);
|
attoseconds_t attos_per_tick = HZ_TO_ATTOSECONDS(frequency);
|
||||||
|
|
||||||
@ -353,6 +355,9 @@ inline attotime attotime::from_ticks(u64 ticks, u32 frequency)
|
|||||||
s32 secs = divu_64x32_rem(ticks, frequency, &remainder);
|
s32 secs = divu_64x32_rem(ticks, frequency, &remainder);
|
||||||
return attotime(secs, u64(remainder) * attos_per_tick);
|
return attotime(secs, u64(remainder) * attos_per_tick);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return attotime::never;
|
||||||
|
}
|
||||||
|
|
||||||
/** Create an attotime from floating point count of seconds @p _time */
|
/** Create an attotime from floating point count of seconds @p _time */
|
||||||
inline attotime attotime::from_double(double _time)
|
inline attotime attotime::from_double(double _time)
|
||||||
|
@ -224,7 +224,7 @@ WRITE8_MEMBER(vis_audio_device::pcm_w)
|
|||||||
m_samples = 0;
|
m_samples = 0;
|
||||||
m_sample_byte = 0;
|
m_sample_byte = 0;
|
||||||
m_isa->drq7_w(ASSERT_LINE);
|
m_isa->drq7_w(ASSERT_LINE);
|
||||||
attotime rate = attotime::from_ticks((double)(1 << ((m_mode >> 5) & 3)), 44100.0); // TODO : Unknown clock
|
attotime rate = attotime::from_ticks(1 << ((m_mode >> 5) & 3), 44100); // TODO : Unknown clock
|
||||||
m_pcm->adjust(rate, 0, rate);
|
m_pcm->adjust(rate, 0, rate);
|
||||||
}
|
}
|
||||||
else if(!(m_mode & 0x10))
|
else if(!(m_mode & 0x10))
|
||||||
|
Loading…
Reference in New Issue
Block a user