NicoVB Posted July 7, 2002 Posted July 7, 2002 How do you add sounds?? Thanks Quote Visit http://www.nico.gotdns.com Now ONLINE!
Guest double-helix Posted July 12, 2002 Posted July 12, 2002 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.