Beispiel #1
0
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
						}
					}
				}
			}
		}
	}()
}
Beispiel #2
0
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()
	}
}
Beispiel #3
0
func alGetSourcei(s Source, k int) int32 {
	var v C.ALint
	C.alGetSourcei(C.ALuint(s), C.ALenum(k), &v)
	return int32(v)
}
Beispiel #4
0
func (source Source) GetSourcei(param ALenum) (value int32) {
	C.alGetSourcei(C.ALuint(source), C.ALenum(param), (*C.ALint)(&value))
	return
}
Beispiel #5
0
Datei: al.go Projekt: Miaque/mojo
func getSourcei(s Source, param int) int32 {
	var v C.ALint
	C.alGetSourcei(C.ALuint(s), C.ALenum(param), &v)
	return int32(v)
}
Beispiel #6
0
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()
}
Beispiel #7
0
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()
}
Beispiel #8
0
func (source Source) GetSourceState() (SourceState, error) {
	var val C.ALint
	C.alGetSourcei(source.source, C.AL_BUFFER, &val)
	return SourceState(val), GetError()
}
Beispiel #9
0
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()
}