mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/readerdriver: Wait the loop when there is no player (Windows)
This commit is contained in:
parent
6a8abac194
commit
541156f255
@ -123,6 +123,7 @@ func (p *players) add(player *playerImpl) error {
|
||||
p.players = map[*playerImpl]struct{}{}
|
||||
}
|
||||
p.players[player] = struct{}{}
|
||||
p.cond.Signal()
|
||||
|
||||
if p.waveOut != 0 {
|
||||
return nil
|
||||
@ -183,6 +184,10 @@ func (p *players) removeImpl(player *playerImpl) error {
|
||||
}
|
||||
|
||||
func (p *players) shouldWait() bool {
|
||||
if len(p.players) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
if p.waveOut == 0 {
|
||||
return false
|
||||
}
|
||||
@ -271,6 +276,10 @@ func (p *players) readAndWriteBuffers() error {
|
||||
}
|
||||
|
||||
func (p *players) readAndWriteBuffersImpl() error {
|
||||
if len(p.players) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
headerNum := 0
|
||||
for _, h := range p.headers {
|
||||
if h.IsQueued() {
|
||||
|
Loading…
Reference in New Issue
Block a user