Ejemplo n.º 1
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
}
Ejemplo n.º 2
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
}
Ejemplo n.º 3
0
// Renamed, was Sourcef.
func (self Source) Setf(param int32, value float32) {
	C.alSourcef(C.ALuint(self), C.ALenum(param), C.ALfloat(value))
}
Ejemplo n.º 4
0
Archivo: source.go Proyecto: nzlov/goal
/*
 * Set Source parameters
 */
func (source Source) Sourcef(param ALenum, value float32) {
	C.alSourcef(C.ALuint(source), C.ALenum(param), C.ALfloat(value))
}
Ejemplo n.º 5
0
func alSourcef(s Source, k int, v float32) {
	C.alSourcef(C.ALuint(s), C.ALenum(k), C.ALfloat(v))
}
Ejemplo n.º 6
0
func (source Source) SetConeOuterGain(val float32) error {
	C.alSourcef(source.source, C.AL_CONE_OUTER_GAIN, C.ALfloat(C.float(val)))
	return GetError()
}
Ejemplo n.º 7
0
Archivo: al.go Proyecto: Miaque/mojo
func setSourcef(s Source, param int, v float32) {
	C.alSourcef(C.ALuint(s), C.ALenum(param), C.ALfloat(v))
}
Ejemplo n.º 8
0
func (source Source) SetMaxGain(val float32) error {
	C.alSourcef(source.source, C.AL_MAX_GAIN, C.ALfloat(C.float(val)))
	return GetError()
}
Ejemplo n.º 9
0
func (source Source) SetReferenceDist(val float32) error {
	C.alSourcef(source.source, C.AL_REFERENCE_DISTANCE, C.ALfloat(C.float(val)))
	return GetError()
}
Ejemplo n.º 10
0
func (source Source) SetRolloff(val float32) error {
	C.alSourcef(source.source, C.AL_ROLLOFF_FACTOR, C.ALfloat(C.float(val)))
	return GetError()
}
Ejemplo n.º 11
0
func (source Source) SetMaxDist(val float32) error {
	C.alSourcef(source.source, C.AL_MAX_DISTANCE, C.ALfloat(C.float(val)))
	return GetError()
}
Ejemplo n.º 12
0
func (source Source) SetPitch(val float32) error {
	C.alSourcef(source.source, C.AL_PITCH, C.ALfloat(C.float(val)))
	return GetError()
}