VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Channel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'Private Type BASS_3DVECTOR
'    X As Single           ' +=right, -=left
'    Y As Single           ' +=up, -=down
'    z As Single           ' +=front, -=behind
'End Type

Type BASS_CHANNELINFO
    Freq As Long          ' default playback rate
    chans As Long         ' channels
    Flags As Long         ' BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
    ctype As Long         ' type of channel
    origres As Long       ' original resolution
    Plugin As Long        ' plugin
    Sample As Long        ' sample
    filename As Long      ' filename
End Type

Public Enum BassSyncConst
BASS_SYNC_POS = 0
BASS_SYNC_END = 2
BASS_SYNC_META = 4
BASS_SYNC_SLIDE = 5
BASS_SYNC_STALL = 6
BASS_SYNC_DOWNLOAD = 7
BASS_SYNC_FREE = 8
BASS_SYNC_SETPOS = 11
BASS_SYNC_MUSICPOS = 10
BASS_SYNC_MUSICINST = 1
BASS_SYNC_MUSICFX = 3
BASS_SYNC_OGG_CHANGE = 12
BASS_SYNC_MIXTIME = &H40000000 ' FLAG: sync at mixtime, else at playtime
BASS_SYNC_ONETIME = &H80000000 ' FLAG: sync only once, else continuously
End Enum

Public Enum BassAttribConst
BASS_ATTRIB_FREQ = 1
BASS_ATTRIB_VOL = 2
BASS_ATTRIB_PAN = 3
BASS_ATTRIB_EAXMIX = 4
BASS_ATTRIB_NOBUFFER = 5
BASS_ATTRIB_CPU = 7
BASS_ATTRIB_MUSIC_AMPLIFY = &H100
BASS_ATTRIB_MUSIC_PANSEP = &H101
BASS_ATTRIB_MUSIC_PSCALER = &H102
BASS_ATTRIB_MUSIC_BPM = &H103
BASS_ATTRIB_MUSIC_SPEED = &H104
BASS_ATTRIB_MUSIC_VOL_Public = &H105
BASS_ATTRIB_MUSIC_VOL_CHAN = &H200 ' + channel #
BASS_ATTRIB_MUSIC_VOL_INST = &H300 ' + instrument #
End Enum

Public Enum BassPositionConst
BASS_POS_BYTE = 0          ' byte position
BASS_POS_MUSIC_ORDER = 1   ' order.row position, MAKELONG(order,row)
BASS_POS_DECODE = &H10000000 ' flag: get the decoding (not playing) position
BASS_POS_DECODETO = &H20000000 ' flag: decode to the position instead of seeking
BASS_POS_OGG = 3           ' OGG bitstream number
BASS_POS_INEXACT = &H8000000 ' flag: allow seeking to inexact position
BASS_POS_SCAN = &H40000000 ' flag: scan to the position
End Enum

Public Enum BassLevelConst
BASS_LEVEL_ALL = 0
BASS_LEVEL_MONO = 1
BASS_LEVEL_STEREO = 2
BASS_LEVEL_RMS = 4
End Enum

Public Enum BassActiveConst
BASS_ACTIVE_STOPPED = 0
BASS_ACTIVE_PLAYING = 1
BASS_ACTIVE_STALLED = 2
BASS_ACTIVE_PAUSED = 3
End Enum

Public Enum BassTagConst
BASS_TAG_ID3 = 0                ' ID3v1 tags : TAG_ID3 Type
BASS_TAG_ID3V2 = 1              ' ID3v2 tags : variable length block
BASS_TAG_OGG = 2                ' OGG comments : series of null-terminated UTF-8 strings
BASS_TAG_HTTP = 3               ' HTTP headers : series of null-terminated ANSI strings
BASS_TAG_ICY = 4                ' ICY headers : series of null-terminated ANSI strings
BASS_TAG_META = 5               ' ICY metadata : ANSI string
BASS_TAG_APE = 6                ' APEv2 tags : series of null-terminated UTF-8 strings
BASS_TAG_MP4 = 7                ' MP4/iTunes metadata : series of null-terminated UTF-8 strings
BASS_TAG_VENDOR = 9             ' OGG encoder : UTF-8 string
BASS_TAG_LYRICS3 = 10           ' Lyric3v2 tag : ASCII string
BASS_TAG_CA_CODEC = 11          ' CoreAudio codec info : TAG_CA_CODEC Type
BASS_TAG_MF = 13                ' Media Foundation tags : series of null-terminated UTF-8 strings
BASS_TAG_WAVEFORMAT = 14        ' WAVE format : WAVEFORMATEEX Type
BASS_TAG_RIFF_INFO = &H100      ' RIFF "INFO" tags : series of null-terminated ANSI strings
BASS_TAG_RIFF_BEXT = &H101      ' RIFF/BWF "bext" tags : TAG_BEXT Type
BASS_TAG_RIFF_CART = &H102      ' RIFF/BWF "cart" tags : TAG_CART Type
BASS_TAG_RIFF_DISP = &H103      ' RIFF "DISP" text tag : ANSI string
BASS_TAG_APE_BINARY = &H1000    ' + index #, binary APEv2 tag : TAG_APE_BINARY Type
BASS_TAG_MUSIC_NAME = &H10000   ' MOD music name : ANSI string
BASS_TAG_MUSIC_ORDERS = &H10002 ' MOD order list : BYTE array of pattern numbers
BASS_TAG_MUSIC_MESSAGE = &H10001 ' MOD message : ANSI string
BASS_TAG_MUSIC_INST = &H10100   ' + instrument #, MOD instrument name : ANSI string
BASS_TAG_MUSIC_SAMPLE = &H10300 ' + sample #, MOD sample name : ANSI string
End Enum

