func initSourceList() { for i, _ := range sourceList { C.alGenSources(1, &sourceList[i].id) sourceList[i].occupied = false sourceList[i].isPlaying = false } sourceChannel = make(chan int) go func() { var state C.ALint for { select { case _, ok := <-sourceChannel: if !ok { return } default: for i, src := range sourceList { if sourceList[i].occupied == true && sourceList[i].isPlaying == true { C.alGetSourcei(src.id, C.AL_SOURCE_STATE, &state) if state != C.AL_PLAYING { sourceList[i].occupied = false sourceList[i].isPlaying = false } } } } } }() }
func (source Source) IsSourceRelative() (bool, error) { var val C.ALint C.alGetSourcei(source.source, C.AL_SOURCE_RELATIVE, &val) if val == C.AL_TRUE { return true, GetError() } else { return false, GetError() } }
func alGetSourcei(s Source, k int) int32 { var v C.ALint C.alGetSourcei(C.ALuint(s), C.ALenum(k), &v) return int32(v) }
func (source Source) GetSourcei(param ALenum) (value int32) { C.alGetSourcei(C.ALuint(source), C.ALenum(param), (*C.ALint)(&value)) return }
func getSourcei(s Source, param int) int32 { var v C.ALint C.alGetSourcei(C.ALuint(s), C.ALenum(param), &v) return int32(v) }
func (source Source) BuffersProcessed() (int, error) { var val C.ALint C.alGetSourcei(source.source, C.AL_BUFFERS_PROCESSED, &val) return int(C.int(val)), GetError() }
func (source Source) BuffersQueued() (int, error) { var val C.ALint C.alGetSourcei(source.source, C.AL_BUFFERS_QUEUED, &val) return int(C.int(val)), GetError() }
func (source Source) GetSourceState() (SourceState, error) { var val C.ALint C.alGetSourcei(source.source, C.AL_BUFFER, &val) return SourceState(val), GetError() }
func (source Source) GetBuffer() (Buffer, error) { var buf Buffer C.alGetSourcei(source.source, C.AL_BUFFER, (*C.ALint)(unsafe.Pointer(&buf.buffer))) return buf, GetError() }