Hey, I did a quick search around the forum and didn’t find a getting started thread for VB.
The examples that came with EX and VB, seem to be for VB6.0. And the examples dont’ even run for me.
But anyway, I need to know how to use Fmod with VB 2005 Express which just came out.
I looked in the Fmod help and it talks about just adding the BAS file to your project, only this EX I just installed doesn’t have BAS files. So I really don’t know what I’m doing.
I went into my project references and tried to add the fmodexp.dll but VB just comes back saying “can not make reference, make sure it’s a valid COM” or whatever.
So then, does anybody know how to use Fmod with 2005 VB? It is for an extremely simple purpose, I just need to play a small playlist of 2 or 3 songs in MIDI and/or MP3. And then repeat once they played. The user has control to stop and start playing, and to go to next song. That’s it, nothing fancy.
Any help? Should I download the previous Fmod to get a BAS file? I don’t know exactly how to use these DLLs with this version of VB.
Thanks, first post here!
- Vigilante asked 11 years ago
[quote:2hds7ulx]I just need to know now which command or function to use to actually play the sound.
The VB “Play Stream” example should suffice. Take note of which functions are actually used.
The primary BAS module (fmodex.bas) is bloated for your purposes because the person who assembles these examples has finite time available. After you get your basic player functioning, you can go back and start ‘commenting out’ stuff that isn’t used. You’ll be left with several function declares and a dozen or so Enums.
I know you were being sarcastic, but I don’t see a VB2005 bandwagon starting any time soon. If you need only MIDI/MP3/WAV support, you could also try DirectShow (see quartz.dll). Doesn’t VB2005 afford basic media support anyway?
Well for one thing, all these 2005 version are part of the new .NET 2005 Studio suite. So this IS where the language tools are going.
But M$, in their infinite wisdon, deemed it proper to release sepparate version of each language, called Express Edition, for free to the public. For the next year they are free to download. So you can actually get each language, in it’s own little GUI, for free. So I downloaded C# and VB.
As for built-in tools, I can’t find any media controls, I suppose M$ wants you to tap into the Media Player API. I don’t konw.
They do offer just one built-in way to play sounds, it’s extremely easy, but only supports WAV files!
I surely hope Fmod develops for 2005 editions, cause that’s where the language is going.
Well I’ll give it a second look.
EX also gives a bunch of CSharp examples, I also have CS Express, and those wouldn’t work either. Express says the projects need to be converted, but it errors while converting. So I can’t really see those either.
I’ll have to play with it tomorrow night, if I figure it out, I’ll let you know. Thanks.
OK, well I found the BAS modules. Didn’t see them before because 2005 doesn’t show BAS in their file browser for adding an existing file to the project!
So anyhoo, I added the fmodex.bas to my project. This created a list of about 500 problems!
First I had to add this wrapper around the code:
Once I did that, a couple hundred errors went away.
Then I had to change all Public Type to Public Structure. As VB 2005 no longer has Public Types. Along with adding “dim” to the begining of the assignments inside the public structure.
So on and on I changed things until all 400 errors were gone. Hurrah!
But now comes the fun part. After searching the VB examples for HOW you actual use the darn thing, I put this in my code, same as it is in the VB example:
result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, sound3, 0, Channel)
Well VB complained at every part of this. “result” wasn’t declared, neither was FMOD_CHANNEL_FREE, sound3, or Channel.
So I declared result, because it’s just a return value. But not sure what the other arguments are for. And it also complains because “System” is a system namespace and can’t be used as a variable/argument/expression etc…
I’m so lost here fellas. Can Fmod even be used with 2005? And please tell me I don’t have to have these 10,000 lines of code in my projects just to play a midi file. Is there a simpler way to do this? Just the code for this is literally 10 times the ammount of code for my whole program itself. I’d rather just not play the dang music if it’s going to be this much hassle.
Hopefully someone out there has hooked Fmod to VB 2005 and can point me in the right direction.
Again, I don’t need fancy DSP effects, environments, miniscule wav editing. Hopefully the code to fmod can be trimmed down to just the parts I need. I’m sure the 500 declarations aren’t needed for playing a midi or mp3. Or are they?
Keep trying, don’t give up!
[quote:3kdskok3]The examples that came with EX and VB, seem to be for VB6.0. [/quote:3kdskok3]
They are; so you need to migrate VB 6.0 code to VB2005 code 😮
It’s not clear from your comments where your skill/experience lies: VB6 or VBNet ? I’m a bit confused as to why you think you can copy VB6 code and merely paste it into VB2005? Is it that you are unfamiliar with VB6 syntax, or that you are new to VB in general?
You won’t need hundreds of lines of code, but you do have an hour or so of work ahead of you. Migrating is slow.
Start by declaring all the functions you want to use. The VB6 module shows clearly what variables and types each will need (e.g., FMOD Types and Long Integers). It is up to you to define all these variables/pointers and to declare the functions in a manner suitable for VB2005. [Frankly, I don’t understand what MS is trying to do with “VB Express” but I am guessing that you are largely constrained to follow the VB NET developers here.]
Most all my experience is with VB6.
And I basically manually migrated the VB6 code BAS files to be supported in 2005.
My program, once I changed all the functions, declarations, types, etc…, my program will compile and run.
It’s just now I need to know how to actually PLAY a sound. What function do I use? What variables do I need?
No I’m not a loyalist to .NET I think it’s just MS trying to take over the world. haha. But I actually got the express edition of C Sharp cause I wanted to learn that. But figured I might as well upgrade VB as well. And the Express is actually very easy and straitforward. So I wrote a little game in 3 days without even knowing the program well. And then I thought to myself, “hmm, why not play some background music while they play?”. And then this started.
Ok, so 2005 does not seem to have a multimedia control like VB6 did. So someone suggested, look in to Fmod. And a friend of mine has used Fmod in VB6 before and said it was pretty simple.
So anyhoo, now that the BAS file madness seems to be sorted, how do I actually tell Fmod to play a file?
And again, is it possible to strip out all the functions and declarations that are not needed for just playing a MIDI or MP3? Or do I need every line of code in the BAS files?
I will look into the migration tool, people say it doesn’t work all that well. Plus that, the changes I made were not major, just small syntax. Such as “Public Type…” changed to “Public Structure”. And variables without had to have a “dim” placed in front. Stuff like that. And arrays cannot be dimensioned when inside a structure. So “Dim array(100)” had to be changed to “Dim array()”. And again, my program compiles with no errors. I just need to know now which command or function to use to actually play the sound.
Thanks, maybe I’ll write an article on using Fmod with VB2005 Express when I figure it out. Or do you know if the Fmod people have any plans to ship a VB module for use in 2005? I hope they do.
Couldn’t compile the C# one. lol. I try to open the CS project and it says that it was made with an older version of CS. So it went to do a convert process and it failed. arghhh.
I’m hoping somebody around here will venture into the new VBexpress and try to do what I’m doing.
Fmod people need to get on this! Us state of the art, cutting edge MS corporate sellouts need help keeping on with the…bla bla bla
How do I compile the C# project into a file that I can reference? You saying that Fmod distro includes some sort of C# thingy I can compile into an activex control or something? No idea here, no idea.
Please login first to submit.