audio: refactoring

This commit is contained in:
Hajime Hoshi 2023-07-30 17:04:58 +09:00
parent 5f1d1ec412
commit 335dab9175

View File

@ -224,12 +224,11 @@ func (c *Context) IsReady() bool {
c.m.Lock() c.m.Lock()
defer c.m.Unlock() defer c.m.Unlock()
r := c.ready if c.ready {
if r { return true
return r
} }
if len(c.players) != 0 { if len(c.players) != 0 {
return r return false
} }
c.readyOnce.Do(func() { c.readyOnce.Do(func() {
@ -245,7 +244,7 @@ func (c *Context) IsReady() bool {
}() }()
}) })
return r return false
} }
// SampleRate returns the sample rate. // SampleRate returns the sample rate.