Solved

How to write an equalizer

Posted on 1997-08-20
11
924 Views
Last Modified: 2012-05-04
I have a CD player program written.  Users request me to add LED bars, you know, those graphical analyser, to the program.  I'd like to know how I can do  a Left/Right channel graphical analyser like
http://www.jps.net/sanctuary/dbmeter1.gif

That's all the points I got, sorry...


0
Comment
Question by:fury
  • 5
  • 4
  • 2
11 Comments
 

Author Comment

by:fury
Comment Utility
Edited text of question
0
 
LVL 5

Expert Comment

by:y96andha
Comment Utility
I have some tips on how to implement it on Win95 systems, not a complete code for it, but a little something that you could try if you'd like.
0
 

Author Comment

by:fury
Comment Utility
Yes sure...please
0
 
LVL 2

Accepted Solution

by:
msiman earned 50 total points
Comment Utility
the answer is in two steps:
a) use WaveOutGetVolume, to get the volume of the sound
b) create, lets say 10 bars in different colors
now get the max volume, the min volume and divide it by
10. eg. min=0 max=1000 so each step is 100
now for 300, the fisrt 3 should be visible,
for 400 the fisrt 4 and so on...
hope this answers your question...
0
 
LVL 5

Expert Comment

by:y96andha
Comment Utility
I am not sure if msiman's answer is good, so I'll wait and let you comment on it. It lets you retrieve the setting of the volume control.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:fury
Comment Utility
But when I play CD, the volume LED bar at the WAV section of the volume control display nothing.

does CD audio output as WAVE?
0
 
LVL 2

Expert Comment

by:msiman
Comment Utility
yeah, i think y96xxx is right.... the volume stays the
same... sorry, please reject my answer,
i m very sorry for locking the question...
MSIMAN
0
 
LVL 5

Expert Comment

by:y96andha
Comment Utility
CD-audio doesn't output as wave. There are two ways to do this: If you are lucky, the sound card might have a built-in meter for the output level from the CD that you can read and display. Otherwise you have to sample the data in short intervals and calculate an averaged amplitude to display.

If there is a built-in meter, you can use a series of functions described in http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630002206, whose solution I could post here.

If you need to sample data, you should use functions described in http://www.experts-exchange.com/topics/bin/Q.8630011161, unfortunately not completely solved yet, but I could post info on that one here too.

0
 

Author Comment

by:fury
Comment Utility
I don't have much points..please post all u can. please...
0
 
LVL 5

Expert Comment

by:y96andha
Comment Utility
I'll begin with how to read values from built-in meters. Try this code and see what info can be read from your sound card.

-------------------------------------------------------------------------
VERSION 4.00
Begin VB.Form Form1
    Caption = "Form1"
    ClientHeight = 8115
    ClientLeft = 585
    ClientTop = 720
    ClientWidth = 9990
    Height = 8520
    Left = 525
    LinkTopic = "Form1"
    ScaleHeight = 8115
    ScaleWidth = 9990
    Top = 375
    Width = 10110
    Begin VB.CommandButton Command1
    Caption = "Update"
    Height = 255
    Left = 8280
    TabIndex = 0
    Top = 120
    Width = 1215
    End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False

'
Private Sub Command1_Click()
Cls
Dim ml As MIXERLINE
Dim mcs As MIXERCAPS
Dim mlc As MIXERLINECONTROLS
Dim mc As MIXERCONTROL
Dim mcd As MIXERCONTROLDETAILS
Dim buf(4096) As Byte
mcsize = LenB(mc) '17 * 4 + MIXER_SHORT_NAME_CHARS + MIXER_LONG_NAME_CHARS

Dim status As Long
For i = 0 To mixerGetNumDevs - 1
    status = mixerGetDevCaps(i, mcs, LenB(mcs))
' Print "mixerGetDevCaps"; status
    Print "mixer "; s(mcs.szPname)
    For j = 0 To mcs.cDestinations - 1
    ml.cbStruct = LenB(ml)
    ml.dwDestination = j
    ml.dwSource = 0
    status = mixerGetLineInfo(i, ml, MIXER_GETLINEINFOF_DESTINATION)
