mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
audio: No need for loop in audio_openal; alSource's state might be al.Initial
This commit is contained in:
parent
1ded7dc6b8
commit
25665f5035
@ -87,7 +87,7 @@ func (p *player) proceed() error {
|
|||||||
p.alBuffers = append(p.alBuffers, bufs...)
|
p.alBuffers = append(p.alBuffers, bufs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for 0 < len(p.alBuffers) {
|
if 0 < len(p.alBuffers) {
|
||||||
n, err := p.source.Read(tmpBuffer)
|
n, err := p.source.Read(tmpBuffer)
|
||||||
if 0 < n {
|
if 0 < n {
|
||||||
buf := p.alBuffers[0]
|
buf := p.alBuffers[0]
|
||||||
@ -101,12 +101,9 @@ func (p *player) proceed() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if n == 0 {
|
|
||||||
time.Sleep(1 * time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.alSource.State() == al.Stopped {
|
if p.alSource.State() == al.Stopped || p.alSource.State() == al.Initial {
|
||||||
al.RewindSources(p.alSource)
|
al.RewindSources(p.alSource)
|
||||||
al.PlaySources(p.alSource)
|
al.PlaySources(p.alSource)
|
||||||
if err := al.Error(); err != 0 {
|
if err := al.Error(); err != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user