0
0

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?

Thanks :smile:

  • You must to post comments
0
0

I have 512 MB RAM, AMD 900, ASUS-Board with VIA-Chipset and Windows 98. The MP3-File is 3 MB (3 min. sound).
:(

  • You must to post comments
0
0

Then what? Do you then do as the original poster did only using the actual size of the loaded resource data?

  • You must to post comments
0
0

If your screensaver eats too much CPU time, the audio could stutter, but that’s not very likely. Perhaps you’re doing something to FMod’s audio engine? (Switching focus, calling some function over and over, etc.)

  • You must to post comments
0
0

Another question:
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!

  • You must to post comments
0
0

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. :smile:

<font size=-1>[ This Message was edited by: DELTRON on 2001-11-28 12:17 ]</font>

  • You must to post comments
0
0

Hi brett,

ok, i’m a newbie…

[code:1ugrggz8]
HMODULE hmodule = LoadLibrary("soundDLL.dll");
HRSRC rec;
HGLOBAL handle;
void *data;
int length;
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);
[/code:1ugrggz8]

m_pSound is always NULL :-( does anyone know why?
thanx

  • You must to post comments
0
0

I dont know why, but maybe your FMOD knows =)
Check the error code with FSOUND_GetError and then you know what’s the problem.

  • You must to post comments
0
0

erm… Error Code 14.
What’s this?
FMOD_ERR_INVALID_PARAM?

is (const char *)data wrong?

please help me ๐Ÿ˜ฅ

  • You must to post comments
0
0

FindResource returns NULL and GetLastError() returns also NULL…

Anyone know a tutorial for FindResource? I’m Going Crazy! ๐Ÿ‘ฟ

  • You must to post comments
0
0

๐Ÿ˜€

rec = FindResource(hmodule, “#101″,”MYMP3”);

(MSDN rules!)

It works perfect! but if i use this code in my game it “lags” sometimes…

any idea?

cheers

mod

  • You must to post comments
0
0

I mean stuttering sound. I was playing around with FSOUND_SetBufferSize but it couldn’t solve the problem.

  • You must to post comments
0
0

Your mp3 file is entirely decoded when you load it as a sample, and stored as uncompressed pcm data in your pc’s memory.
My theory:
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.

  • You must to post comments
Showing 12 results
Your Answer

Please first to submit.