' Print " mixerGetLineInfo "; status
    Print " destination line "; s(ml.szShortName); " = '"; s(ml.szName); "', controls: "; ml.cControls; ", connections: "; ml.cConnections
    mlc.cbStruct = LenB(mlc)
    mlc.dwLineID = ml.dwLineID
    mlc.cControls = ml.cControls
    mlc.cbmxctrl = LenB(mc)
    mlc.pamxctrl = String(LenB(mc) * ml.cControls, 0)
    status = mixerGetLineControls(i, mlc, MIXER_GETLINECONTROLSF_ALL)
    ' Print " mixerGetLineControls "; status
    For k = 0 To ml.cControls - 1
    mc.dwControlID = tolong(Mid$(mlc.pamxctrl, k * mcsize + 1 + 4))
    mc.dwControlType = tolong(Mid$(mlc.pamxctrl, k * mcsize + 1 + 2 * 4))
    mc.szShortName = Mid$(mlc.pamxctrl, k * mcsize + 1 + 5 * 4, MIXER_SHORT_NAME_CHARS)
    mc.szName = Mid$(mlc.pamxctrl, k * mcsize + 1 + 5 * 4 + MIXER_SHORT_NAME_CHARS, MIXER_LONG_NAME_CHARS)
' Print mc.szShortName
    ' Print mc.szName
' Print hex$(mc.dwControlID)
    ' Print hex$(mc.dwControlType)
    Print " control "; s(mc.szShortName); " = '"; s(mc.szName); "', ";
   
    Print "parsed type=[";
   
    If mc.fdwControl & MIXERCONTROL_CONTROLF_UNIFORM Then
    Print "Uniform ";
    End If
   
    Select Case (mc.dwControlType And MIXERCONTROL_CT_CLASS_MASK)
    Case MIXERCONTROL_CT_CLASS_CUSTOM
    Print "Custom ";
    Case MIXERCONTROL_CT_CLASS_FADER
    Print "Fader ";
    Case MIXERCONTROL_CT_CLASS_LIST
    Print "List ";
    Case MIXERCONTROL_CT_CLASS_METER
    Print "Meter ";
    Case MIXERCONTROL_CT_CLASS_NUMBER
    Print "Number ";
    Case MIXERCONTROL_CT_CLASS_SLIDER
    Print "Slider ";
    Case MIXERCONTROL_CT_CLASS_SWITCH
    Print "Switch ";
    Case MIXERCONTROL_CT_CLASS_TIME
    Print "Time ";
    Case Else
    Print "Unknown ("; hex$(mc.dwControlType And MIXERCONTROL_CT_CLASS_MASK); ") "
    End Select
   
    Select Case mc.dwControlType
    Case MIXERCONTROL_CONTROLTYPE_MIXER
    Print "Mixer ";
    Case MIXERCONTROL_CONTROLTYPE_MUX
    Print "Mux ";
    Case MIXERCONTROL_CONTROLTYPE_PEAKMETER
    Print "PeakMeter ";
    mcd.cbStruct = Len(mcd)
    mcd.dwControlID = mc.dwControlID
    If mc.fdwControl & MIXERCONTROL_CONTROLF_UNIFORM Then
    mcd.cChannels = 1
    Else
    mcd.cChannels = ml.cChannels
    End If
    mcd.cbDetails = 4
    mcd.item = 0
    mcd.paDetails = String(4 * mcd.cChannels, 0)
    status = mixerGetControlDetails(i, mcd, MIXER_GETCONTROLDETAILSF_VALUE)
    For m = 1 To mcd.cChannels
    Print "peak["; m; "]="; tolong(Mid$(mcd.paDetails, m * 4 - 3)); " ";
    Next m
    Case MIXERCONTROL_CONTROLTYPE_ONOFF
    Print "OnOff ";
    Case MIXERCONTROL_CONTROLTYPE_MUTE
    Print "Mute ";
    Case MIXERCONTROL_CONTROLTYPE_MONO
    Print "Mono ";
    Case MIXERCONTROL_CONTROLTYPE_LOUDNESS
    Print "Loudness ";
    Case MIXERCONTROL_CONTROLTYPE_STEREOENH
    Print "StereoEnh ";
    Case MIXERCONTROL_CONTROLTYPE_VOLUME
    Print "Volume ";
    Case MIXERCONTROL_CONTROLTYPE_BASS
    Print "Bass ";
    Case MIXERCONTROL_CONTROLTYPE_TREBLE
    Print "Treble ";
    Case MIXERCONTROL_CONTROLTYPE_EQUALIZER
    Print "Equalizer ";
    Case MIXERCONTROL_CONTROLTYPE_PAN
    Print "Pan ";
    Case MIXERCONTROL_CONTROLTYPE_QSOUNDPAN
    Print "QSoundPan ";
    End Select
   
   
    Print "]"
   
    Next k
   
    For l = 0 To ml.cConnections - 1
    ml.dwSource = l
    status = mixerGetLineInfo(i, ml, MIXER_GETLINEINFOF_SOURCE)