Private Declare Function BASS_ChannelBytes2Seconds64 Lib "bass.dll" Alias "BASS_ChannelBytes2Seconds" (ByVal Handle As Long, ByVal Pos As Long, ByVal poshigh As Long) As Double
Private Declare Function BASS_ChannelSeconds2Bytes Lib "bass.dll" (ByVal Handle As Long, ByVal Pos As Double) As Long
Private Declare Function BASS_ChannelGetDevice Lib "bass.dll" (ByVal Handle As Long) As Long
Private Declare Function BASS_ChannelSetDevice Lib "bass.dll" (ByVal Handle As Long, ByVal Device As Long) As Long
Private Declare Function BASS_ChannelIsActive Lib "bass.dll" (ByVal Handle As Long) As Long
Private Declare Function BASS_ChannelGetInfo Lib "bass.dll" (ByVal Handle As Long, ByRef info As BASS_CHANNELINFO) As Long
Private Declare Function BASS_ChannelGetTags Lib "bass.dll" (ByVal Handle As Long, ByVal Tags As Long) As Long
Private Declare Function BASS_ChannelFlags Lib "bass.dll" (ByVal Handle As Long, ByVal Flags As Long, ByVal Mask As Long) As Long
Private Declare Function BASS_ChannelUpdate Lib "bass.dll" (ByVal Handle As Long, ByVal Length As Long) As Long
Private Declare Function BASS_ChannelLock Lib "bass.dll" (ByVal Handle As Long, ByVal lock_ As Long) As Long
Private Declare Function BASS_ChannelPlay Lib "bass.dll" (ByVal Handle As Long, ByVal Restart As Long) As Long
Private Declare Function BASS_ChannelStop Lib "bass.dll" (ByVal Handle As Long) As Long
Private Declare Function BASS_ChannelPause Lib "bass.dll" (ByVal Handle As Long) As Long
Private Declare Function BASS_ChannelSetAttribute Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long, ByVal Value As Single) As Long
Private Declare Function BASS_ChannelGetAttribute Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long, ByRef Value As Single) As Long
Private Declare Function BASS_ChannelSlideAttribute Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long, ByVal Value As Single, ByVal time As Long) As Long
Private Declare Function BASS_ChannelIsSliding Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long) As Long
Private Declare Function BASS_ChannelSetAttributeEx Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long, ByRef Value As Any, ByVal Size As Long) As Long
Private Declare Function BASS_ChannelGetAttributeEx Lib "bass.dll" (ByVal Handle As Long, ByVal Attrib As Long, ByRef Value As Any, ByVal Size As Long) As Long
Private Declare Function BASS_ChannelSet3DAttributes Lib "bass.dll" (ByVal Handle As Long, ByVal Mode As Long, ByVal Min As Single, ByVal Max As Single, ByVal iAngle As Long, ByVal oAngle As Long, ByVal OutVol As Single) As Long
Private Declare Function BASS_ChannelGet3DAttributes Lib "bass.dll" (ByVal Handle As Long, ByRef Mode As Long, ByRef Min As Single, ByRef Max As Single, ByRef iAngle As Long, ByRef oAngle As Long, ByRef OutVol As Single) As Long
Private Declare Function BASS_ChannelSet3DPosition Lib "bass.dll" (ByVal Handle As Long, ByRef Pos As Any, ByRef Orient As Any, ByRef Vel As Any) As Long
Private Declare Function BASS_ChannelGet3DPosition Lib "bass.dll" (ByVal Handle As Long, ByRef Pos As Any, ByRef Orient As Any, ByRef Vel As Any) As Long
Private Declare Function BASS_ChannelGetLength Lib "bass.dll" (ByVal Handle As Long, ByVal Mode As Long) As Long
Private Declare Function BASS_ChannelSetPosition64 Lib "bass.dll" Alias "BASS_ChannelSetPosition" (ByVal Handle As Long, ByVal Pos As Long, ByVal poshigh As Long, ByVal Mode As Long) As Long
Private Declare Function BASS_ChannelGetPosition Lib "bass.dll" (ByVal Handle As Long, ByVal Mode As Long) As Long
Private Declare Function BASS_ChannelGetLevel Lib "bass.dll" (ByVal Handle As Long) As Long
Private Declare Function BASS_ChannelGetLevelEx Lib "bass.dll" (ByVal Handle As Long, ByRef levels As Single, ByVal Length As Single, ByVal Flags As Long) As Long
Private Declare Function BASS_ChannelGetData Lib "bass.dll" (ByVal Handle As Long, ByRef buffer As Any, ByVal Length As Long) As Long
Private Declare Function BASS_ChannelSetSync64 Lib "bass.dll" Alias "BASS_ChannelSetSync" (ByVal Handle As Long, ByVal Type_ As Long, ByVal Param As Long, ByVal paramhigh As Long, ByVal proc As Long, ByVal User As Long) As Long
Private Declare Function BASS_ChannelRemoveSync Lib "bass.dll" (ByVal Handle As Long, ByVal sync As Long) As Long
Private Declare Function BASS_ChannelSetDSP Lib "bass.dll" (ByVal Handle As Long, ByVal proc As Long, ByVal User As Long, ByVal Priority As Long) As Long
Private Declare Function BASS_ChannelRemoveDSP Lib "bass.dll" (ByVal Handle As Long, ByVal dsp As Long) As Long
Private Declare Function BASS_ChannelSetLink Lib "bass.dll" (ByVal Handle As Long, ByVal chan As Long) As Long
Private Declare Function BASS_ChannelRemoveLink Lib "bass.dll" (ByVal Handle As Long, ByVal chan As Long) As Long
Private Declare Function BASS_ChannelSetFX Lib "bass.dll" (ByVal Handle As Long, ByVal Type_ As Long, ByVal Priority As Long) As Long
Private Declare Function BASS_ChannelRemoveFX Lib "bass.dll" (ByVal Handle As Long, ByVal FX As Long) As Long

