examples/wav: Use 48000 Hz

Updates #1649
This commit is contained in:
Hajime Hoshi 2021-05-25 22:09:43 +09:00
parent c0e12450df
commit ac526b1b83

View File

@ -31,7 +31,7 @@ import (
const ( const (
screenWidth = 640 screenWidth = 640
screenHeight = 480 screenHeight = 480
sampleRate = 44100 sampleRate = 48000
) )
type Game struct { type Game struct {
@ -46,13 +46,13 @@ func init() {
// Initialize audio context. // Initialize audio context.
g.audioContext = audio.NewContext(sampleRate) g.audioContext = audio.NewContext(sampleRate)
// In this example, embedded resource "Jab_wav" is used. // In this example, embedded resource "Jab48000_wav" is used.
// //
// If you want to use a wav file, open this and pass the file stream to wav.Decode. // If you want to use a wav file, open this and pass the file stream to wav.Decode.
// Note that file's Close() should not be closed here // Note that file's Close() should not be closed here
// since audio.Player manages stream state. // since audio.Player manages stream state.
// //
// f, err := os.Open("jab.wav") // f, err := os.Open("jab48000.wav")
// if err != nil { // if err != nil {
// return err // return err
// } // }
@ -61,7 +61,7 @@ func init() {
// ... // ...
// Decode wav-formatted data and retrieve decoded PCM stream. // Decode wav-formatted data and retrieve decoded PCM stream.
d, err := wav.Decode(g.audioContext, bytes.NewReader(raudio.Jab_wav)) d, err := wav.Decode(g.audioContext, bytes.NewReader(raudio.Jab48000_wav))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }