VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "EAX3D"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Public Enum EaxEnvironmentConst
EAX_ENVIRONMENT_GENERIC = 0
EAX_ENVIRONMENT_PADDEDCELL = 1
EAX_ENVIRONMENT_ROOM = 2
EAX_ENVIRONMENT_BATHROOM = 3
EAX_ENVIRONMENT_LIVINGROOM = 4
EAX_ENVIRONMENT_STONEROOM = 5
EAX_ENVIRONMENT_AUDITORIUM = 6
EAX_ENVIRONMENT_CONCERTHALL = 7
EAX_ENVIRONMENT_CAVE = 8
EAX_ENVIRONMENT_ARENA = 9
EAX_ENVIRONMENT_HANGAR = 10
EAX_ENVIRONMENT_CARPETEDHALLWAY = 11
EAX_ENVIRONMENT_HALLWAY = 12
EAX_ENVIRONMENT_STONECORRIDOR = 13
EAX_ENVIRONMENT_ALLEY = 14
EAX_ENVIRONMENT_FOREST = 15
EAX_ENVIRONMENT_CITY = 16
EAX_ENVIRONMENT_MOUNTAINS = 17
EAX_ENVIRONMENT_QUARRY = 18
EAX_ENVIRONMENT_PLAIN = 19
EAX_ENVIRONMENT_PARKINGLOT = 20
EAX_ENVIRONMENT_SEWERPIPE = 21
EAX_ENVIRONMENT_UNDERWATER = 22
EAX_ENVIRONMENT_DRUGGED = 23
EAX_ENVIRONMENT_DIZZY = 24
EAX_ENVIRONMENT_PSYCHOTIC = 25
EAX_ENVIRONMENT_COUNT = 26 ' total number of environments
End Enum

Public Type BASS_3DVECTOR
    X As Single           ' +=right, -=left
    Y As Single           ' +=up, -=down
    z As Single           ' +=front, -=behind
End Type

Private Declare Function BASS_Set3DFactors Lib "bass.dll" (ByVal Distf As Single, ByVal Rollf As Single, ByVal Doppf As Single) As Long
Private Declare Function BASS_Get3DFactors Lib "bass.dll" (ByRef Distf As Single, ByRef Rollf As Single, ByRef Doppf As Single) As Long
Private Declare Function BASS_Set3DPosition Lib "bass.dll" (ByRef Pos As Any, ByRef Vel As Any, ByRef Front As Any, ByRef top As Any) As Long
Private Declare Function BASS_Get3DPosition Lib "bass.dll" (ByRef Pos As Any, ByRef Vel As Any, ByRef Front As Any, ByRef top As Any) As Long
Private Declare Function BASS_Apply3D Lib "bass.dll" () As Long
Private Declare Function BASS_SetEAXParameters Lib "bass.dll" (ByVal Env As Long, ByVal Vol As Single, ByVal Decay As Single, ByVal Damp As Single) As Long
Private Declare Function BASS_GetEAXParameters Lib "bass.dll" (ByRef Env As Long, ByRef Vol As Single, ByRef Decay As Single, ByRef Damp As Single) As Long


Dim mdistf As Single
Dim mrollf As Single
Dim mdoppf As Single
Dim mpos As BASS_3DVECTOR
Dim mvel As BASS_3DVECTOR
Dim mfront As BASS_3DVECTOR
Dim mtop As BASS_3DVECTOR
Dim menv As Long
Dim mvol As Single
Dim mdecay As Single
Dim mdamp As Single

Sub Apply3D()
BASS_Apply3D
End Sub

Function Get3DFactors() As Boolean
Get3DFactors = BASS_Get3DFactors(mdistf, mrollf, mdoppf)
End Function

Function Get3DPosition() As Boolean
Get3DPosition = BASS_Get3DPosition(mpos, mvel, mfront, mtop)
End Function

Function GetEAXParameters() As Boolean
GetEAXParameters = BASS_GetEAXParameters(menv, mvol, mdecay, mdamp)
End Function

