I have just started out using Fmod and i have looked all around but only to see a few examples of fmod used in VB. Most are in delphi, but that doesnt help as my project is in VB6.
I gave it a go, using it in my code to play a .wav file, but i just dont know enough.
What i wanna know is:
When a form loads i want it to play a sound. I want it to get the sound from the Application path – /Sound folder and then pick the file name. The file is .wav format by the way (as said).
Sorry if this seems anoying, but im in need of guidence.
- TheUsed asked 12 years ago
Ok, then simply edit the sample code
[code:3p9ytocb]streamHandle = FSOUND_Stream_Open(CommonDialog1.filename, FSOUND_NORMAL, 0, 0)[/code:3p9ytocb]
so that [b:3p9ytocb]CommonDialog1.filename[/b:3p9ytocb] is replaced with a string variable, such as [b:3p9ytocb]wavFile[/b:3p9ytocb], where wavFile = App.Path & “\” & “yourfile.wav”
I think you just didn’t give yourself enough time. If you look at the VB sample application (refer to the vbsamples folder), all the code you need to (1) initialize FMOD, (2) load a sound file, and (3) play the sound, is there waiting for you.
You can do #1 in the Form_Load; but you’ll need to trigger the CommonDialogue and query the user for a filename before #2.
First, you’ll need to load the ‘Microsoft Common Dialog Control (SP6)’ component into your VB project. I have named it “cdFile” in this example because it is being used only for file operations (no printing or font operations).
.DialogTitle = "Select Audio Source"
.Filter = "Windows PCM|.wav|All Files (.)|.*"
If Err.Number = 32755 Then... ‘ USER CLICKED CANCEL
If the user selected or specified a valid file, it will be stored as cdFile.Filename.
Please login first to submit.