I’m pretty new at c++ in general, so bear with me. I’m trying to build a streaming jukebox, and am downloading an mp3 file via Wininet to a char buffer. Using the examples I’ve found in this forum, I’m attempting to plug that buffer into FMOD with NO luck. The buffer is initailaized as such:

char buffer[480000];

The platform I am using is eVC for Pocket PC Phone Edition. Does anyone have a code example they could share with me? The snippets don’t seem to be clear enough. Here’s the code I have:

The First part is the actual wininet calls, for reference:

if(!InternetCrackUrl(strUrl, strUrl.GetLength(), 0, &UrlComponents))
MessageBoxW( NULL, L"InternetCrackURL() failed" , L"Message", MB_ICONHAND|MB_OK);
errexit(hInternet, "InternetCrackURL() failed: %d\n", GetLastError());

CString strFindIn = UrlComponents.lpszHostName;
CString strFindWhat = UrlComponents.lpszUrlPath;
int iLen = strFindIn.GetLength();
int n = strFindIn.Find(strFindWhat, 0);
int n1 = strFindIn.Delete(n, strFindWhat.GetLength());

hConnect = InternetConnect(hInternet, strFindIn , UrlComponents.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (hConnect == NULL)
        MessageBoxW( NULL, L"InternetConnect() failed"  , L"Message", MB_ICONHAND|MB_OK);

hHttpRequest = HttpOpenRequest(hConnect, NULL, UrlComponents.lpszUrlPath, NULL, NULL, (LPCTSTR*)AcceptTypes, 0, 0);
if (hHttpRequest == NULL)
    MessageBoxW( NULL, L"HttpOpenRequest() failed"  , L"Message", MB_ICONHAND|MB_OK);

if (!HttpSendRequest(hHttpRequest, NULL, 0, NULL, 0))
    MessageBoxW( NULL, L"hHttpRequest() failed"  , L"Message", MB_ICONHAND|MB_OK);

length_buffer_size = sizeof(length_buffer);
if(!HttpQueryInfo(hHttpRequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &length_buffer, &length_buffer_size, NULL)) 
    MessageBoxW( NULL, L"HttpQueryInfo() failed"  , L"Message", MB_ICONHAND|MB_OK);


    ret = InternetReadFile(hHttpRequest, buffer, sizeof(buffer), &length);

failed" , L"Message", MB_ICONHAND|MB_OK);

} while (length > 0 && ret);{

    MessageBoxW( NULL, L"InternetReadFile failed"  , L"Message", MB_ICONHAND|MB_OK);


And Here is the code I’m using for the streaming part:

[code:t9ou02do]signed char streamcallback(FSOUND_STREAM *stream, void *buff, int len, int param)
signed short *stereo16bitbuffer = (signed short *)buffer;

memcpy(stereo16bitbuffer, buffer, 480000); 
return 1; 


void PlayStream()

stream = FSOUND_Stream_Create(streamcallback, 48000 & 0xFFFFFFF0, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 24000, 12345);
streamchan = FSOUND_Stream_Play(FSOUND_FREE, stream);


This runs “OK”, but absolutely no sound plays. If I use this statement:

[code:t9ou02do]signed short *stereo16bitbuffer = (signed short *)buff;
memcpy(stereo16bitbuffer, buffer, len); [/code:t9ou02do]

I get a bunch of digital noise.

Any Help is MUCH appreciated! I’m really stuck here!

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.