' Print " mixerGetLineInfo "; status
    Print " source line "; s(ml.szShortName); " = '"; s(ml.szName); "', channels: "; ml.cChannels; ", controls: "; ml.cControls
   
    mlc.cbStruct = Len(mlc)
    mlc.dwLineID = ml.dwLineID
    mlc.cControls = ml.cControls
    mlc.cbmxctrl = LenB(mc)
    mlc.pamxctrl = String(LenB(mc) * ml.cControls, 0)
    status = mixerGetLineControls(i, mlc, MIXER_GETLINECONTROLSF_ALL)
' Print " mixerGetLineControls "; status
    For k = 0 To ml.cControls - 1
    mc.dwControlID = tolong(Mid$(mlc.pamxctrl, k * mcsize + 1 + 4))
    mc.dwControlType = tolong(Mid$(mlc.pamxctrl, k * mcsize + 1 + 2 * 4))
    mc.fdwControl = tolong(Mid$(mlc.pamxctrl, k * mcsize + 1 + 3 * 4))
    mc.szShortName = Mid$(mlc.pamxctrl, k * mcsize + 1 + 5 * 4, MIXER_SHORT_NAME_CHARS)
    mc.szName = Mid$(mlc.pamxctrl, k * mcsize + 1 + 5 * 4 + MIXER_SHORT_NAME_CHARS, MIXER_LONG_NAME_CHARS)
    ' Print mc.szShortName
    ' Print mc.szName
    ' Print hex$(mc.dwControlID)
    ' Print hex$(mc.dwControlType)
    Print " control "; s(mc.szShortName); " = '"; s(mc.szName); "', ";
   
    Print "parsed type=[";
   
    If mc.fdwControl & MIXERCONTROL_CONTROLF_UNIFORM Then
    Print "Uniform ";
    End If

   
    Select Case (mc.dwControlType And MIXERCONTROL_CT_CLASS_MASK)
    Case MIXERCONTROL_CT_CLASS_CUSTOM
    Print "Custom ";
    Case MIXERCONTROL_CT_CLASS_FADER
    Print "Fader ";
    Case MIXERCONTROL_CT_CLASS_LIST
    Print "List ";
    Case MIXERCONTROL_CT_CLASS_METER
    Print "Meter ";
    Case MIXERCONTROL_CT_CLASS_NUMBER
    Print "Number ";
    Case MIXERCONTROL_CT_CLASS_SLIDER
    Print "Slider ";
    Case MIXERCONTROL_CT_CLASS_SWITCH
    Print "Switch ";
    Case MIXERCONTROL_CT_CLASS_TIME
    Print "Time ";
    Case Else
    Print "Unknown ("; hex$(mc.dwControlType And MIXERCONTROL_CT_CLASS_MASK); ") "
    End Select
   
    Select Case mc.dwControlType
    Case MIXERCONTROL_CONTROLTYPE_MIXER
    Print "Mixer ";
    Case MIXERCONTROL_CONTROLTYPE_MUX
    Print "Mux ";
    Case MIXERCONTROL_CONTROLTYPE_PEAKMETER
    Print "PeakMeter ";
    mcd.cbStruct = Len(mcd)
    mcd.dwControlID = mc.dwControlID
    If mc.fdwControl & MIXERCONTROL_CONTROLF_UNIFORM Then
    mcd.cChannels = 1
    Else
    mcd.cChannels = ml.cChannels
    End If
    mcd.cbDetails = 4
    mcd.item = 0
    mcd.paDetails = String(4 * mcd.cChannels, 0)
    status = mixerGetControlDetails(i, mcd, MIXER_GETCONTROLDETAILSF_VALUE)
    For m = 1 To mcd.cChannels
    Print "peak["; m; "]="; tolong(Mid$(mcd.paDetails, m * 4 - 3)); " ";
    Next m
    Case MIXERCONTROL_CONTROLTYPE_ONOFF
    Print "OnOff ";
    Case MIXERCONTROL_CONTROLTYPE_MUTE
    Print "Mute ";
    Case MIXERCONTROL_CONTROLTYPE_MONO
    Print "Mono ";
    Case MIXERCONTROL_CONTROLTYPE_LOUDNESS
    Print "Loudness ";
    Case MIXERCONTROL_CONTROLTYPE_STEREOENH
    Print "StereoEnh ";
    Case MIXERCONTROL_CONTROLTYPE_VOLUME
    Print "Volume ";
    Case MIXERCONTROL_CONTROLTYPE_BASS
    Print "Bass ";
    Case MIXERCONTROL_CONTROLTYPE_TREBLE
    Print "Treble ";
    Case MIXERCONTROL_CONTROLTYPE_EQUALIZER
    Print "Equalizer ";
    Case MIXERCONTROL_CONTROLTYPE_PAN
    Print "Pan ";
    Case MIXERCONTROL_CONTROLTYPE_QSOUNDPAN
    Print "QSoundPan ";
    End Select
   
   
    Print "]"
   
    Next k
    Next l
    Next j
