Attribute VB_Name = "Module1"
'---------------------BASS.DLL ENUMS------------------------

Public Enum BassObjectConst 'DirectSound interfaces (for use with BASS_GetDSoundObject) "
BASS_OBJECT_DS = 1                     ' DirectSound
BASS_OBJECT_DS3DL = 2                  'IDirectSound3DListener
End Enum

Public Enum BassDeviceInfoFlagsConst
BASS_DEVICE_ENABLED = 1
BASS_DEVICE_DEFAULT = 2
BASS_DEVICE_INIT = 4
End Enum

Public Enum BassInfoFlagsConst
DSCAPS_CONTINUOUSRATE = 16    ' supports all sample rates between min/maxrate
DSCAPS_EMULDRIVER = 32        ' device does NOT have hardware DirectSound support
DSCAPS_CERTIFIED = 64         ' device driver has been certified by Microsoft
DSCAPS_SECONDARYMONO = 256    ' mono
DSCAPS_SECONDARYSTEREO = 512  ' stereo
DSCAPS_SECONDARY8BIT = 1024   ' 8 bit
DSCAPS_SECONDARY16BIT = 2048  ' 16 bit
End Enum

Public Enum BassRecordInfoFlagsConst
DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER ' device does NOT have hardware DirectSound recording support
DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED   ' device driver has been certified by Microsoft
End Enum

Public Enum BassWaveFormatConst
WAVE_FORMAT_1M08 = &H1          ' 11.025 kHz, Mono,   8-bit
WAVE_FORMAT_1S08 = &H2          ' 11.025 kHz, Stereo, 8-bit
WAVE_FORMAT_1M16 = &H4          ' 11.025 kHz, Mono,   16-bit
WAVE_FORMAT_1S16 = &H8          ' 11.025 kHz, Stereo, 16-bit
WAVE_FORMAT_2M08 = &H10         ' 22.05  kHz, Mono,   8-bit
WAVE_FORMAT_2S08 = &H20         ' 22.05  kHz, Stereo, 8-bit
WAVE_FORMAT_2M16 = &H40         ' 22.05  kHz, Mono,   16-bit
WAVE_FORMAT_2S16 = &H80         ' 22.05  kHz, Stereo, 16-bit
WAVE_FORMAT_4M08 = &H100        ' 44.1   kHz, Mono,   8-bit
WAVE_FORMAT_4S08 = &H200        ' 44.1   kHz, Stereo, 8-bit
WAVE_FORMAT_4M16 = &H400        ' 44.1   kHz, Mono,   16-bit
WAVE_FORMAT_4S16 = &H800        ' 44.1   kHz, Stereo, 16-bit
End Enum

Public Enum BassSpeakerFlagsConst
BASS_SPEAKER_FRONT = &H1000000 ' front speakers
BASS_SPEAKER_REAR = &H2000000  ' rear/side speakers
BASS_SPEAKER_CENLFE = &H3000000 ' center & LFE speakers (5.1)
BASS_SPEAKER_REAR2 = &H4000000 ' rear center speakers (7.1)
BASS_SPEAKER_LEFT = &H10000000 ' modifier: left
BASS_SPEAKER_RIGHT = &H20000000 ' modifier: right
BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_LEFT
BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_RIGHT
BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR Or BASS_SPEAKER_LEFT
BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR Or BASS_SPEAKER_RIGHT
BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_LEFT
BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_RIGHT
BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_LEFT
BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_RIGHT
BASS_UNICODE = &H80000000
BASS_RECORD_PAUSE = 32768 ' start recording paused
End Enum

Public Enum BassVamFlagsConst
BASS_VAM_HARDWARE = 1
BASS_VAM_SOFTWARE = 2
BASS_VAM_TERM_TIME = 4
BASS_VAM_TERM_DIST = 8
BASS_VAM_TERM_PRIO = 16
End Enum

