mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
examples/audioinfiniteloop: Use const to represent bytePerSample (#1867)
Co-authored-by: wasedaigo <daigo@odencat.com>
This commit is contained in:
parent
2815829200
commit
851733397e
@ -34,6 +34,7 @@ const (
|
||||
screenWidth = 640
|
||||
screenHeight = 480
|
||||
sampleRate = 22050
|
||||
bytesPerSample = 4 // 2 channels * 2 bytes (16 bit)
|
||||
|
||||
introLengthInSecond = 5
|
||||
loopLengthInSecond = 4
|
||||
@ -62,7 +63,7 @@ func (g *Game) Update() error {
|
||||
|
||||
// Create an infinite loop stream from the decoded bytes.
|
||||
// s is still an io.ReadCloser and io.Seeker.
|
||||
s := audio.NewInfiniteLoopWithIntro(oggS, introLengthInSecond*4*sampleRate, loopLengthInSecond*4*sampleRate)
|
||||
s := audio.NewInfiniteLoopWithIntro(oggS, introLengthInSecond*bytesPerSample*sampleRate, loopLengthInSecond*bytesPerSample*sampleRate)
|
||||
|
||||
g.player, err = g.audioContext.NewPlayer(s)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user