mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 15:04:28 +01:00
examples/audiopanning: Bug fix: Fix several issues
* The stream was not looped. * The shown position was wrong. Closes #1502
This commit is contained in:
parent
29099cf660
commit
a13930650d
@ -71,7 +71,7 @@ func (g *Game) initAudio() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrap the raw audio with the StereoPanStream
|
// Wrap the raw audio with the StereoPanStream
|
||||||
g.panstream = NewStereoPanStreamFromReader(oggS)
|
g.panstream = NewStereoPanStreamFromReader(audio.NewInfiniteLoop(oggS, oggS.Length()))
|
||||||
|
|
||||||
g.player, err = audio.NewPlayer(audioContext, g.panstream)
|
g.player, err = audio.NewPlayer(audioContext, g.panstream)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -99,9 +99,6 @@ func (g *Game) Update() error {
|
|||||||
|
|
||||||
func (g *Game) Draw(screen *ebiten.Image) {
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
pos := g.player.Current()
|
pos := g.player.Current()
|
||||||
if pos > 5*time.Second {
|
|
||||||
pos = (g.player.Current()-5*time.Second)%(4*time.Second) + 5*time.Second
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf(`TPS: %0.2f
|
msg := fmt.Sprintf(`TPS: %0.2f
|
||||||
This is an example using
|
This is an example using
|
||||||
stereo audio panning.
|
stereo audio panning.
|
||||||
|
Loading…
Reference in New Issue
Block a user