Public Enum BassCTypeConst
BASS_CTYPE_SAMPLE = 1
BASS_CTYPE_RECORD = 2
BASS_CTYPE_STREAM = &H10000
BASS_CTYPE_STREAM_OGG = &H10002
BASS_CTYPE_STREAM_MP1 = &H10003
BASS_CTYPE_STREAM_MP2 = &H10004
BASS_CTYPE_STREAM_MP3 = &H10005
BASS_CTYPE_STREAM_AIFF = &H10006
BASS_CTYPE_STREAM_WAV = &H40000 ' WAVE flag, LOWORD=codec
BASS_CTYPE_STREAM_WAV_PCM = &H50001
BASS_CTYPE_STREAM_WAV_FLOAT = &H50003
BASS_CTYPE_MUSIC_MOD = &H20000
BASS_CTYPE_MUSIC_MTM = &H20001
BASS_CTYPE_MUSIC_S3M = &H20002
BASS_CTYPE_MUSIC_XM = &H20003
BASS_CTYPE_MUSIC_IT = &H20004
BASS_CTYPE_MUSIC_MO3 = &H100
End Enum

Public Enum Bass3DModeConst
BASS_3DMODE_NORMAL = 0     ' normal 3D processing
BASS_3DMODE_RELATIVE = 1   ' position is relative to the listener
BASS_3DMODE_OFF = 2        ' no 3D processing
End Enum

Public Enum Bass3DAlgConst
BASS_3DALG_DEFAULT = 0
BASS_3DALG_OFF = 1
BASS_3DALG_FULL = 2
BASS_3DALG_LIGHT = 3
End Enum




Public Enum BassDataFlagsConst
BASS_DATA_AVAILABLE = 0         ' query how much data is buffered
BASS_DATA_FLOAT = &H40000000    ' flag: return floating-point sample data
BASS_DATA_FFT256 = &H80000000   ' 256 sample FFT
BASS_DATA_FFT512 = &H80000001   ' 512 FFT
BASS_DATA_FFT1024 = &H80000002  ' 1024 FFT
BASS_DATA_FFT2048 = &H80000003  ' 2048 FFT
BASS_DATA_FFT4096 = &H80000004  ' 4096 FFT
BASS_DATA_FFT8192 = &H80000005  ' 8192 FFT
BASS_DATA_FFT16384 = &H80000006 ' 16384 FFT
BASS_DATA_FFT_INDIVIDUAL = &H10 ' FFT flag: FFT for each channel, else all combined
BASS_DATA_FFT_NOWINDOW = &H20   ' FFT flag: no Hanning window
BASS_DATA_FFT_REMOVEDC = &H40   ' FFT flag: pre-remove DC bias
End Enum








