Jump to content
Xtreme .Net Talk

Recommended Posts

Guest double-helix
Posted

u can use directx8 to play sounds. u need to add a reference first, but its simple from then on.

 

first, right click on references and choose add references. in the com tab, choose DirectX 8 for Visual basic library - u need this reference, if it aint there, it aint happening.

 

then, at the top of the code, where key statements are usually placed, type :

 

Imports DxVBLibA

 

Add a command button and change the name to cmdSound

 

Then, in the button's code center :

 

Private Sub cmdSound_Click()

dim myDSound as DirectSound8

dim myBufDesc as new DSBUFFERDESC()

dim D8 as new DirectX8()

dim myBuffer as DirectSoundSecondaryBuffer8

myBufDesc.guid3DAlgorithm = AUDIOCONSTANTS.GUID_DS3DALG_DEFAULT

myDSound = D8.DirectSoundCreate(vbNullString)

myBuffer = myDSound.CreateSoundBufferFromFile("C:\Sound.wav", myBufDesc)

'The Above Sound can be changed to suit ur needs

myDSound.setCooperativeLevel(me.handle.toInt32, CONST_DSSCLFLAGS.DSSCL_NORMAL)

myBuffer.play(CONST_DSBPLAYFLAGS.DSBPLAY_DEFAULT)

End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...