The Name(4) is not valid. Is this because Name is a VBA statement? I assume I can safely rename it though.
[code:98puhz8r]Public Type FSOUND_TOC_TAG
Name(4) As Byte ‘ The string "TOC" (4th...[/code:98puhz8r]
Has anyone written a “port” of the netstream C-sample for VB? I thought I should just make a quick test but I failed, utterly. The code runs interpreted but once compiled to exec it just crashes after starting the stream. Seems like it’s the call to GetStringFromPointer (or rather the ConvCStringToVBString call) in my metadatacallback that causes this.
This is the related code:
[code:98puhz8r]FSOUND_Stream_Net_SetMetadataCallback stream, AddressOf FSOUND_METADATACALLBACK, 0[/code:98puhz8r]
[code:98puhz8r]Public Function FSOUND_METADATACALLBACK(ByVal name As Long, ByVal value As Long, ByVal userdata As Long) As Boolean
If GetStringFromPointer(name) = "ARTIST" Then artist = GetStringFromPointer(value) End If If GetStringFromPointer(name) = "TITLE" Then title = GetStringFromPointer(value) metanum = metanum + 1 End If
Hopefully it’s just me being tired. That way, this’ll be fixed in no-time. Btw, I’m using FMOD 3.73.
- Isaris asked 13 years ago
[quote="duch":3pfqm1g3]i’v got the solution at your problems.
Contact Me at firstname.lastname@example.org if u want the project.[/quote:3pfqm1g3]
I like how someone has the solution but doesn’t want to share. So with that I have to bring this old post to the top.
Anways, I’m on this issue. Anyone know how I can get my application working with METADATA outside of the IDE?
And post in here instead of linking an email address for future users to resolve the problem.
[quote="Isaris":2j1nvtfx]The Name(4) is not valid. Is this because Name is a VBA statement? I assume I can safely rename it though.
[code:2j1nvtfx]Public Type FSOUND_TOC_TAG
Name(4) As Byte ‘ The string "TOC" (4th...[/code:2j1nvtfx]
Yes, I think that’s the reason so you can indeed safely rename it.
I’ve also downloaded your source code, opened it in vb and compiled it.
When I start the compiled exe, a stream starts playing.
Pressing the button stops it.
So I don’t get any errors.
I “solved” it using a timer. As it seems to be a threading issue or something down that lane, executing a timer in the callback allows for the data to be gathered. In the timer event the polling code can be placed and executed normally without crashing your app.
There’s a huge drawback though – the polling needs to be instant because the memory seems to be released as soon as the callback ends. Meaning you can’t fetch the tag data if there’s a delay – using a timer is thus very unreliable and sometimes will just return garbage.
What makes me think it’s a threading issue is the fact that calling most APIs inside callbacks is “illegal” in VB. Perhaps it has something to do with thread safety. And the fact that timers are run in a separate thread from the main app thread – thus allowing for calls “outside” the callback.
Although my solution works, I’m still waiting for word from Brett, or anyone, solving it the “right” way.
- Isaris answered 11 years ago
Thanks Isaris for your reply. I also am waiting for more of “right” way to go about this. I know in the API it says the function was created and added by:
‘Thanks to KarLKoX for the following function
‘Example: MyDriverName = GetStringFromPointer(FSOUND_GetDriverName(count))
Maybe he can give some insight if he is still around the forums.
I’m using VB6 + SP6 on winXP, and as I said I had no crashes with the project as you sent it to me.
The Name thing is even stranger,
I’ve just tested it, and Name is allowed as name for a variable, and even as an attribute of a Type.
But as soon as you try to use it as an array vb complains.
My environment is the same, VB6sp6 and WinXP (pro). Testing machines differ in hardware and software. Been testing on even more computers now and although it sometimes plays a few seconds it always crashes when it receives metadata. The call to GetStringFromPointer screws it all up.
Btw, Adion, did you receive the metadata artist and title or did it just play the stream and print the stream info?
[quote="Isaris":2qn9vt6u]Here’s the entire test code. Please, tell me why it’s not working in compiled form.
I am new user VB 6.0, I am in Viet Nam, I need a full VB sample play the sound with fmod.dll.
Can some one help me.
My email: email@example.com
Converted everything to VB.NET and guess what? It runs in IDE but not compiled. Something is way wrong and I desperately need someone to tell me where I’m doing the blunders. The source in the link above is refreshed so please download and check it.
The stream starts to play but as soon as the artist – title data is to be retrieved it crashes.
- Isaris answered 12 years ago
Is it just that nobody knows the answer or is it pure arrogance towards the less knowing? I see many questions on this exact issue but no answers.
I’m wondering too, why is it that my attempts to fetch artist and title fail from executable but not from within IDE?
escuse me but i speak french.
J’ai entendu dire que le crash lorsqu’on l’on compile l’application pouvais venir du fais qu’on peux utiliser que la fonction postmessage dans un callback.Mais nous nous utilisons la fonction GetStringFromPointer dans le callback… Je pense que sa viens surement de celà 😉
(essayer de ne pas utiliser la fonction la version compiler ne crash pu .. mais biensur on a pu le resultat )
J’ai entendu parler d’utiliser des .tlb … a vrai dire jpx pas en dire plus
Please login first to submit.