'------------------BASS.DLL Types---------------

    Public Type BASS_PLUGINFORM
        ctype As Long         ' channel type
        name As Long          ' format description
        exts As Long          ' file extension filter (*.ext1;*.ext2;etc...)
    End Type


    
    Public Type BASS_FILEPROCS
        close_ As Long
        Length As Long
        read As Long
        Seek_ As Long
    End Type

    Public Type TAG_ID3
        id As String
        title As String
        artist As String
        album As String
        year As String
        comment As String
        genre As Byte
    End Type
    
    Public Type TAG_APE_BINARY
        key As Long
        Data As Long
        Length As Long
    End Type
    
    Public Type TAG_BEXT
        Description As String         ' description
        Originator As String            ' name of the originator
        OriginatorReference As String  ' reference of the originator
        OriginationDate As String       ' date of creation (yyyy-mm-dd)
        OriginationTime As String       ' time of creation (hh-mm-ss)
        TimeReferenceLo As Long             ' low 32 bits of first sample count since midnight (little-endian)
        TimeReferenceHi As Long             ' high 32 bits of first sample count since midnight (little-endian)
        Version As Integer                  ' BWF version (little-endian)
        UMID() As Byte               ' SMPTE UMID
        Reserved() As Byte
        CodingHistory() As String           ' history
    End Type
    
    Public Type BASS_DX8_CHORUS
        fWetDryMix As Single
        fDepth As Single
        fFeedback As Single
        fFrequency As Single
        lWaveform As Long   ' 0=triangle, 1=sine
        fDelay As Single
        lPhase As Long              ' BASS_DX8_PHASE_xxx
    End Type
    
    
    Public Type BASS_DX8_COMPRESSOR
        fGain As Single
        fAttack As Single
        fRelease As Single
        fThreshold As Single
        fRatio As Single
        fPredelay As Single
    End Type

    Public Type BASS_DX8_DISTORTION
        fGain As Single
        fEdge As Single
        fPostEQCenterFrequency As Single
        fPostEQBandwidth As Single
        fPreLowpassCutoff As Single
    End Type

    Public Type BASS_DX8_ECHO
        fWetDryMix As Single
        fFeedback As Single
        fLeftDelay As Single
        fRightDelay As Single
        lPanDelay As Long
    End Type

    Public Type BASS_DX8_FLANGER
        fWetDryMix As Single
        fDepth As Single
        fFeedback As Single
        fFrequency As Single
        lWaveform As Long   ' 0=triangle, 1=sine
        fDelay As Single
        lPhase As Long              ' BASS_DX8_PHASE_xxx
    End Type

    Public Type BASS_DX8_GARGLE
        dwRateHz As Long               ' Rate of modulation in hz
        dwWaveShape As Long            ' 0=triangle, 1=square
    End Type

    Public Type BASS_DX8_I3DL2REVERB
        lRoom As Long                    ' [-10000, 0]      default: -1000 mB
        lRoomHF As Long                  ' [-10000, 0]      default: 0 mB
        flRoomRolloffFactor As Single    ' [0.0, 10.0]      default: 0.0
        flDecayTime As Single            ' [0.1, 20.0]      default: 1.49s
        flDecayHFRatio As Single         ' [0.1, 2.0]       default: 0.83
        lReflections As Long             ' [-10000, 1000]   default: -2602 mB
        flReflectionsDelay As Single     ' [0.0, 0.3]       default: 0.007 s
        lReverb As Long                  ' [-10000, 2000]   default: 200 mB
        flReverbDelay As Single          ' [0.0, 0.1]       default: 0.011 s
        flDiffusion As Single            ' [0.0, 100.0]     default: 100.0 %
        flDensity As Single              ' [0.0, 100.0]     default: 100.0 %
        flHFReference As Single          ' [20.0, 20000.0]  default: 5000.0 Hz
    End Type

    Public Type BASS_DX8_PARAMEQ
        fCenter As Single
        fBandwidth As Single
        fGain As Single
    End Type

    Public Type BASS_DX8_REVERB
        fInGain As Single                ' [-96.0,0.0]            default: 0.0 dB
        fReverbMix As Single             ' [-96.0,0.0]            default: 0.0 db
        fReverbTime As Single            ' [0.001,3000.0]         default: 1000.0 ms
        fHighFreqRTRatio As Single       ' [0.001,0.999]          default: 0.001
    End Type
    
Public Type TAG_CART_TIMER
    dwUsage As Long
    dwValue As Long
End Type

Public Type TAG_CART
    Version As String
    title As String
    artist  As String
    CutID As String
    ClientID As String
    Category As String
    Classification As String
    OutCue As String
    StartDate As String
    StartTime As String
    EndDate As String
    EndTime As String
    ProducerAppID As String
    ProducerAppVersion As String
    UserDef As String
    dwLevelReference As Long
    PostTimer As TAG_CART_TIMER
    Reserved As String
    URL As String
    TagText() As String
End Type

Public Type TAG_CA_CODEC
    ftype As Long
    atype As Long
    name_ As String
End Type


'WIN32 API FUNCTIONS
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Long, ByRef Source As Long, ByVal Length As Long)
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long

'Self Callback
Public Const IDX_CALLBACKORDINAL As Long = 36