Function GetBytes2Seconds(Handle As Long, Pos As Long) As Single
GetBytes2Seconds = BASS_ChannelBytes2Seconds64(Handle, Pos, 0)
End Function

Function SetChannelFlags(Handle As Long, Flags As Long, Mask As Long) As Long
SetChannelFlags = BASS_ChannelFlags(Handle, Flags, Mask)
End Function

Function Get3DAttributes(Handle As Long, ByRef Mode As Long, ByRef Min As Single, Max As Single, ByRef iAngle As Long, ByRef oAngle As Long, ByRef OutVol As Single) As Boolean
Get3DAttributes = BASS_ChannelGet3DAttributes(Handle, Mode, Min, Max, iAngle, oAngle, OutVol)
End Function

Function Get3DPosition(Handle As Long, ByRef Pos As BASS_3DVECTOR, ByRef Orient As BASS_3DVECTOR, ByRef Vel As BASS_3DVECTOR) As Boolean
Get3DPosition = BASS_ChannelGet3DPosition(Handle, Pos, Orient, Vel)
End Function

Function GetAttribute(Handle As Long, Attrib As Long) As Single

Dim tmp As Single
Dim bl As BassBooleanConst

bl = BASS_ChannelGetAttribute(Handle, Attrib, tmp)

GetAttribute = tmp

End Function

Function GetAttributeEx(Handle As Long, Attrib As Long, Size As Long)
Dim tmp
Dim ret As Long

ret = BASS_ChannelGetAttributeEx(Handle, Attrib, tmp, Size)

GetAttributeEx = tmp

End Function

Function GetData(Handle As Long, Length As Long)
Dim tmp
Dim ret As Long

ret = BASS_ChannelGetData(Handle, tmp, Length)

GetData = tmp

End Function

Function GetDevice(Handle As Long) As Long
GetDevice = BASS_ChannelGetDevice(Handle)
End Function

Function GetInfo(Handle As Long, ByRef info As BASS_CHANNELINFO) As BASS_CHANNELINFO
Dim bl As BassBooleanConst
Dim tmp As BASS_CHANNELINFO

bl = BASS_ChannelGetInfo(Handle, tmp)

GetInfo = tmp

End Function

Function GetLength(Handle As Long, Mode As BassPositionConst) As Long
GetLength = BASS_ChannelGetLength(Handle, Mode)
End Function

Function GetLevel(Handle As Long) As Long
GetLevel = BASS_ChannelGetLevel(Handle)
End Function

Function GetLevelEx(Handle As Long, Length As Long, Flags As BassLevelConst) As Single

Dim bl As BassBooleanConst
Dim lvl As Single

bl = BASS_ChannelGetLevelEx(Handle, lvl, Length, Flags)

