Are there any VB experts out there who have successfully translated “stream2” example … and made it work?
How do you write the FMOD callbacks in VB6? A properly translated example would help a lot and be greatly appreciated. In fact, more VB-based code examples for FMOD would probably help a lot of folks.
- waltk asked 16 years ago
Hey, just wondering, but have you managed to write callback functions successfully in Visual Basic?
I have tried to do that, but because I couldn’t get it to work I use C dll files for the callback functions.
I think the VB sample included with fmod uses such a dll, so if you can write some C code I can give you the source of such a dll.
Yep! I made a “bridge” dll that receives the call from FMOD system and then calls the VB function. This can’t be done directly because FMOD uses cdecl callback mechanism, while Visual Basic accepts only stdcall. An attempt to do a callback directly from VB will cause an Access Violation error.
Do you need my C source code?
Yes, I would be very interested in the code.
Just one question: Do you know how fast Visual Basic code is compared to C code? Cause if I don’t lose much speed I would write my dsp’s in VB, because I’m not very good at C for the moment.
I think the biggest problem in VB that might lead to speed loss is the lack of pointers…
You’re right. The biggest disadvantages of VB are the lack of pointers and the speed loss. I don’t know how u can write a DSP in VB without pointers, because FMOD returns a pointer to an array, but you can’t handle pointed arrays! In you want to make things a lower level, and use the pointer value directly as a value that refers to a location in memory, VB lacks of functions to access directly to memory.
Because of this I made another dll that solves this problem. I can send you also this dll file, if u need it!
However I think a dsp in VB is very inefficient, unfortunately.
Excuse me for my bad english, but today I’m very tired…
It’s not completely impossible, if you use stuff like MemoryCopy and VarPtr, altough I heard varptr will be removed in VB.Net
I hope VB.Net will be able to handle pointers in some way.
Thanks for the dll, I’ll check it out!
Anyway, I think I will keep writing dsp functions completely in C, because that’s fastest.
Thanks to Blackshard and Adion for your additional messages explaining the VB limitations.
I though with VB5/6 that you could use the “AddressOf” for the pointers to callbacks. Perhaps this doesn’t work for the reasons you’ve mentioned. I’ve only heard about CopyMemory and VarPtr.
Unfortunately I cannot get into learning C++ right now. I did revisit the VB example you mentioned which uses a the “fmod_dsp_lowpass.dll”, but I’m still after a translation by somebody of the “stream2” example … even if you have to make it work with a C DLL you’ve written.
Whenever either of you have some free time, and can package the short example for “STREAM2” (with your custom “bridge” DLLs), I’d appreciate it very much. I don’t need the C source code, but if you have a compiled DLL, plus VB code example showing how you use it, then I may be able to get by.
Thanks, and best regards to Italy and Belgium from across the ocean.
Did someone say they had a VB app loading Winamp plugins? Do tell!
I’m quite interested in things related to internet radio streaming. I’m Building a DJ app that will eventually be 100% self-contained streaming compatible with Shoutcast/Winamp etc.
Also if somebody knows how to play URL streams (I thought FMOD says it supports this, but I guess I’m not clear on any tricks to getting them to play). Help! 😎
- K6Deux answered 16 years ago
I’m going to release my own player based on fmod, and it’s written in VB.
I’m waiting for version 3.5 of fmod library to release beta2 version of my software, however, if u want, I can send you source and binaries of my partial beta 2.
It loads modules and streams, has a nice interface (I think), consumes very low CPU power, can load WinAMP modules and some other nice things. Are u interested on?
Thanks for the offer, blackshard.
To further clarify my request, I’m more interested in creating a signal generator rather than a music player,etc. “Stream2” example was the closest to my needs, and all I need is a translation of the C++ example into VB. Then I can take it from there.
In fact, for the benefit of other users, it would be nice if the future Version 3.5 had all the C++ examples also provided in VB & Delphi. Then each person trying out FMOD could experiment in their programming language of choice.
If anyone has the equivalent translation of Stream2 into VB, I would be very grateful.
Please login first to submit.