(This is with the HTML5 API!)
I’ve been trying to use System::createSound to create a sound for a programmer instrument. Everything I’ve done gives me some kind of error. (I was originally trying to load from a remote http URL but I soon realized that was not possible.)
- Trying to load from a string with a path to a local file gives me
"File not found."
- Trying to load from a buffer gives me
"File not found."
- Trying to set the
OPENMEMORY flag gives me "An invalid parameter was passed to this function."
- Calling
FS_createPreloadedFile in the preload function seems to allow createSound to recognize the file but it gives me "Unsupported file or audio format." (it’s a wav file)
Any help would be greatly appreciated!
I recently solved this problem in the meantime after reading countless posts on this forum. Thanks anyways.
Looking back on the code, it seems like I ended up needing to use createStream instead of createSound.
If it helps, this was the final chunk of code (in a callback function for the event that required a programmer instrument):
case FMOD.STUDIO_EVENT_CALLBACK_CREATE_PROGRAMMER_SOUND:
const exinfo = FMOD.CREATESOUNDEXINFO();
exinfo.length = this.sound.length;
let sound = {};
assert(core.createStream(this.sound.buffer, FMOD.OPENMEMORY | FMOD.LOOP_OFF, exinfo, sound));
params.sound = sound.val;
params.subsoundIndex = -1;
break;
1 Like
Thank you! My problem was just a mix of bad paths and corrupted/empty files, but switching to stream fixed other issues
1 Like