mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +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 = map[*playerImpl]struct{}{}
|
||||||
}
|
}
|
||||||
p.players[player] = struct{}{}
|
p.players[player] = struct{}{}
|
||||||
|
p.cond.Signal()
|
||||||
|
|
||||||
if p.waveOut != 0 {
|
if p.waveOut != 0 {
|
||||||
return nil
|
return nil
|
||||||
@ -183,6 +184,10 @@ func (p *players) removeImpl(player *playerImpl) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *players) shouldWait() bool {
|
func (p *players) shouldWait() bool {
|
||||||
|
if len(p.players) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
if p.waveOut == 0 {
|
if p.waveOut == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -271,6 +276,10 @@ func (p *players) readAndWriteBuffers() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *players) readAndWriteBuffersImpl() error {
|
func (p *players) readAndWriteBuffersImpl() error {
|
||||||
|
if len(p.players) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
headerNum := 0
|
headerNum := 0
|
||||||
for _, h := range p.headers {
|
for _, h := range p.headers {
|
||||||
if h.IsQueued() {
|
if h.IsQueued() {
|
||||||
|
Loading…
Reference in New Issue
Block a user