From 65448200326d964ebea1e093b21107a7890fb4a8 Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Mon, 6 Apr 2015 15:57:04 -0400 Subject: [PATCH] audio/al: don't define MakeContextCurrent on the pointer It's a common requirement to call MakeContextCurrent with a nil value before destroying a context. Nil value as a reciever is not as user- friendly as a standalone MakeContextCurrent. Change-Id: I537ec0330657ef134f97a3c3b0d32793012eee86 Reviewed-on: https://go-review.googlesource.com/8500 Reviewed-by: Hyang-Ah Hana Kim --- audio/al/alc.go | 2 +- audio/audio.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/al/alc.go b/audio/al/alc.go index 0b6123f..c924044 100644 --- a/audio/al/alc.go +++ b/audio/al/alc.go @@ -52,7 +52,7 @@ func (d *Device) CreateContext(attrs []int32) *Context { // MakeContextCurrent makes a context current. The context available // process-wide, you don't need to lock the current OS thread to // access the current context. -func (c *Context) MakeContextCurrent() bool { +func MakeContextCurrent(c *Context) bool { return alcMakeContextCurrent(c.ptr) } diff --git a/audio/audio.go b/audio/audio.go index 17661e1..bc8d5a5 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -120,7 +120,7 @@ func NewPlayer(src io.ReadSeeker, format Format, samplesPerSecond int64) (*Playe if device.d == nil { device.d = al.Open("") c := device.d.CreateContext(nil) - if !c.MakeContextCurrent() { + if !al.MakeContextCurrent(c) { return nil, fmt.Errorf("audio: cannot initiate a new player") } }