mirror of
https://github.com/holub/mame
synced 2025-05-08 07:11:42 +03:00
attotime::from_ticks: on 0hz return attotime::never instead of crashing (nw)
This commit is contained in:
parent
46f38a9d67
commit
f4f390a538
@ -344,14 +344,19 @@ inline u64 attotime::as_ticks(u32 frequency) const
|
||||
/** Create an attotime from a tick count @ticks at the given frequency @frequency */
|
||||
inline attotime attotime::from_ticks(u64 ticks, u32 frequency)
|
||||
{
|
||||
attoseconds_t attos_per_tick = HZ_TO_ATTOSECONDS(frequency);
|
||||
if (frequency > 0)
|
||||
{
|
||||
attoseconds_t attos_per_tick = HZ_TO_ATTOSECONDS(frequency);
|
||||
|
||||
if (ticks < frequency)
|
||||
return attotime(0, ticks * attos_per_tick);
|
||||
if (ticks < frequency)
|
||||
return attotime(0, ticks * attos_per_tick);
|
||||
|
||||
u32 remainder;
|
||||
s32 secs = divu_64x32_rem(ticks, frequency, &remainder);
|
||||
return attotime(secs, u64(remainder) * attos_per_tick);
|
||||
u32 remainder;
|
||||
s32 secs = divu_64x32_rem(ticks, frequency, &remainder);
|
||||
return attotime(secs, u64(remainder) * attos_per_tick);
|
||||
}
|
||||
else
|
||||
return attotime::never;
|
||||
}
|
||||
|
||||
/** Create an attotime from floating point count of seconds @p _time */
|
||||
|
@ -224,7 +224,7 @@ WRITE8_MEMBER(vis_audio_device::pcm_w)
|
||||
m_samples = 0;
|
||||
m_sample_byte = 0;
|
||||
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);
|
||||
}
|
||||
else if(!(m_mode & 0x10))
|
||||
|
Loading…
Reference in New Issue
Block a user