Example #1
0
// SetPosition
// (https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_82.html)
func SetPosition(channel int, angle int16, distance uint8) error {
	_channel := (C.int)(channel)
	_angle := (C.Sint16)(angle)
	_distance := (C.Uint8)(distance)
	if (C.Mix_SetPosition(_channel, _angle, _distance)) == 0 {
		return sdl.GetError()
	}
	return nil
}
Example #2
0
func SetPosition(channel int, angle int16, distance uint8) bool {
	_channel := (C.int)(channel)
	_angle := (C.Sint16)(angle)
	_distance := (C.Uint8)(distance)
	return int(C.Mix_SetPosition(_channel, _angle, _distance)) == 0
}
Example #3
0
// Set the position of a channel. (angle) is an integer from 0 to 360, that
// specifies the location of the sound in relation to the listener. (angle)
// will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260).
// Angle 0 is due north, and rotates clockwise as the value increases.
// For efficiency, the precision of this effect may be limited (angles 1
// through 7 might all produce the same effect, 8 through 15 are equal, etc).
// (distance) is an integer between 0 and 255 that specifies the space
// between the sound and the listener. The larger the number, the further
// away the sound is. Using 255 does not guarantee that the channel will be
// culled from the mixing process or be completely silent. For efficiency,
// the precision of this effect may be limited (distance 0 through 5 might
// all produce the same effect, 6 through 10 are equal, etc). Setting (angle)
// and (distance) to 0 unregisters this effect, since the data would be
// unchanged.
//
// If the audio device is configured for mono output, then you won't get
// any effectiveness from the angle; however, distance attenuation on the
// channel will still occur. While this effect will function with stereo
// voices, it makes more sense to use voices with only one channel of sound,
// so when they are mixed through this effect, the positioning will sound
// correct. You can convert them to mono through SDL before giving them to
// the mixer in the first place if you like.
// This is a convenience wrapper over SetDistance() and SetPanning().
//
// returns zero if error,
// nonzero if position effect is enabled.
// Error messages can be retrieved from Mix_GetError().
func SetPosition(channel int, angle int16, distance uint8) (int) {  
 return int(C.Mix_SetPosition(C.int(channel), C.Sint16(angle), 
              C.Uint8(distance)))
}