I use VB6 and Fmod 3.61
Can somebody give me some example of how to use ” FSOUND_Stream_SetEndCallback “?
Where it is necessary to locate it? In the section declarations, after FSOUND_Stream_Play, or where?
I have the version stdcall of Fmod, but I was not lucky proving with callbacks. 😥
- LeoCombes asked 15 years ago
FSOUND_Stream_SetEndCallback is a Stream callback, and if you look in the documentation under FSOUND_STREAMCALLBACK you will see that a stream callback needs to be a certain way.
[quote:2pfulfn6]From the documentation:
[b:2pfulfn6]stream[/b:2pfulfn6]: Pointer to the stream in question.
[b:2pfulfn6]buff[/b:2pfulfn6]: from FSOUND_Stream_Create – Pointer to the stream data buffer to write to
from FSOUND_Stream_SetEndCallback – NULL
from FSOUND_Stream_SetSynchCallback – Pointer to a string
[b:2pfulfn6]len[/b:2pfulfn6]: from FSOUND_Stream_Create – Length of buffer specified in BYTES.
from FSOUND_Stream_SetEndCallback – 0
from FSOUND_Stream_SetSynchCallback – 0
[b:2pfulfn6]param[/b:2pfulfn6]: A user data value specified from FSOUND_Stream_Create,
If created by FSOUND_Stream_Create –
To allow the stream to continue, TRUE is returned.
To stop the stream, FALSE is returned.
The return value is ignored if created by FSOUND_Stream_SetEndCallback or FSOUND_Stream_SetSynchCallback[/quote:2pfulfn6]
Of course, PureBasic (also know as pb 😉 ) has some disadvantages due to his relatively young age :
- It lacks support of activex,
- SGBD/ADO/DAO/MS JET : VB beats PureBasic here but PureBasic support ODBC on win32 AND Linux (and all other unices),
- mmmhhh this is the only two things i see for the moment.
For the advantages :
- PureBasic is far quicker than VB, you can compare it to C/C++ : all the PureBasic code is converted to the asm language, ready to be compiled by the PureBasic compiler or … nasm !
- you can use asm inline using the fasm assembler,
- PureBasic support real pointers though, you can do simple lists, linked list, binary lists, load balanced list etc … using pointer’s addresses or by using PureBasic internal list functions,
- You can compile your code to a real DLL in both naming conventions : _cdecl and _stdcall, you can also compile it as a COM objet : PureBasic also support COM interfaces,
- It is ready to be used as a language for making games : a lot of advances functions exist to do sprite, collision, pixels manipulations : 2D AND 3D is supported though DirectX and the Ogre 3D Engine, the last but not least : a physic engine compared to the one used in the half life 2 game (havok engine) will be added in the future. [url=http://www.master-creating.de/restricted/gfx/gallery.gif:1kl30cqn]Here[/url:1kl30cqn], you will find a commercial games maked in PureBasic, and [url=http://perso.wanadoo.fr/darkprograms/index2.html:1kl30cqn]here[/url:1kl30cqn], an “oldschool” shoot’em up,
- It is really portable : for now the same code run on win32/Linux if you don’t us OS specific code (windows callbacks for example)
- The community is different from other language : a lot of users are not beginners, they allmost all used language programming for a lot of years so, having a solution to your problem will not be a problem.
- You can reach the PureBasic author easily, ask Microsoft to help you to compare
- The last but not least : FMOD is fully supported by PureBasic using our code (FroggerProgger and me).
I miss a lot advantages and, surely some disadvantages, but i used to program in VB since the 2.0 version (on DOS) and when i figure out how PureBasic beats VB in a lot of domains, i ve switched to PureBasic.
I don’t touch VB for a year now, without regrets 😀
In the latest version of Fmod (3.71) I find less VB examples (simplest directory) and I can’t find one complete example of how use SetEndCallback. I cannot make it work. I attempted in all the ways and it only works in the IDE of VB. In the .exe it crash. Could somebody make the same example with this function?
FSOUND_Stream_Play 1, stream(1)
FSOUND_Stream_SetEndCallback stream(1), Address of endStream,0
´endStream is my function to be called when stream ends.
Public Function endStream ()
´some code for probe endStream.
label1.caption = “Finish” ´In this point VB crash. 😕
I use stdcall.
Your callback needs to be a certain format, I believe it should look like this:
Public Function endStream(byval stream as long, byval buff as long, byval len as long, byval param as long) as long
label1.caption = "Finish"
And because you are using FSOUND_Stream_SetEndCallback the return value is ignored so you dont need to return anything.
I don’t understand well that data want to send you to the function “endStream”.
Concretely, I don’t understand for that to pass him “buff ” and “len” and that value would have. Or is it supposed that the callback sends them to him?
Equally, I proved with the function that you say and it continues without working (VB is crash after label1.caption), in that moment “buff” and “len” are equal to 0, and “stream” and “param ” they have the correct values.
VB enters in the function and it is hung when it executes label1.xxxxxx, maybe the error takes place when it leaves the function. Does the function have to return something? Will it be returning a mistaken value? Does SetEndCallback return a value Byte, will something have to see?
[quote="Colores":mkae785w]Yes! SetEndCallback work. Whit less code in callback, work fine. With a too long code the delay is too big and Fmod crash.[/quote:mkae785w]
It is due to the “speed” of vb … Why no switching to [url=http://www.purebasic.com:mkae785w]PureBasic[/url:mkae785w] ? You will not have to learn the language as it is a basic and it is FAR MUCH powerfull than VB
Btw, it is not free but the license you paid is for the entire life and you can install it in as much computers as you want. And it is cross plateform ! (Windows/Linux/Amiga OS)
It cost the price of a video game
Please login first to submit.