Public Declare Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As Long
Public Declare Function GetModuleHandleW Lib "kernel32" (ByVal lpModuleName As Long) As Long
Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Public Declare Function IsBadCodePtr Lib "kernel32" (ByVal lpfn As Long) As Long
Public Declare Sub RtlMoveMemory Lib "kernel32" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
Public Declare Function VirtualAlloc Lib "kernel32" (ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Public Declare Function VirtualFree Lib "kernel32" (ByVal lpAddress As Long, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long

Public Function GetAddressPtr(inPointer As Long) As Long
    GetAddressPtr = inPointer
End Function

Public Function BASS_SPEAKER_N(ByVal n As Long) As Long
    BASS_SPEAKER_N = n * (2 ^ 24)
End Function

Public Function LoByte(ByVal lparam As Long) As Long
        LoByte = lparam And &HFF&
End Function

Public Function HiByte(ByVal lparam As Long) As Long
        HiByte = (lparam And &HFF00&) / &H100&
End Function

Public Function LoWord(ByVal lparam As Long) As Long
        LoWord = lparam And &HFFFF&
End Function

Public Function HiWord(ByVal lparam As Long) As Long
        If lparam < 0 Then
            HiWord = (lparam \ &H10000 - 1) And &HFFFF&
        Else
            HiWord = lparam \ &H10000
        End If
End Function

Public Function MakeWord(ByVal LoByte As Long, ByVal HiByte As Long) As Long
        MakeWord = (LoByte And &HFF&) Or ((HiByte And &HFF&) * &H100&)
End Function

Public Function MakeLong(ByVal LoWord As Long, ByVal HiWord As Long) As Long
        MakeLong = LoWord And &HFFFF&
        HiWord = HiWord And &HFFFF&
        If HiWord And &H8000& Then
            MakeLong = MakeLong Or (((HiWord And &H7FFF&) * &H10000) Or &H80000000)
        Else
            MakeLong = MakeLong Or (HiWord * &H10000)
        End If
End Function

Public Function STREAMPROC(ByVal Handle As Long, ByVal Buffer As Long, ByVal Length As Long, ByVal User As Long) As Long

        'CALLBACK FUNCTION !!!

        ' User stream callback function
        ' NOTE: A stream function should obviously be as quick
        ' as possible, other streams (and MOD musics) can't be mixed until it's finished.
        ' handle : The stream that needs writing
        ' buffer : Buffer to write the samples in
        ' length : Number of bytes to write
        ' user   : The 'user' parameter value given when calling BASS_StreamCreate
        ' RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
        '          the stream.
        
        
        
        STREAMPROC = 0
End Function

Public Sub DOWNLOADPROC(ByVal Buffer As Long, ByVal Length As Long, ByVal User As Long)

    'CALLBACK FUNCTION !!!

    ' Internet stream download callback function.
    ' buffer : Buffer containing the downloaded data... NULL=end of download
    ' length : Number of bytes in the buffer
    ' user   : The 'user' parameter given when calling BASS_StreamCreateURL

End Sub

Public Sub SYNCPROC(ByVal Handle As Long, ByVal Channel As Long, ByVal Data As Long, ByVal User As Long)

    'CALLBACK FUNCTION !!!

    'Similarly in here, write what to do when sync function
    'is called, i.e screen flash etc.

    ' NOTE: a sync callback function should be very quick as other
    ' syncs cannot be processed until it has finished.
    ' handle : The sync that has occured
    ' channel: Channel that the sync occured in
    ' data   : Additional data associated with the sync's occurance
    ' user   : The 'user' parameter given when calling BASS_ChannelSetSync */

End Sub

Public Sub DSPPROC(ByVal Handle As Long, ByVal Channel As Long, ByVal Buffer As Long, ByVal Length As Long, ByVal User As Long)

    'CALLBACK FUNCTION !!!

    ' VB doesn't support pointers, so you should copy the buffer into an array,
    ' process it, and then copy it back into the buffer.

    ' DSP callback function. NOTE: A DSP function should obviously be as quick as
    ' possible... other DSP functions, streams and MOD musics can not be processed
    ' until it's finished.
    ' handle : The DSP handle
    ' channel: Channel that the DSP is being applied to
    ' buffer : Buffer to apply the DSP to
    ' length : Number of bytes in the buffer
    ' user   : The 'user' parameter given when calling BASS_ChannelSetDSP

End Sub

Public Function RECORDPROC(ByVal Handle As Long, ByVal Buffer As Long, ByVal Length As Long, ByVal User As Long) As Long
    'CALLBACK FUNCTION !!!

    ' Recording callback function.
    ' handle : The recording handle
    ' buffer : Buffer containing the recorded samples
    ' length : Number of bytes
    ' user   : The 'user' parameter value given when calling BASS_RecordStart
    ' RETURN : BASSTRUE = continue recording, BASSFALSE = stop
    RECORDPROC = 0
End Function

' User file stream callback functions (BASS_FILEPROCS)
Public Sub FILECLOSEPROC(ByVal User As Long)

End Sub

Public Function FILELENPROC(ByVal User As Long) As Long
    FILELENPROC = 0
End Function

Public Function FILEREADPROC(ByVal Buffer As Long, ByVal Length As Long, ByVal User As Long) As Long
    FILEREADPROC = 0
End Function

Public Function FILESEEKPROC(ByVal Offset As Long, ByVal OffSetHigh As Long, ByVal User As Long) As Long
    FILESEEKPROC = 0
End Function






