mobile/audio: rename (*Player).Destroy to (*Player).Close
Destroy sounds like C, we should use Close in Go. Change-Id: I73da732300a955e458513f15ad898b7f34c8ed7c Reviewed-on: https://go-review.googlesource.com/9875 Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
parent
2aa4da50c5
commit
d861c4af68
@ -302,11 +302,12 @@ func (p *Player) State() State {
|
||||
return codeToState[p.source.State()]
|
||||
}
|
||||
|
||||
// Destroy frees the underlying resources used by the player.
|
||||
// Close closes the device and frees the underlying resources
|
||||
// used by the player.
|
||||
// It should be called as soon as the player is not in-use anymore.
|
||||
func (p *Player) Destroy() {
|
||||
func (p *Player) Close() error {
|
||||
if p == nil {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
if p.source != 0 {
|
||||
al.DeleteSources(p.source)
|
||||
@ -317,6 +318,7 @@ func (p *Player) Destroy() {
|
||||
}
|
||||
p.mu.Unlock()
|
||||
p.t.src.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
func byteOffsetToDur(t *track, offset int64) time.Duration {
|
||||
@ -336,4 +338,4 @@ func lastErr() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO(jbd): Destroy context, close the device.
|
||||
// TODO(jbd): Close the device.
|
||||
|
@ -36,5 +36,5 @@ func TestNoOp(t *testing.T) {
|
||||
}
|
||||
p.SetVolume(0.1)
|
||||
p.Seek(1 * time.Second)
|
||||
p.Destroy()
|
||||
p.Close()
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ func start() {
|
||||
}
|
||||
|
||||
func stop() {
|
||||
player.Destroy()
|
||||
player.Close()
|
||||
}
|
||||
|
||||
func draw() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user