0
0

Hi

I am using FMOD in an C++ App running on a CD, because it is on a CD i don’t want to use FSOUND_Stream and stream the MP3 file from the CD (for obvious reasons :) ).

So i want to use the LOADMEMORY flag, and my question is:

How do i load the file to the memory, does FMOD have a function for this or does the Windows API have one that is simple to use?

Sorry for the newbie question but i got everything to work except for this 😳

Oh .. i use Borland C++ Builder 6.0 @ Win XP using latest FMOD 3.71

Regards,
Mattias

  • You must to post comments
0
0

i guess you should be helped with CreateFile() and ReadFile() of the win32 API….

  • You must to post comments
0
0

If you are using C++ Builder, take a look at TMemoryStream. Load the file into the TMemoryStream and then use that as your memory block. I don’t have any sample code on me at the moment, but I should be able to find something later.

  • You must to post comments
0
0

Thank u, much appreciated :)

  • You must to post comments
0
0

[quote="brett":11c1c8tj]the fmod stream example actually has an ifdef that shows streaming from memory :-?[/quote:11c1c8tj]

Ah yes i see, i was lookin on the fopen etc myself in the help file but couldn’t figure it out, i will try the example :)
To be exact i dint understand how to go from the FILE to char but now i see.

  • You must to post comments
0
0

This is a Delphi snippet for opening a stream from a TMemoryStream.
[code:cz7buuaa] FStreamData := TMemoryStream.Create;
FStreamData.LoadFromFile(’../../media/jules.mp3’);
FStream := FSOUND_Stream_Open(PChar(FStreamData.Memory), FSOUND_LOADMEMORY, 0, FStreamData.Size);
FSOUND_Stream_Play(FSOUND_FREE, FStream);
[/code:cz7buuaa]then[code:cz7buuaa] FSOUND_Stream_Close(FStream);
FStreamData.Free;
[/code:cz7buuaa]

The equivalent C++ Builder snippet would be this.
[code:cz7buuaa] streamData = new TMemoryStream;
streamData->LoadFromFile("../../media/jules.mp3");
stream = FSOUND_Stream_Open((char *)streamData->Memory, FSOUND_LOADMEMORY, 0, streamData->Size);
FSOUND_Stream_Play(FSOUND_FREE, stream);
[/code:cz7buuaa]then[code:cz7buuaa] FSOUND_Stream_Close(stream);
delete streamData;
[/code:cz7buuaa]

  • You must to post comments
0
0

Thanks :)

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.