// 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 }
// 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 }
// Renamed, was Sourcef. func (self Source) Setf(param int32, value float32) { C.alSourcef(C.ALuint(self), C.ALenum(param), C.ALfloat(value)) }
/* * Set Source parameters */ func (source Source) Sourcef(param ALenum, value float32) { C.alSourcef(C.ALuint(source), C.ALenum(param), C.ALfloat(value)) }
func alSourcef(s Source, k int, v float32) { C.alSourcef(C.ALuint(s), C.ALenum(k), C.ALfloat(v)) }
func (source Source) SetConeOuterGain(val float32) error { C.alSourcef(source.source, C.AL_CONE_OUTER_GAIN, C.ALfloat(C.float(val))) return GetError() }
func setSourcef(s Source, param int, v float32) { C.alSourcef(C.ALuint(s), C.ALenum(param), C.ALfloat(v)) }
func (source Source) SetMaxGain(val float32) error { C.alSourcef(source.source, C.AL_MAX_GAIN, C.ALfloat(C.float(val))) return GetError() }
func (source Source) SetReferenceDist(val float32) error { C.alSourcef(source.source, C.AL_REFERENCE_DISTANCE, C.ALfloat(C.float(val))) return GetError() }
func (source Source) SetRolloff(val float32) error { C.alSourcef(source.source, C.AL_ROLLOFF_FACTOR, C.ALfloat(C.float(val))) return GetError() }
func (source Source) SetMaxDist(val float32) error { C.alSourcef(source.source, C.AL_MAX_DISTANCE, C.ALfloat(C.float(val))) return GetError() }
func (source Source) SetPitch(val float32) error { C.alSourcef(source.source, C.AL_PITCH, C.ALfloat(C.float(val))) return GetError() }