Exemplo n.º 1
0
func (source Source) SetLooping(isLooping bool) error {
	var i int
	if isLooping {
		i = 1
	} else {
		i = 0
	}
	C.alSourcei(source.source, C.AL_LOOPING, C.ALint(C.int(i)))
	return GetError()
}
Exemplo n.º 2
0
func (source Source) SetSourceRelative(isRelative bool) error {
	var i int
	if isRelative {
		i = 1
	} else {
		i = 0
	}
	C.alSourcei(source.source, C.AL_SOURCE_RELATIVE, C.ALint(C.int(i)))
	return GetError()
}
Exemplo n.º 3
0
// Play will play the sound. Volume ( 1.0 is normal volume, 0 is silence )
// Returns the PlayInstance that can be used to stop the source while playing
func (s *Sound) Play(volume float32) (request PlayInstance) {
	source, err := requestSource()
	if err != nil {
		return request
	}
	C.alSourcef(source.id, C.AL_GAIN, C.ALfloat(volume))
	C.alSourcei(source.id, C.AL_SOURCE_RELATIVE, C.AL_TRUE)
	C.alSource3f(source.id, C.AL_POSITION, 0, 0, 0)
	C.alSourcei(source.id, C.AL_BUFFER, C.ALint(s.buffer))

	source.setToPlay()
	request.id = source.requestId
	request.src = source
	return request
}
Exemplo n.º 4
0
// Play will play the sound at a given position, the falloff distance in which the sound's volume is cut in half,
// and the volume ( 1.0 is normal volume, 0 is silence )
// It will return the PlayInstance that can be used to stop the source while playing
// Remember that in order for the 3D audio to work properly that the audio needs to be all in one channel, not stereo!
func (s *Sound) Play3D(x, y, z, falloff, volume float32) (request PlayInstance) {
	source, err := requestSource()
	if err != nil {
		return request
	}
	C.alSourcef(source.id, C.AL_GAIN, C.ALfloat(volume))
	C.alSourcei(source.id, C.AL_SOURCE_RELATIVE, C.AL_FALSE)
	C.alSourcef(source.id, C.AL_REFERENCE_DISTANCE, C.ALfloat(falloff))
	C.alSource3f(source.id, C.AL_POSITION, C.ALfloat(x), C.ALfloat(y), C.ALfloat(z))
	C.alSourcei(source.id, C.AL_BUFFER, C.ALint(s.buffer))

	source.setToPlay()
	request.id = source.requestId
	request.src = source
	return request
}
Exemplo n.º 5
0
func alSourcei(s Source, k int, v int32) {
	C.alSourcei(C.ALuint(s), C.ALenum(k), C.ALint(v))
}
Exemplo n.º 6
0
func (source Source) SetConeOuterAngle(i int) error {
	C.alSourcei(source.source, C.AL_CONE_OUTER_ANGLE, C.ALint(C.int(i)))
	return GetError()
}
Exemplo n.º 7
0
// Renamed, was Listener3i.
func (self Listener) Set3i(param int32, value1, value2, value3 int32) {
	C.alListener3i(C.ALenum(param), C.ALint(value1), C.ALint(value2), C.ALint(value3))
}
Exemplo n.º 8
0
// TODO: can't pass buffer really...
func (self *Source) SetAttr(param int, value *Buffer) {
	C.alSourcei(self.handle, C.ALenum(param), C.ALint(value.handle))
}
Exemplo n.º 9
0
// Renamed, was Sourcei.
func (self Source) Seti(param int32, value int32) {
	C.alSourcei(C.ALuint(self), C.ALenum(param), C.ALint(value))
}
Exemplo n.º 10
0
Arquivo: buffer.go Projeto: nzlov/goal
func (buffer Buffer) Buffer3i(
	param ALenum, value1, value2, value3 int) {
	C.alBuffer3i(
		C.ALuint(buffer), C.ALenum(param),
		C.ALint(value1), C.ALint(value2), C.ALint(value3))
}
Exemplo n.º 11
0
Arquivo: buffer.go Projeto: nzlov/goal
func (buffer Buffer) Bufferi(param ALenum, value int) {
	C.alBufferi(C.ALuint(buffer), C.ALenum(param), C.ALint(value))
}
Exemplo n.º 12
0
Arquivo: al.go Projeto: Miaque/mojo
func setSourcei(s Source, param int, v int32) {
	C.alSourcei(C.ALuint(s), C.ALenum(param), C.ALint(v))
}
Exemplo n.º 13
0
func (source Source) SetState(state SourceState) error {
	C.alSourcei(source.source, C.AL_SOURCE_STATE, C.ALint(state))
	return GetError()
}
Exemplo n.º 14
0
func (source Source) ClearBuffer(buf Buffer) error {
	C.alSourcei(source.source, C.AL_BUFFER, C.ALint(C.int(0)))
	return GetError()
}
Exemplo n.º 15
0
func (source Source) SetBuffer(buf Buffer) error {
	C.alSourcei(source.source, C.AL_BUFFER, C.ALint(buf.buffer))
	return GetError()
}
Exemplo n.º 16
0
// Renamed, was Bufferi.
func (self Buffer) seti(param int32, value int32) {
	C.alBufferi(C.ALuint(self), C.ALenum(param), C.ALint(value))
}
Exemplo n.º 17
0
// Renamed, was Buffer3i.
func (self Buffer) set3i(param int32, value1, value2, value3 int32) {
	C.alBuffer3i(C.ALuint(self), C.ALenum(param), C.ALint(value1), C.ALint(value2), C.ALint(value3))
}
Exemplo n.º 18
0
Arquivo: source.go Projeto: nzlov/goal
func (source Source) Sourcei(param ALenum, value int) {
	C.alSourcei(C.ALuint(source), C.ALenum(param), C.ALint(value))
}
Exemplo n.º 19
0
// Renamed, was Source3i.
func (self Source) Set3i(param int32, value1, value2, value3 int32) {
	C.alSource3i(C.ALuint(self), C.ALenum(param), C.ALint(value1), C.ALint(value2), C.ALint(value3))
}
Exemplo n.º 20
0
Arquivo: source.go Projeto: nzlov/goal
func (source Source) Source3i(
	param ALenum, value1, value2, value3 int) {
	C.alSource3i(
		C.ALuint(source), C.ALenum(param),
		C.ALint(value1), C.ALint(value2), C.ALint(value3))
}
Exemplo n.º 21
0
// Renamed, was Listeneri.
func (self Listener) Seti(param int32, value int32) {
	C.alListeneri(C.ALenum(param), C.ALint(value))
}
Exemplo n.º 22
0
func Listeneri(param ALenum, value int) {
	C.alListeneri(C.ALenum(param), C.ALint(value))
}
Exemplo n.º 23
0
func alSourcei(s Source, k int, v int32) {
	C.call_alSourcei(alSourcefFunc, C.ALuint(s), C.ALenum(k), C.ALint(v))
}
Exemplo n.º 24
0
func Listener3i(param ALenum, value1, value2, value3 int) {
	C.alListener3i(C.ALenum(param), C.ALint(value1), C.ALint(value2), C.ALint(value3))
}