audio/internal/readerdriver: Refactoring

This commit is contained in:
Hajime Hoshi 2021-06-09 00:29:01 +09:00
parent f1a20f29b9
commit 67e5fae9c0
3 changed files with 3 additions and 4 deletions

View File

@ -43,7 +43,6 @@ func NewContext(sampleRate int, channelNum int, bitDepthInBytes int) (Context, c
if err := oboe.Play(sampleRate, channelNum, bitDepthInBytes, c.players.read); err != nil {
return nil, nil, err
}
go c.players.loop()
return c, ready, nil
}

View File

@ -156,8 +156,6 @@ func NewContext(sampleRate, channelNum, bitDepthInBytes int) (Context, chan stru
C.pa_stream_cork(c.stream, 0, C.pa_stream_success_cb_t(C.ebiten_readerdriver_streamSuccessCallback), unsafe.Pointer(c.mainloop))
go c.players.loop()
return c, ready, nil
}

View File

@ -29,9 +29,11 @@ type players struct {
}
func newPlayers() *players {
return &players{
p := &players{
cond: sync.NewCond(&sync.Mutex{}),
}
go p.loop()
return p
}
func (ps *players) shouldWait() bool {