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
1 changed files with 9 additions and 3 deletions

View File

@ -106,14 +106,20 @@ OSErr SndDisposeChannel(SndChannelPtr macChanPtr, Boolean quietNow)
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 = {};
auto& source = GetChannelImpl(chan).source;
theStatus->scChannelPaused = source.GetState() == cmixer::CM_STATE_PAUSED;
theStatus->scChannelBusy = source.GetState() == cmixer::CM_STATE_PLAYING;
int state = source.GetState();
theStatus->scChannelPaused = state == cmixer::CM_STATE_PAUSED;
theStatus->scChannelBusy = state != cmixer::CM_STATE_STOPPED;
return noErr;
}