Tutorials to .com >>
VB.net >> Study Notes, VB.NET use DirectSound9 (1)30
Study Notes, VB.NET use DirectSound9 (1)
Keyword: DirectX9 DirectSound
vb.net Author: Dong-jun containing
Online to see the source code is
c + + and the intention is the best
C++ # and to baidu search and found that many people are looking for. CSDN then thought of in a blog. Would like to
share with you on .3-17 To test, the estimated words to write to in order to continue long after the research.
The lovers on the VB6. We give up as soon as possible or VB6, I started from the 97 years, and now finally to. Net, and we can imagine the suffering of the middle. In particular, the server programming,. NET can help a lot. Client With the promotion of
XP upgrade with the windows update, but also faster. that time is not ready do not.
My learning
SDK documentation to see and understand many concepts, and then look at the SDK C # tutorial (now used)
Preparations
VS2003 (there in 2002, but do not have that version)
DXSDK 9.0C 2004 Dec (keep in mind that it is for VS2k3 and VS2k2 have had, and many places are not common)
Win2k (Needless to say this has been a long time now)
General steps
First of all, you want to add a reference. Otherwise, imports can not be found directly Microsoft.Directx ....
2 cited the end, in order to facilitate imports Microsoft.DirectX.directsound
In order to play a simple sound files for the following operation
Create a device, linked to this form
Create a buffer to specify the source (in this document)
Play ...
Dim ad As Device 'to create devices
Dim Buf As SecondaryBuffer 'create a buffer
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ad = New Device 'strength of device object
ad.SetCooperativeLevel (Me.Handle, CooperativeLevel.Normal) 'Association
Buf = New SecondaryBuffer ( "G: \ MEDIA \ WAV \ ff9start.wav", ad) 'strength of the buffer zone
Buf.Play (0, BufferPlayFlags.Looping) 'players, at the same time the beginning of the location specified with the way
End Sub
This is a most fundamental and most simple example to understand the steps
Interesting phenomenon, as is the form DS-related, when the form loses focus, he will stop playing
Once re-focus will continue to broadcast
It is convenient
But the DS is used in the buffer zone, in the switch when the voice will be lost, so a little less
SDK also mentioned, but I do not have a serious look (1 sense of problem (unless the sound recording) 2 in English, lazy ~)
In fact there is no need to solve the problem of lost, because when there buf described this option
Ordinary (is the default, I used this)
Sticky you see the original: Buffers with \ "sticky \" focus will continue to play if the user switches to another
application not using DirectSound. However, if the user switches to another DirectSound application, all normal-focus and sticky-focus buffers in the previous
application are muted. ";
Overall: Buffers with global focus will continue to play if the user switches focus to another application, even if the new application uses DirectSound. The one exception is if you switch focus to a DirectSound application that uses the DSSCL_WRITEPRIMARY cooperative level. In this case , the global-focus buffers from other applications will not be audible. ";
Then the default hardware acceleration
software to speed up (by default is like, there are the hardware on the hardware, or simulated)
What is the original
if (MixHardware)
(
sText = sText + "\ n \ nWith the hardware mixing flag, the new buffer will be forced to use hardware mixing. If the device does not support hardware mixing or if the required hardware resources are not available, the call to the DirectSound.CreateSoundBuffer method will fail. ";
)
else if (MixSoftware)
(
sText = sText + "\ n \ nWith the software mixing flag, the new buffer will use software mixing, even if hardware resources are available.";
)
else
(
/ / Default mixing
sText = sText + "\ n \ nWith default mixing, the new buffer will use hardware mixing if available, otherwise software mixing will be used.";
)
As the content is very simple, there is no need for translation (mainly because of lazy, I can even understand a little about the record)
DirectSound can actually work for many
Including special effects, 3D sound effects and sound mixing with crawling (recording?)
Comparison of late today, there is no volume control research. BufferDescription is a
To be used to describe the function of the buffer zone
After setting up buf.pan =... can be used to modify, so I understand that the next try, the feeling is not very difficult.
Can't Find What You're Looking For?