BASS.NET API for the Un4seen BASS Audio Library

BassBASS_Get3DPosition Method

BASS.NET API for the Un4seen BASS Audio Library
Retrieves the position, velocity, and orientation of the listener.

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[DllImportAttribute("bass")]
public static bool BASS_Get3DPosition(
	BASS_3DVECTOR pos,
	BASS_3DVECTOR vel,
	BASS_3DVECTOR front,
	BASS_3DVECTOR top
)

Parameters

pos
Type: Un4seen.BassBASS_3DVECTOR
The position of the listener... = don't retrieve it.
vel
Type: Un4seen.BassBASS_3DVECTOR
The listener's velocity... = don't retrieve it.
front
Type: Un4seen.BassBASS_3DVECTOR
The direction that the listener's front is pointing... =don't retrieve it.
top
Type: Un4seen.BassBASS_3DVECTOR
The direction that the listener's top is pointing... = don't retrieve it.

Return Value

Type: Boolean
If succesful, then is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

The front and top parameters must both be retrieved in a single call, they can not be retrieved individually.

When using multiple devices, the current thread's device setting (as set with BASS_SetDevice(Int32)) determines which device this function call applies to.

ERROR CODEDescription
BASS_ERROR_INITBASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr) has not been successfully called.
BASS_ERROR_NO3DThe device was not initialized with 3D support.

Examples

Get the current listener position only:
BASS_3DVECTOR pos = new BASS_3DVECTOR();
Bass.BASS_Get3DPosition(pos, null, null, null);
Updates the position, velocity and top of the listener:
BASS_3DVECTOR position = new BASS_3DVECTOR(camera.RealPosition.x, camera.RealPosition.y, camera.RealPosition.z);
BASS_3DVECTOR direction = new BASS_3DVECTOR(camera.RealDirection.x, camera.RealDirection.y, camera.RealDirection.z);
BASS_3DVECTOR up = new BASS_3DVECTOR(-camera.RealUp.x, -camera.RealUp.y, -camera.RealUp.z);

if (!Bass.BASS_Set3DPosition(position, velocity, direction, up))
    throw new AudioException("Could not set the 3d position of the listener", "listener", Bass.BASS_ErrorGetCode());

Bass.BASS_Apply3D();
See Also

Reference