mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 06:24:27 +01:00
parent
df821f0177
commit
26feb26237
@ -26,7 +26,7 @@ func newContext(sampleRate int) (context, chan struct{}, error) {
|
|||||||
ChannelCount: channelCount,
|
ChannelCount: channelCount,
|
||||||
Format: oto.FormatFloat32LE,
|
Format: oto.FormatFloat32LE,
|
||||||
})
|
})
|
||||||
err = addErrorInfoForContextCreation(err)
|
err = addErrorInfo(err)
|
||||||
return &contextProxy{ctx}, ready, err
|
return &contextProxy{ctx}, ready, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// addErrorInfoForContextCreation adds an additional information to the error when creating an audio context.
|
// addErrorInfo adds an additional information to the error when creating an audio context.
|
||||||
// See also hajimehoshi/oto#93.
|
// See also ebitengine/oto#93.
|
||||||
func addErrorInfoForContextCreation(err error) error {
|
func addErrorInfo(err error) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
|
|
||||||
package audio
|
package audio
|
||||||
|
|
||||||
func addErrorInfoForContextCreation(err error) error {
|
func addErrorInfo(err error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func (f *playerFactory) suspend() error {
|
|||||||
if f.context == nil {
|
if f.context == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return f.context.Suspend()
|
return addErrorInfo(f.context.Suspend())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *playerFactory) resume() error {
|
func (f *playerFactory) resume() error {
|
||||||
@ -122,7 +122,7 @@ func (f *playerFactory) resume() error {
|
|||||||
if f.context == nil {
|
if f.context == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return f.context.Resume()
|
return addErrorInfo(f.context.Resume())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *playerFactory) error() error {
|
func (f *playerFactory) error() error {
|
||||||
@ -132,7 +132,7 @@ func (f *playerFactory) error() error {
|
|||||||
if f.context == nil {
|
if f.context == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return f.context.Err()
|
return addErrorInfo(f.context.Err())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *playerFactory) initContextIfNeeded() (<-chan struct{}, error) {
|
func (f *playerFactory) initContextIfNeeded() (<-chan struct{}, error) {
|
||||||
@ -263,7 +263,7 @@ func (p *playerImpl) Close() error {
|
|||||||
}()
|
}()
|
||||||
p.player.Pause()
|
p.player.Pause()
|
||||||
p.stopwatch.stop()
|
p.stopwatch.stop()
|
||||||
return p.player.Close()
|
return addErrorInfo(p.player.Close())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ func (p *playerImpl) SetPosition(offset time.Duration) error {
|
|||||||
|
|
||||||
pos := p.stream.timeDurationToPos(offset)
|
pos := p.stream.timeDurationToPos(offset)
|
||||||
if _, err := p.player.Seek(pos, io.SeekStart); err != nil {
|
if _, err := p.player.Seek(pos, io.SeekStart); err != nil {
|
||||||
return err
|
return addErrorInfo(err)
|
||||||
}
|
}
|
||||||
p.lastSamples = -1
|
p.lastSamples = -1
|
||||||
// Just after setting a position, the buffer size should be 0 as no data is sent.
|
// Just after setting a position, the buffer size should be 0 as no data is sent.
|
||||||
@ -312,7 +312,7 @@ func (p *playerImpl) Err() error {
|
|||||||
if p.player == nil {
|
if p.player == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return p.player.Err()
|
return addErrorInfo(p.player.Err())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *playerImpl) SetBufferSize(bufferSize time.Duration) {
|
func (p *playerImpl) SetBufferSize(bufferSize time.Duration) {
|
||||||
|
Loading…
Reference in New Issue
Block a user