When writing a player with VB, it is often involved in the channel switching problem. Although DirectShow and other methods can be solved, but too trouble, and VB supports DirectShow is not very good. The following describes the use of MCI command to switch VCD sound. The method of the road.
'Added first to form a picture control so as to display an image' Add a standard module, the declaration added API function mciSendString Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String , Byval ureturnLength As long
Salias = "VCD" sthefile = "c: / songs / gypsy lover .dat"
'Open file Lreturn = McISendstring ("Open" & Sthefile & "Alias" & Salias & "Parent" & Picture1.hwnd & "Style Child", vbnullstring, 0, 0)
Play Lreturn = McIndstring ("Play" & salias, vbnullstring, 0, 0)
'Close LRETURN = McIndstring ("Close" & salias, vbnullstring, 0, 0)
'Switching the sound' left Lreturn = McIndstring ("Setaudio & Salias &" Source to Left ", vbnullstring, 0,0)
'Right channel Lreturn = McISendstring ("Setaudio" & Salias & "Source to right", vbnullstring, 0,0)
'The average of around (ie the sound of the left and right channels) Lreturn = McISendstring ("Setaudio" & Salias & "Source to average", vbnullstring, 0,0)
'Stereo Lreturn = McIndstring ("Setaudio" & Salias & "Source to Stereo", VBnullString, 0,0)
Switch the channel with the above method to achieve both speakers, but only the files in the VCD (ie MPEG1) format are valid.