Second step, how to control the volume of the volume If you want to control the volume of the volume, you can do some work before you create a buf.
Create a bufferDescription object
DIM DESC AS New BufferDescription
Set the properties of DESC
Desc.ControlPan = TRUE
DESC.CONTROLVOLUME = TRUE
desc.controlfrequency = TRUE
(Of course, there are other functions, then say, I haven't studied it in 3D, one step by step)
After completing, you can create it, you have a different start, more than a DESC
BUF =
New SecondaryBuffer ("g: /media/wav/rod2.wav", DESC, AD)
(Microsoft: You have to control the volume size, although you look at me very deeply, but you don't say how I will know .....)
Remember, the above is merely explained that you can change the volume, but have not mentioned how to change.
BUF.VOLUME = 0 'This sound is the biggest
BUF.VOLUME = -5000 'Microsoft gives an example of -5000 actually -50, I can't hear anything.
BUF.PAN = 0 'Two-side channel balance -10000 with 10000 is left and right channels
BUF.FREQUENCY = desc.format.samplespersecond 'The default sound 44khz is 44100 this is speed
OK, speed usually doesn't need to change. Occasionally play is ok, the actual significance is not big.
After the code is changed
=======================================
DIM AD
As Device
DIM BUF
As SecondaryBuffer
Private Sub Form1_Load (Byval E AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load
AD = new device
DIM DESC AS New BufferDescription
Desc.ControlPan = TRUE
DESC.CONTROLVOLUME = TRUE
desc.controlfrequency = TRUE
Desc.flags = bufferDescriptionFlags.globalfocus' global, the previous article
Ad.SetcoOPERATIVELEVELEVEL (Me.Handle, CooperativeAventiveLevel.Normal)
BUF = New SecondaryBuffer ("g: /media/wav/rod2.wav", DESC, AD)
BUF.PLAY (0, BufferplayFlags.Looping)
Label5.text = buf.frequency.tostring
End Sub
Private Sub Form1_keydown (Byval e as system.windows.forms.keyeventargs) Handles mybase.keydown
BUF.VOLUME = 0 'The biggest is 0
Label2.text = buf.volume.tostring
End Sub
Private Sub Form1_Keyup (Byval e as system.windows.forms.keyeventargs) Handles mybase.keyup 'buf.volume = -50 * 100
BUF.VOLUME = -5 * 100
Label2.text = buf.volume.tostring
End Sub
PRIVATE SUB FORM1_MOUSEDOWN (Byval e as system.windows.forms.mouseeventargs) Handles mybase.mousedown
If E.BUTTON = MouseButtons.Left Then
BUF.PAN = -20 * 500
Else
BUF.PAN = 20 * 500
END IF
Label4.text = buf.pan.tostring
End Sub
Private Sub Form1_Mouseup (Byval e as system.windows.forms.mouseeventargs) Handles mybase.mouseup
BUF.PAN = 0
Label4.text = buf.pan.tostring
End Sub
=======================================
Next, 3D, I don't know if there is time to write