Directly Access the DirectShow Objects (Visual Basic)
The ltmmCaptureCtrl, ltmmConvertCtrl, and ltmmPlayCtrl objects implement the GetSubObject method to allow the user the ability to gain access to DirectShow specific objects.
1. |
Start Visual Basic. |
|
2. |
Add the LEAD Multimedia controls to your project. On the Project pull-down menu, use the Components option, and select the LEAD Multimedia Library (14). |
|
3. |
Select the ltmmPlayCtrl Control, and add it to your form. |
|
4. |
Add the LEAD Audio VUMeter Filter to your project. On the Project pull-down menu, use the References option. If you cannot find "LEAD Audio VUMeter Filter Library" in the list, click the Browse button and browse to find and choose the library "LMAVUMeter.dll", and click the Open button to close the "Add Reference" dialog box. Select the LEAD Audio VUMeter Filter Library, and click OK. |
|
5. |
Add a button control to your form, and name it as follows: |
|
|
Name |
Caption |
|
btnGetVUMeterFilter |
Get VUMeter filter |
6. |
Handle the btnGetVUMeterFilter Click event, and code btnGetVUMeterFilter_Click Sub as follows: |
Private Sub btnGetVUMeterFilter_Click()
Dim index As Integer
Dim vumeter As ILMAVUMeterDisp
Dim LeftLevel As Long ' Left level
Dim RightLevel As Long ' Right Level
' Get the index of the VUMeter filter.
index = ltmmPlayCtrl1.AudioProcessors.Find("@device:sw:{5FFE757A-509A-477E-A1F1-68812010A6DD}\{E2B7DB5C-38C5-11D5-91F6-00104BDB8FF9}")
' Select the VUMeter Filter
ltmmPlayCtrl1.SelectedAudioProcessors.Add ltmmPlayCtrl1.AudioProcessors.Item(index), 0
' Get the VUMeter Filter
Set vumeter = ltmmPlayCtrl1.GetSubObject (ltmmPlay_Object_SelAudioProcessor)
' read the left channel power
LeftLevel = vumeter.LeftLevel
' read the right channel power
RightLevel = 10000 + vumeter.RightLevel
' Display the and the right level values
MsgBox "Left Level =" + CStr(LeftLevel) + Chr(13) + "Right Level =" + CStr(LeftLevel)
End Sub
7. |
Run your program to test it. |