Next i
End Sub
-------------------------------------------------------------------------
Attribute VB_Name = "Module1"
Public Const MIXER_LONG_NAME_CHARS = 64
Public Const MIXER_SHORT_NAME_CHARS = 16
Public Const MAXPNAMELEN = 32 ' max product name length (including NULL)
Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
Declare Function mixerGetID Lib "winmm.dll" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long
Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long
Type MIXERCAPS
    wMid As Integer ' manufacturer id
    wPid As Integer ' product id
    vDriverVersion As Long ' version of the driver
    szPname As String * MAXPNAMELEN ' product name
    fdwSupport As Long ' misc. support bits
    cDestinations As Long ' count of destinations
End Type
Type MIXERCONTROL
    cbStruct As Long ' size in Byte of MIXERCONTROL
    dwControlID As Long ' unique control id for mixer device
    dwControlType As Long ' MIXERCONTROL_CONTROLTYPE_xxx
    fdwControl As Long ' MIXERCONTROL_CONTROLF_xxx
    cMultipleItems As Long ' if MIXERCONTROL_CONTROLF_MULTIPLE set
    szShortName As String * MIXER_SHORT_NAME_CHARS
    szName As String * MIXER_LONG_NAME_CHARS
    Bounds1 As Long
    Bounds2 As Long
    Bounds3 As Long
    Bounds4 As Long
    Bounds5 As Long
    Bounds6 As Long
    Metrics1 As Long
    Metrics2 As Long
    Metrics3 As Long
    Metrics4 As Long
    Metrics5 As Long
    Metrics6 As Long
End Type
Type MIXERCONTROLDETAILS
    cbStruct As Long ' size in Byte of MIXERCONTROLDETAILS
    dwControlID As Long ' control id to get/set details on
    cChannels As Long ' number of channels in paDetails array
    item As Long ' hwndOwner or cMultipleItems
    cbDetails As Long ' size of _one_ details_XX struct
    paDetails As String 'Long ' pointer to array of details_XX structs
End Type
Type MIXERCONTROLDETAILS_BOOLEAN
    fValue As Long
End Type
Type MIXERCONTROLDETAILS_LISTTEXT
    dwParam1 As Long
    dwParam2 As Long
    szName As String * MIXER_LONG_NAME_CHARS
End Type
Type MIXERCONTROLDETAILS_SIGNED
    lValue As Long
