Beispiel #1
0
func CloseDevice() error {
	al.DeleteBuffers(hwa.buf.bufs)
	al.DeleteSources(hwa.source)
	al.CloseDevice()
	hwa = nil
	return nil
}
Beispiel #2
0
func (c *Context) Close() {
	c.Lock()
	defer c.Unlock()
	al.StopSources(c.source)
	c.source.UnqueueBuffers(c.queue...)
	al.DeleteBuffers(c.queue...)
	c.queue = nil
	al.DeleteSources(c.source)
}
Beispiel #3
0
// 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) Close() error {
	if p == nil {
		return nil
	}
	if p.source != 0 {
		al.DeleteSources(p.source)
	}
	p.mu.Lock()
	if len(p.bufs) > 0 {
		al.DeleteBuffers(p.bufs...)
	}
	p.mu.Unlock()
	p.t.src.Close()
	return nil
}
Beispiel #4
0
// DestroyKey cleans up any resources for the key when destorying the key.
func (k *PianoKey) DestroyKey(glctx gl.Context) {
	glctx.DeleteBuffer(k.glBuf)
	al.DeleteSources(k.soundSources...)
	al.DeleteBuffers(k.soundBuffers)
	al.CloseDevice()
}