FMOD Engine User Manual 2.03
APIs and types for HTML5 platform.
FS_createPreloadedFile.ReadFile.FS_createPreloadedFile.FS_createPreloadedFile.FS_createPreloadedFile.FS_createPreloadedFile.Mounts a local file so that FMOD can recognize it when calling a function that uses a filename. Should be called in prerun.
FS_createPreloadedFile(ptr, value, type);
Whether the file should have read permissions set from the program’s point of view.
Whether the file should have write permissions set from the program’s point of view.
function prerun()
{
var fileUrl = "/public/js/";
var fileName = "Master.Bank";
var folderName = "/";
FMOD.FS_createPreloadedFile(folderName, fileName, fileUrl + fileName, true, false);
}
Wrapper for the emscripten function.
See Also: ReadFile
Read the entire contents of a file into a memory variable, as preloaded by FS_createPreloadedFile.
ReadFile(system, value, type);
result = FMOD.ReadFile(gSystemCore, "/" + filename, outval);
CHECK_RESULT(result);
memoryPtr = outval.val; // Pointer to FMOD owned file data. See below where FMOD.Memory_Free is used to free it.
memoryLength = outval.length; // Length of FMOD owned file data
result = gSystem.loadBankMemory(memoryPtr, memoryLength, FMOD.STUDIO_LOAD_MEMORY, FMOD.STUDIO_LOAD_BANK_NONBLOCKING, outval);
CHECK_RESULT(result);
Call Memory_Free on the variable after using it.
Free memory allocated by FMOD internally in ReadFile.
Memory_Free(ptr);
See Also: ReadFile
Helper function to open a file that was preloaded by FS_createPreloadedFile.
file_open(system, filename, filesize, handle);
See Also: file_close, file_read, file_seek
Helper function to close a file manually that was preloaded with FS_createPreloadedFile.
file_close(handle);
See Also: file_read, file_seek
Helper function to read from a file that was preloaded with FS_createPreloadedFile.
file_read(handle, buffer, sizebytes, bytesread);
See Also: file_open, file_close, file_seek
Helper function to seek a file manually that was preloaded with FS_createPreloadedFile.
file_seek(handle, pos);
See Also: file_close, file_read
Store a value at a specific FMOD memory address.
setValue(ptr, value, type);
for (var samp = 0; samp < length; samp++)
{
for (var chan = 0; chan < outchannels; chan++)
{
// This DSP filter just halves the volume! Input is modified, and sent to output.
let val = FMOD.getValue(inbuffer + (((samp * inchannels) + chan) * 4), 'float') * dsp_state.plugindata.volume_linear;
FMOD.setValue(outbuffer + (((samp * outchannels) + chan) * 4), val, 'float');
}
}
Wrapper for the emscripten function.
See Also: getValue
Retrieve a value from a specific FMOD memory address.
getValue(ptr, value);
for (var samp = 0; samp < length; samp++)
{
for (var chan = 0; chan < outchannels; chan++)
{
// This DSP filter just halves the volume! Input is modified, and sent to output.
let val = FMOD.getValue(inbuffer + (((samp * inchannels) + chan) * 4), 'float') * dsp_state.plugindata.volume_linear;
FMOD.setValue(outbuffer + (((samp * outchannels) + chan) * 4), val, 'float');
}
}
Wrapper for the emscripten function.
Return value
If this method succeeds, it returns an integer value stored at the specified memory address.
See Also: setValue
Helper function to seek a file manually that was preloaded with FS_createPreloadedFile.
file_seek(handle, pos);
See Also: file_close, file_read