From 8ef52841bc9a6268905cc93dcc8b13c3d06fddbd Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 9 Jan 2023 18:45:36 +0900 Subject: [PATCH] audio: use NewContextWithOptions Upates #2534 --- audio/context.go | 8 ++++++-- audio/player.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/audio/context.go b/audio/context.go index fbb8a9679..e2d173085 100644 --- a/audio/context.go +++ b/audio/context.go @@ -20,8 +20,12 @@ import ( "github.com/hajimehoshi/oto/v2" ) -func newContext(sampleRate, channelCount, bitDepthInBytes int) (context, chan struct{}, error) { - ctx, ready, err := oto.NewContext(sampleRate, channelCount, bitDepthInBytes) +func newContext(sampleRate int) (context, chan struct{}, error) { + ctx, ready, err := oto.NewContextWithOptions(&oto.NewContextOptions{ + SampleRate: sampleRate, + ChannelCount: channelCount, + Format: bitDepthInBytes, + }) err = addErrorInfoForContextCreation(err) return &contextProxy{ctx}, ready, err } diff --git a/audio/player.go b/audio/player.go index 4612e9c6f..7db66b380 100644 --- a/audio/player.go +++ b/audio/player.go @@ -124,7 +124,7 @@ func (f *playerFactory) initContextIfNeeded() (<-chan struct{}, error) { return nil, nil } - c, ready, err := newContext(f.sampleRate, channelCount, bitDepthInBytes) + c, ready, err := newContext(f.sampleRate) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 7649fa864..debb15932 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b github.com/hajimehoshi/bitmapfont/v2 v2.2.3 github.com/hajimehoshi/go-mp3 v0.3.4 - github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230107095450-7e07d2d07898 + github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230109090240-83efbbaa8024 github.com/jakecoffman/cp v1.2.1 github.com/jezek/xgb v1.1.0 github.com/jfreymuth/oggvorbis v1.0.4 diff --git a/go.sum b/go.sum index cd4b15624..f6ca3fb00 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/hajimehoshi/bitmapfont/v2 v2.2.3/go.mod h1:sWM8ejdkGSXaQGlZcegMRx4DyE github.com/hajimehoshi/go-mp3 v0.3.4 h1:NUP7pBYH8OguP4diaTZ9wJbUbk3tC0KlfzsEpWmYj68= github.com/hajimehoshi/go-mp3 v0.3.4/go.mod h1:fRtZraRFcWb0pu7ok0LqyFhCUrPeMsGRSVop0eemFmo= github.com/hajimehoshi/oto/v2 v2.3.1/go.mod h1:seWLbgHH7AyUMYKfKYT9pg7PhUu9/SisyJvNTT+ASQo= -github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230107095450-7e07d2d07898 h1:vXa8jrvtwSYYoCg10X0xcpE84Tqw6HfvYkMoNKRnma4= -github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230107095450-7e07d2d07898/go.mod h1:wre+KgbOrKDXpgk6W/JC6KoFqZnVC/VtX5ZFRkJuxO4= +github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230109090240-83efbbaa8024 h1:o9DkHJHwms3ZlLTpZ9psAfY9ttSCTltSlzj3XwEliw0= +github.com/hajimehoshi/oto/v2 v2.4.0-alpha.10.0.20230109090240-83efbbaa8024/go.mod h1:wre+KgbOrKDXpgk6W/JC6KoFqZnVC/VtX5ZFRkJuxO4= github.com/jakecoffman/cp v1.2.1 h1:zkhc2Gpo9l4NLUZfeG3j33+3bQD7MkqPa+n5PdX+5mI= github.com/jakecoffman/cp v1.2.1/go.mod h1:JjY/Fp6d8E1CHnu74gWNnU0+b9VzEdUVPoJxg2PsTQg= github.com/jezek/xgb v1.1.0 h1:wnpxJzP1+rkbGclEkmwpVFQWpuE2PUGNUzP8SbfFobk=