End Type
Type Target ' for use in MIXERLINE and others (embedded structure)
   
    dwType As Long ' MIXERLINE_TARGETTYPE_xxxx
    dwDeviceID As Long ' target device ID of device type
    wMid As Integer ' of target device
    wPid As Integer ' "
    vDriverVersion As Long ' "
    szPname As String * MAXPNAMELEN
End Type
Type MIXERCONTROLDETAILS_UNSIGNED
    dwValue As Long
End Type
Type MIXERLINE
    cbStruct As Long ' size of MIXERLINE structure
    dwDestination As Long ' zero based destination index
    dwSource As Long ' zero based source index (if source)
    dwLineID As Long ' unique line id for mixer device
    fdwLine As Long ' state/information about line
    dwUser As Long ' driver specific information
    dwComponentType As Long ' component type line connects to
    cChannels As Long ' number of channels line supports
    cConnections As Long ' number of connections (possible)
    cControls As Long ' number of controls at this line
    szShortName As String * MIXER_SHORT_NAME_CHARS
    szName As String * MIXER_LONG_NAME_CHARS
    lpTarget As Target
End Type
Type MIXERLINECONTROLS
    cbStruct As Long ' size in Byte of MIXERLINECONTROLS
    dwLineID As Long ' line id (from MIXERLINE.dwLineID)
    ' MIXER_GETLINECONTROLSF_ONEBYID or
    dwControl As Long ' MIXER_GETLINECONTROLSF_ONEBYTYPE
    cControls As Long ' count of controls pmxctrl points to
    cbmxctrl As Long ' size in Byte of _one_ MIXERCONTROL
    pamxctrl As String 'MIXERCONTROL ' pointer to first MIXERCONTROL array
End Type
Type buf192
    buf(192) As Byte
End Type
Public Const MIXER_GETCONTROLDETAILSF_LISTTEXT = &H1&
Public Const MIXER_GETCONTROLDETAILSF_QUERYMASK = &HF&
Public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_GETLINECONTROLSF_ALL = &H0&
Public Const MIXER_GETLINECONTROLSF_ONEBYID = &H1&
Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Public Const MIXER_GETLINECONTROLSF_QUERYMASK = &HF&
Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Public Const MIXER_GETLINEINFOF_DESTINATION = &H0&
Public Const MIXER_GETLINEINFOF_LINEID = &H2&
Public Const MIXER_GETLINEINFOF_QUERYMASK = &HF&
Public Const MIXER_GETLINEINFOF_SOURCE = &H1&
Public Const MIXER_GETLINEINFOF_TARGETTYPE = &H4&
Public Const MIXER_OBJECTF_AUX = &H50000000
Public Const MIXER_OBJECTF_HANDLE = &H80000000
Public Const MIXER_OBJECTF_MIDIIN = &H40000000
Public Const MIXER_OBJECTF_MIDIOUT = &H30000000
Public Const MIXER_OBJECTF_MIXER = &H0&
Public Const MIXER_OBJECTF_WAVEIN = &H20000000
Public Const MIXER_OBJECTF_WAVEOUT = &H10000000
Public Const MIXERCONTROL_CT_CLASS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
Public Const MIXERCONTROL_CT_CLASS_LIST = &H70000000
Public Const MIXERCONTROL_CT_CLASS_MASK = &HF0000000
Public Const MIXERCONTROL_CT_CLASS_METER = &H10000000
Public Const MIXERCONTROL_CT_CLASS_NUMBER = &H30000000
Public Const MIXERCONTROL_CT_CLASS_SLIDER = &H40000000
Public Const MIXERCONTROL_CT_CLASS_SWITCH = &H20000000
Public Const MIXERCONTROL_CT_CLASS_TIME = &H60000000
Public Const MIXERCONTROL_CT_SC_LIST_MULTIPLE = &H1000000
Public Const MIXERCONTROL_CT_SC_LIST_SINGLE = &H0&
Public Const MIXERCONTROL_CT_SC_METER_POLLED = &H0&
Public Const MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = &H0&
Public Const MIXERCONTROL_CT_SC_SWITCH_BUTTON = &H1000000
Public Const MIXERCONTROL_CT_SC_TIME_MICROSECS = &H0&
Public Const MIXERCONTROL_CT_SC_TIME_MILLISECS = &H1000000
Public Const MIXERCONTROL_CT_SUBCLASS_MASK = &HF000000
Public Const MIXERCONTROL_CT_UNITS_BOOLEAN = &H10000
Public Const MIXERCONTROL_CT_UNITS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_UNITS_DECIBELS = &H40000 ' in 10ths
Public Const MIXERCONTROL_CT_UNITS_MASK = &HFF0000
Public Const MIXERCONTROL_CT_UNITS_PERCENT = &H50000 ' in 10ths
Public Const MIXERCONTROL_CT_UNITS_SIGNED = &H20000
Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
Public Const MIXER_OBJECTF_HMIDIIN = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIDIIN)
Public Const MIXER_OBJECTF_HMIDIOUT = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIDIOUT)
Public Const MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIXER)
Public Const MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEIN)
Public Const MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEOUT)
Public Const MIXER_SETCONTROLDETAILSF_CUSTOM = &H1&
Public Const MIXER_SETCONTROLDETAILSF_QUERYMASK = &HF&
Public Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXERCONTROL_CONTROLF_DISABLED = &H80000000
Public Const MIXERCONTROL_CONTROLF_MULTIPLE = &H2&
Public Const MIXERCONTROL_CONTROLF_UNIFORM = &H1&
Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_MULTIPLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_SINGLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_SINGLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEAN = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BUTTON Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM Or MIXERCONTROL_CT_UNITS_CUSTOM)
Public Const MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_DECIBELS)
Public Const MIXERCONTROL_CONTROLTYPE_MICROTIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MICROSECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_MILLITIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MILLISECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)

