0
0

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.

  • You must to post comments
0
0

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.

  • SD
  • You must to post comments
0
0

I think ive managed to do all the steps except for loading the file. I dont understand this commandialog stuff. Anyone care to help me with this step?

  • You must to post comments
0
0

Sorry but i wasnt logged in. That was me who just posted by the way.

  • You must to post comments
0
0

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).

[code:2u3xbfsq]
With cdFile

.DialogTitle = "Select Audio Source"
.Filter = "Windows PCM|.wav|All Files (.)|.*"
.ShowOpen
If Err.Number = 32755 Then... ‘ USER CLICKED CANCEL

End With[/code:2u3xbfsq]

If the user selected or specified a valid file, it will be stored as cdFile.Filename.

  • SD
  • You must to post comments
0
0

Ok after lookin at that and putting it into my project, ths isnt what i want.
When the form loads if comes up with the open a filename, which i dont want, as i said before. I want it so the .wav file plays when the form loads.

  • You must to post comments
0
0

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”

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.