BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_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.12.0
Syntax

[DllImportAttribute("bass.dll", CharSet = CharSet.Unicode)]
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:
VB
Dim pos As New BASS_3DVECTOR()
Bass.BASS_Get3DPosition(pos, Nothing, Nothing, Nothing)
BASS_3DVECTOR pos = new BASS_3DVECTOR();
Bass.BASS_Get3DPosition(pos, null, null, null);
Updates the position, velocity and top of the listener:
VB
Dim position As New BASS_3DVECTOR(camera.RealPosition.x, camera.RealPosition.y, camera.RealPosition.z)
Dim direction As New BASS_3DVECTOR(camera.RealDirection.x, camera.RealDirection.y, camera.RealDirection.z)
Dim up As New BASS_3DVECTOR(-camera.RealUp.x, -camera.RealUp.y, -camera.RealUp.z)

If Not Bass.BASS_Set3DPosition(position, velocity, direction, up) Then
    Throw New AudioException("Could not set the 3d position of the listener", "listener", Bass.BASS_ErrorGetCode())
End If

Bass.BASS_Apply3D()
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