0
0

Dear FMOD,

 I compile mp3 file into execute file. By "LoadResource", to load data into buffer. How could we play buffer data ?

 It may be FMOD_FILE_READCALLBACK etc. Any suggestion ? Please descript detail.
  • You must to post comments
0
0

Hi zxcvbnm, welcome to the FMOD Forum.

The best way to load sound from memory is to use FMOD_OPENMEMORY or FMOD_OPENMEMORY_POINT. Take a look at the ‘loadfrommemory’ example to see how this can be used.

  • You must to post comments
0
0

Thanks Peter, is there any code demo ? I search forum, all is brief.

  • You must to post comments
0
0

Take a look at the examples, usually located at:

C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\examples

  • You must to post comments
0
0

Ok, I got.

The key is FMOD_OPENMEMORY, it could decode MP3 data from memory buffer.

But FMOD_OPENMEMORY_POINT will NOT !

// VS2008 C++ Demo
//////////////////////////////////////////////////////////////////////////////
// MUSIC1 is Resource Symbol
// Add [color=#0000FF:pmd6oyhu]MUSIC1 MP3 "xxxxx.mp3"[/color:pmd6oyhu] to Resource Includes –> Compile-time directives
HRSRC hRsrc = FindResource(NULL, MAKEINTRESOURCE(MUSIC1), TEXT("MP3"));

if(hRsrc)
{
// Get data size
DWORD dwSize = SizeofResource(NULL, hRsrc);
HGLOBAL hGlobal = LoadResource(NULL, hRsrc);
LPVOID pBuffer = LockResource(hGlobal);
}

FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.length = dwSize;
psystem->createSound((const char *)pBuffer, FMOD_HARDWARE|FMOD_OPENMEMORY, &exinfo, &psound);
//////////////////////////////////////////////////////////////////////////////

pBuffer is MP3 data which loading from file or Resource(compiled , EXE, DLL, etc). It’s encoded data !

To share this with fans.

Thanks again, peter.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.