audio: Start implementing with OpenAL (not finished yet)

This commit is contained in:
Hajime Hoshi 2015-01-24 22:19:10 +09:00
parent 2d5ac9e987
commit a8e3b2b619
2 changed files with 20 additions and 2 deletions

View File

@ -110,7 +110,6 @@ func loadChannelBuffers() (l, r []float32) {
inputL[i] += ch.l[i] inputL[i] += ch.l[i]
inputR[i] += ch.r[i] inputR[i] += ch.r[i]
} }
// TODO: Use copyFromChannel?
usedLen := min(bufferSize, len(ch.l)) usedLen := min(bufferSize, len(ch.l))
ch.l = ch.l[usedLen:] ch.l = ch.l[usedLen:]
ch.r = ch.r[usedLen:] ch.r = ch.r[usedLen:]

View File

@ -16,8 +16,27 @@
package audio package audio
import (
"github.com/timshannon/go-openal/openal"
"runtime"
)
func initialize() { func initialize() {
// TODO: Implement ch := make(chan struct{})
go func() {
runtime.LockOSThread()
device := openal.OpenDevice("")
context := device.CreateContext()
context.Activate()
buffer := openal.NewBuffer()
//buffer.SetData(openal.FormatStereo16)
_ = buffer
close(ch)
}()
<-ch
} }
func start() { func start() {