GetLevelEx = lvl

End Function

Function GetPosition(Handle As Long, Mode As BassPositionConst) As Long
GetPosition = BASS_ChannelGetPosition(Handle, Mode)
End Function

Function GetTags(Handle As Long, Tags As BassTagConst) As String
GetTags = BASS_ChannelGetTags(Handle, Tags)
End Function

Function ActiveState(Handle As Long) As BassActiveConst
ActiveState = BASS_ChannelIsActive(Handle)
End Function

Function IsSliding(Handle As Long, Mode As BassAttribConst) As Boolean
IsSliding = BASS_ChannelIsSliding(Handle, Mode)
End Function

Function lock_(Handle As Long, Mode As BassBooleanConst) As Boolean
lock_ = BASS_ChannelLock(Handle, Mode)
End Function

Function Pause(Handle As Long) As Boolean
Pause = BASS_ChannelPause(Handle)
End Function

Function Play(Handle As Long, Optional Restart As BassBooleanConst = BASS_FALSE) As Boolean
Play = BASS_ChannelPlay(Handle, Restart)
End Function

Function RemoveDSP(Handle As Long, HandleDsp As Long) As Boolean
RemoveDSP = BASS_ChannelRemoveDSP(Handle, HandleDsp)
End Function

Function RemoveFX(Handle As Long, HandleFx As Long) As Boolean
RemoveFX = BASS_ChannelRemoveFX(Handle, HandleFx)
End Function

Function RemoveLink(Handle As Long, HandleChannel As Long) As Boolean
RemoveLink = BASS_ChannelRemoveLink(Handle, HandleChannel)
End Function

Function RemoveSync(Handle As Long, HandleSync As Long) As Boolean
RemoveSync = BASS_ChannelRemoveSync(Handle, HandleSync)
End Function

Function Seconds2Bytes(Handle As Long, Pos As Single) As Long
Seconds2Bytes = BASS_ChannelSeconds2Bytes(Handle, Pos)
End Function

Function Set3DAttributes(Handle As Long, ByRef Mode As Integer, ByRef Min As Single, Max As Single, ByRef iAngle As Integer, ByRef oAngle As Integer, ByRef OutVol As Single) As Boolean
Set3DAttributes = BASS_ChannelSet3DAttributes(Handle, Mode, Min, Max, iAngle, oAngle, OutVol)
End Function

Function Set3DPosition(Handle As Long, ByRef Pos As BASS_3DVECTOR, ByRef Orient As BASS_3DVECTOR, ByRef Vel As BASS_3DVECTOR) As Boolean
Set3DPosition = BASS_ChannelSet3DPosition(Handle, Pos, Orient, Vel)
End Function

Function SetAttribute(Handle As Long, Attrib As Long, ByRef Value As Single) As Boolean
SetAttribute = BASS_ChannelSetAttribute(Handle, Attrib, Value)
End Function

Function SetAttributeEx(Handle As Long, Attrib As Long, ByRef Value, Size As Long) As Boolean
SetAttributeEx = BASS_ChannelSetAttributeEx(Handle, Attrib, Value, Size)
End Function

Function SetDevice(Handle As Long, Device As Long) As Boolean
SetDevice = BASS_ChannelSetDevice(Handle, Device)
End Function

Function SetDSP(Handle As Long, ByRef User, Priority As Integer) As Long
SetDSP = BASS_ChannelSetDSP(Handle, AddressOf DSPPROC, User, Priority)
End Function

Function SetFX(Handle As Long, Type_ As BassDX8_FXConst, Priority As Integer) As Long
SetFX = BASS_ChannelSetFX(Handle, Type_, Priority)
End Function

Function SetLink(Handle As Long, Channel As Long) As Boolean
SetLink = BASS_ChannelSetLink(Handle, Channel)
End Function

Function SetPosition(Handle As Long, Pos As Long, Mode As Long) As Boolean
SetPosition = BASS_ChannelSetPosition64(Handle, Pos, 0, Mode)
End Function

Function SetSync(Handle As Long, Type_ As Long, Param As BassSyncConst, paramhigh As BassSyncConst, Optional ByRef User = 0) As Long
SetSync = BASS_ChannelSetSync64(Handle, Type_, Param, paramhigh, AddressOf SYNCPROC, User)
End Function

Function SlideAttribute(Handle As Long, Attrib As BassAttribConst, Value As Single, Time_ As Long) As Boolean
SlideAttribute = BASS_ChannelSlideAttribute(Handle, Attrib, Value, Time_)
End Function

Function Stop_(Handle As Long) As Boolean
Stop_ = BASS_ChannelStop(Handle)
End Function

Function Update(Handle As Long, Length As Long) As Boolean
Update = BASS_ChannelUpdate(Handle, Length)
End Function
