I’m trying to replicate
user_created_sound low level cpp sample in Unity, but getting error from %subj%.
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
exinfo.numchannels = 2;
exinfo.defaultfrequency = 44100;
exinfo.decodebuffersize = 44100;
exinfo.length = (uint)( exinfo.defaultfrequency * exinfo.numchannels * 2 * 5 ); // 2 == sizeof(short) or Int16 or two bytes per sample in channel
exinfo.format = FMOD.SOUND_FORMAT.PCM16;
exinfo.pcmreadcallback = this.pcmreadcallback;
exinfo.pcmsetposcallback = this.pcmsetposcallback;
result = system.createSound( "", FMOD.MODE.OPENUSER | FMOD.MODE.CREATESTREAM, ref exinfo, out sound);
// here result == FMOD.RESULT.OK
result = system.playSound(sound, null, false, out channel);
// here result == FMOD.RESULT.ERR_INVALID_POSITION
Both callbacks defined as specified by respective delegate get called from/by
createSound with proper parameters… , but playSound always fails with seeking error ( no callbacks, obviously, are called afterwards ); is this an overlook in the c# wrapper / unity plugin, or am I doing something very stupid ?