Function Set3DFactors(Distf As Single, Rollf As Single, Doppf As Single) As Boolean
Set3DFactors = BASS_Set3DFactors(Distf, Rollf, Doppf)
End Function

Function Set3DPosition(ByRef Pos As BASS_3DVECTOR, ByRef Vel As BASS_3DVECTOR, ByRef Front As BASS_3DVECTOR, ByRef Top_ As BASS_3DVECTOR) As Boolean
Set3DPosition = BASS_Set3DPosition(Pos, Vel, Front, Top_)
End Function
Function SetEAXParameters(Env As EaxEnvironmentConst, Vol As Single, Decay As Single, Damp As Single) As Boolean
SetEAXParameters = BASS_SetEAXParameters(Env, Vol, Decay, Damp)
End Function

Property Get Distf() As Single
Distf = mdistf
End Property

Property Get Rollf() As Single
Rollf = mrollf
End Property

Property Get Doppf() As Single
Doppf = mdoppf
End Property

Property Get Pos() As BASS_3DVECTOR
Pos = mpos
End Property
Property Get Vel() As BASS_3DVECTOR
Vel = mvel
End Property

Property Get Front() As BASS_3DVECTOR
Front = mfront
End Property

Property Get Top_() As BASS_3DVECTOR
Top_ = mtop
End Property

Property Get Env() As EaxEnvironmentConst
Env = menv
End Property

Property Get Vol() As Single
Vol = mvol
End Property

Property Get Decay() As Single
Decay = mdecay
End Property

Property Get Damp() As Single
Damp = mdamp
End Property

Public Function BassSetEAXPreset(ByVal preset As EaxEnvironmentConst) As Boolean
        ' This function is a workaround, because VB doesn't support multiple comma seperated
        ' paramaters for each Public Const, simply pass the EAX_ENVIRONMENT_xxx value to this function
        ' instead of BASS_SetEAXParameters as you would do in C/C++
 Dim rt As Boolean
        
        rt = False
        
        Select Case preset
            Case EAX_ENVIRONMENT_GENERIC
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5)
            Case EAX_ENVIRONMENT_PADDEDCELL
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0)
            Case EAX_ENVIRONMENT_ROOM
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666)
            Case EAX_ENVIRONMENT_BATHROOM
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166)
            Case EAX_ENVIRONMENT_LIVINGROOM
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0)
            Case EAX_ENVIRONMENT_STONEROOM
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888)
            Case EAX_ENVIRONMENT_AUDITORIUM
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5)
            Case EAX_ENVIRONMENT_CONCERTHALL
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5)
            Case EAX_ENVIRONMENT_CAVE
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304)
            Case EAX_ENVIRONMENT_ARENA
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332)
            Case EAX_ENVIRONMENT_HANGAR
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10, 0.3)
            Case EAX_ENVIRONMENT_CARPETEDHALLWAY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2)
            Case EAX_ENVIRONMENT_HALLWAY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0)
            Case EAX_ENVIRONMENT_STONECORRIDOR
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638)
            Case EAX_ENVIRONMENT_ALLEY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776)
            Case EAX_ENVIRONMENT_FOREST
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472)
            Case EAX_ENVIRONMENT_CITY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224)
            Case EAX_ENVIRONMENT_MOUNTAINS
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472)
            Case EAX_ENVIRONMENT_QUARRY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5)
            Case EAX_ENVIRONMENT_PLAIN
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224)
            Case EAX_ENVIRONMENT_PARKINGLOT
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5)
            Case EAX_ENVIRONMENT_SEWERPIPE
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25)
            Case EAX_ENVIRONMENT_UNDERWATER
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0)
            Case EAX_ENVIRONMENT_DRUGGED
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388)
            Case EAX_ENVIRONMENT_DIZZY
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666)
            Case EAX_ENVIRONMENT_PSYCHOTIC
                rt = BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806)
        End Select
        
        BassSetEAXPreset = rt
        
    End Function
