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 <hyangah@gmail.com>
This commit is contained in:
parent
c2bf90dc60
commit
6544820032
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue