mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
examples: Bug fix: updating audio context should sync with updating logic
This commit is contained in:
parent
7bb917d4f6
commit
91b5d985fe
@ -182,6 +182,9 @@ func update(screen *ebiten.Image) error {
|
||||
musicPlayer.updateSE()
|
||||
musicPlayer.updateVolume()
|
||||
}
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
@ -227,9 +230,6 @@ Press Z or X to change volume of the music
|
||||
}
|
||||
}
|
||||
ebitenutil.DebugPrint(screen, msg)
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,9 @@ func update(screen *ebiten.Image) error {
|
||||
}
|
||||
addNote(220*math.Exp2(float64(i-1)/12.0), 1.0)
|
||||
}
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
@ -202,10 +205,6 @@ func update(screen *ebiten.Image) error {
|
||||
screen.DrawImage(imagePiano, nil)
|
||||
|
||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS()))
|
||||
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ func update(screen *ebiten.Image) error {
|
||||
}
|
||||
player.Play()
|
||||
}
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
msg := fmt.Sprintf("FPS: %0.2f\nThis is an example using infinite audio stream.", ebiten.CurrentFPS())
|
||||
ebitenutil.DebugPrint(screen, msg)
|
||||
if err := audioContext.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user