Public Const MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1)

Public Const MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1)

Public Const MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2)

Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)

Public Const MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1)
Public Const MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2)
Public Const MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3)
Public Const MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4)
Public Const MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5)

Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2)
Public Const MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3)
Public Const MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4)

Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_PERCENT)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_SIGNED)

Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Public Const MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
Public Const MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Public Const MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9)
Public Const MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
Public Const MIXERLINE_LINEF_ACTIVE = &H1&
Public Const MIXERLINE_LINEF_DISCONNECTED = &H8000&
Public Const MIXERLINE_LINEF_SOURCE = &H80000000
Public Const MIXERLINE_TARGETTYPE_AUX = 5
Public Const MIXERLINE_TARGETTYPE_MIDIIN = 4
Public Const MIXERLINE_TARGETTYPE_MIDIOUT = 3
Public Const MIXERLINE_TARGETTYPE_UNDEFINED = 0
Public Const MIXERLINE_TARGETTYPE_WAVEIN = 2
Public Const MIXERLINE_TARGETTYPE_WAVEOUT = 1

Function hex$(d As Long)
    Dim s As String
    Dim i As Integer
    s = ""
    For i = 7 To 0 Step -1
    s = s & hexdig((d / (2 ^ (i * 4))) And &HF)
    Next i
    hex$ = s
End Function

Function hexdig$(d As Long)
    d = d And &HF
    If d >= 10 Then hexdig$ = Chr(Asc("A") + d - 10) Else hexdig = Chr(Asc("0") + d)
End Function


Function s(sz As String) As String
    If InStr(sz, Chr(0)) Then
    s = Left$(sz, InStr(sz, Chr(0)) - 1)
    Else
    s = sz
    End If
End Function


Function tolong(s As String) As Long
If Asc(Mid$(s, 4)) And &H80 Then
    tolong = &H80000000 + (Asc(Mid$(s, 4)) And &H7F) * 2 ^ 24 + Asc(Mid$(s, 3)) * 2 ^ 16 + Asc(Mid$(s, 2)) * 2 ^ 8 + Asc(Mid$(s, 1))
Else
    tolong = (Asc(Mid$(s, 4)) And &H7F) * 2 ^ 24 + Asc(Mid$(s, 3)) * 2 ^ 16 + Asc(Mid$(s, 2)) * 2 ^ 8 + Asc(Mid$(s, 1))
End If
End Function
-------------------------------------------------------------------------
0
 

Author Comment

by:fury
Comment Utility
you gave me this function before in another question...but I have no idea of how to use it =(
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now