Hi Guys
I am trying to stream mp3s from internet using FMOD 3.75 engine, for NeoPlayer I recently submitted at VBforum.
http://www.vbforums.com/showthread.php?t=642683
Fmod sends information about streaming data through call back function as as shown (C++ Decalaration)
FSOUND_METADATACALLBACK
Callback to receive a new piece of metadata from an internet stream
signed char F_CALLBACKAPI FSOUND_METADATACALLBACK(
char *name,
char *value,
void *userdata
);
Parameters
name Pointer to the name of the piece of metadata (null-terminated ASCII string)
value Pointer to the metadata (null-terminated ASCII string)
userdata Userdata that was specified in FSOUND_Stream_Net_SetMetadataCallback
Return ValueCurrently ignored
CPP Code for callback function
//EVERYTHING WORKS FINE IN CPP (no error ever occurred)Code:signed char F_CALLBACKAPI metacallback(char *name, char *value, void *userdata) { if (!strcmp("ARTIST", name)) { strcpy(artist, value); return TRUE; } if (!strcmp("TITLE", name)) { strcpy(title, value); metanum++; return TRUE; } return TRUE; }
My VB Code
1 Code:
Private Declare Function ConvCStringToVBString Lib "kernel32" Alias "lstrcpyA" (ByVal lpsz As String, ByVal pt As Long) As Long Public Function GetStringFromPointer(ByVal lpString As Long) As String Dim NullCharPos As Long Dim szBuffer As String szBuffer = String(255, 0) ‘ I have tried increasing size of buffer even then it crashes sometimes ConvCStringToVBString szBuffer, lpString ' Look for the null char ending the C string NullCharPos = InStr(szBuffer, vbNullChar) GetStringFromPointer = Left(szBuffer, NullCharPos - 1) End Function
But in VB application crashes many times, (it works many times as well), Kindly help me ...Please correct the VBcode, I think Icould't use pointers in VB properly.
Regards to all




Reply With Quote