SndChannelStatus: paused channels count as busy

This commit is contained in:
Iliyas Jorio 2022-05-17 22:56:40 +02:00
parent fbdc8fcf5e
commit caa3414833

View File

@ -106,14 +106,20 @@ OSErr SndDisposeChannel(SndChannelPtr macChanPtr, Boolean quietNow)
OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus) OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
{ {
(void) theLength; // Must have room to write an entire SCStatus struct
if ((size_t) theLength < sizeof(SCStatus))
{
return paramErr;
}
*theStatus = {}; *theStatus = {};
auto& source = GetChannelImpl(chan).source; auto& source = GetChannelImpl(chan).source;
theStatus->scChannelPaused = source.GetState() == cmixer::CM_STATE_PAUSED; int state = source.GetState();
theStatus->scChannelBusy = source.GetState() == cmixer::CM_STATE_PLAYING;
theStatus->scChannelPaused = state == cmixer::CM_STATE_PAUSED;
theStatus->scChannelBusy = state != cmixer::CM_STATE_STOPPED;
return noErr; return noErr;
} }