0
0

Hi,

Could you please tell me the internal layout in memory of the following two structs?

FSOUND_Sample
FSOUND_Stream

I am planning to implement loading from a virtual file system where the files might be in archives and want to keep this transparent to the user and therefore want to implement my own versions of the loading routines.

Thanks in advance

kezz

  • You must to post comments
0
0

Use the file callbacks. That’s what they are for. You implement your own open, close, read, seek and tell functions and tell FMOD to use those. I have used this to get FMOD to read data from a ZIP file.

  • You must to post comments
0
0

I understand that callbacks are the way to go but my problem is what format/structure do I load the data to in my own load function?

  • You must to post comments
0
0

You don’t have to format it in any special way. You have the files in your archive. You supply functions that open, close, read, seek and tell files from the archive. You give FMOD pointers to these functions and then FMOD calls those functions to do any file reading that it requires. You just give FMOD the block of file data that it asks for and FMOD will do the processing of the file data.

For example, your archive might contain a file called ‘explode.wav’. FMOD will call your open callback with ‘explode.wav’ as the parameter. Your archive routines locate the file called ‘explode.wav’ and return a handle to FMOD. This handle could any integer-sized value that uniquely identifies the open file ‘explode.wav’ in your archive. I usually use a pointer to a structure that contains information about the open file. FMOD will then call the read callback, passing it a pointer to read the data into, the size of the data it is expecting in bytes and the handle to the file that you returned from the open callback. You then just copy the said number of bytes from your archive to the data buffer provided by FMOD.

  • You must to post comments
0
0

Ok thanks for the reply.

Any pointers on implementing a stream load function because it kind of defeats the object of streaming if the whole file loaded into memory at once.

  • You must to post comments
0
0

It depends on how your archive system works. Can it handle reading small sections of a large file contained in the archive? If so, then all your work is done for you. FMOD never asks for the entire file. It will ask you only for the section of the file that it requires at that time.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.