I have my mp3 included as a resource in my c++ code(called IDR_MYTYPE1).
I am trying to load and decode an mp3 from my internal resource rather than from a file. (loading/decoding from file works).
The code for loading from my resourse is:
samp1 = FSOUND_Sample_Load(FSOUND_FREE, MAKEINTRESOURCE(IDR_MYTYPE1), FSOUND_LOADMEMORY,sizeof(IDR_MYTYPE1));
It compiles ok, but crashes when executed.. :/
Can anyone help?
Can anyone tell me how or does anyone have a good tutorial or something out there for embedding MP3, .wavs, etc. in your Visual C++ executable? I’m writing a screensaver and am trying to figure out how to actually load the .MP3s and such as resources. Thanks!
Thanks for the help Brett! That solved the length problem, but I still get an error when trying to pass location of the memory image;
samp1 = FSOUND_Sample_Load(FSOUND_FREE, data, FSOUND_LOADMEMORY,length);
The compile error I get is:
‘FSOUND_Sample_Load’ : cannot convert parameter 2 from ‘void *’ to ‘const char *’
Please forgive my ignorance.
<font size=-1>[ This Message was edited by: DELTRON on 2001-11-28 12:17 ]</font>
ok, i’m a newbie…
HMODULE hmodule = LoadLibrary("soundDLL.dll");
rec = FindResource(hmodule, MAKEINTRESOURCE(IDR_MYMP31),RT_RCDATA);
handle = LoadResource(hmodule, rec);
data = LockResource(handle);
length = SizeofResource(hmodule, rec);
m_pSound = FSOUND_Sample_Load(FSOUND_FREE, (const char *)data, FSOUND_LOADMEMORY,length);
m_pSound is always NULL does anyone know why?
Your mp3 file is entirely decoded when you load it as a sample, and stored as uncompressed pcm data in your pc’s memory.
So, if you dont have enough RAM windows may swap the data on your hd, and when playing, it may not be able to swap it back fast enough; the result is stuttering sound.
Please login first to submit.