10-26-2001, 01:03 PM
iam inserting sound in my game and ima using DS, i followed the tutorial but there seems to be a problem, i dun know wether its a prob with the drivers or its the code that has errors, iam attaching a copy of the file for u ref, thanx
by the way iam not attaching the sound file so u have to change the path and name of the file. dont worry about the images. start a new project and add the files into it to run it.
10-26-2001, 02:08 PM
Well, I think your problem lies with the fact that you didnt set any of the requires flags for the WAVEFORMATEX variable.
All I have done here is rewrite the CreateSound function. It works for me:
<pre>Function CreateSound(FileName As String) As DirectSoundBuffer
Dim DSBuffer As DirectSoundBuffer
Dim DSDesc As DSBUFFERDESC
Dim DSWave As WAVEFORMATEX
DSDesc.lFlags = DSBCAPS_STATIC
DSWave.nFormatTag = WAVE_FORMAT_PCM
DSWave.nChannels = 2
DSWave.lSamplesPerSec = 22050
DSWave.nBitsPerSample = 16
DSWave.nBlockAlign = DSWave.nBitsPerSample / 8 * DSWave.nChannels
DSWave.lAvgBytesPerSec = DSWave.lSamplesPerSec * DSWave.nBlockAlign
Set DSBuffer = DirectSoundObj.CreateSoundBufferFromFile(FileName, DSDesc, DSWave)
Set CreateSound = DSBuffer
Reply if this doesnt work.......
10-26-2001, 11:42 PM
nope thats note working, its still gives an error on DSDesc and says ByRef Argument type mismatch, i realised seomthing that i had initialized as DirectX7 so i changed to DirectX8 and compiled, i din get that error but the msg Popped DirectSound Initialization failed (from the sub InitDirectSound). I thought it must a prob with the operating system so i switched to windows 98 from windows 2000 professional, No diff. DO u think its a prob with my VB 6.0, do i have to re-install?
10-27-2001, 04:23 AM
Well, for a start you cant just switch to DirectX8 just like that, you would have to rename all your objects and variables. What you coded was DirectX7 and it works that way. Since your game does not involve super fast 3D stuff I would stick to 7, its much easier and more stable than 8. As for your ByRef argument mismatch. That wasnt the error that ever ocurred on my PC. All I got was a few Automation errors, but then I ironed them out.
What I suggest you do is uncheck the reference to DX8 in your project, and check DX7 ONLY. Then try it, it should work. The problem with having both checked is that they have very similar objects. From the sound of it, sounds like you are trying to pass DX8 objects to a DX7 function, or vise versa. I say drop DX8 and then try again.
Shout again if that doesnt work.
EDIT --> if you could attatch the WHOLE project to your next post, not just the .frm file, including the .vbp file, that would help a lot.
10-27-2001, 06:03 AM
hey that worked images/icons/smile.gif, the prob was i had selected DirextX8, u were right on that point images/icons/laugh.gif, thanx man
10-27-2001, 06:12 AM
Alright! Well done! Cant wait to see the finished product!
10-27-2001, 06:19 AM
hey if i wanted to play mp3 files what changes do i have to make?
10-27-2001, 07:07 AM
Quite a lot of changes. The mp3 needs to be converted into a playable .wav format and then streamed in using the correct codec. This is for DX7. Its easier, would you believe it, with DX8.
To learn how to use it in DX7, look here: (Lucky's VB) (http://www.rookscape.com/vbgaming/tutAW.php)
To learn to use DX8 mp3s (which will require you to port completely over to DX8), look here: (DX4VB) (http://220.127.116.11//Tutorials/DirectX8/DXS_MP3Playback.asp)
10-27-2001, 07:26 AM
wow i checked the code and its complicated and anyway i have to download a plugin for it and thats another hassle, i think ill stick with .wav files. anyway thanx for helping
by the way how do u set the icon with ur name, can i set 1?
10-27-2001, 07:42 AM
Click on Control Panel at the top of this page, you can set the picture in the options there.
10-27-2001, 08:03 AM
ok i know this question should not be here, but i think ima having prob with setting the pic in my profile, its asking for the url, do i give the pathname of the file or does the pic have to be online? sorry for posting this
10-27-2001, 08:22 AM
The pic has to be hosted somewhere online.
You provide the online URL to the pic, once you have uploaded it. I use a pic from:
There are loads there.
10-27-2001, 11:00 AM
thanx man images/icons/cool.gif