mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 20:42:07 +01:00
audio/internal/readerdriver: Refactoring
This commit is contained in:
parent
f1a20f29b9
commit
67e5fae9c0
@ -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 {
|
if err := oboe.Play(sampleRate, channelNum, bitDepthInBytes, c.players.read); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
go c.players.loop()
|
|
||||||
return c, ready, nil
|
return c, ready, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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))
|
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
|
return c, ready, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,11 @@ type players struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newPlayers() *players {
|
func newPlayers() *players {
|
||||||
return &players{
|
p := &players{
|
||||||
cond: sync.NewCond(&sync.Mutex{}),
|
cond: sync.NewCond(&sync.Mutex{}),
|
||||||
}
|
}
|
||||||
|
go p.loop()
|
||||||
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ps *players) shouldWait() bool {
|
func (ps *players) shouldWait() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user