I need to play byte array data like sound using FMOD. How can I do it? I was searching for a long time, but I didn’t understand nothing and I didn’t find examples.
I tried like that, but I failed:
FMOD.System mainSystem;
FMOD.Factory.System_Create(out mainSystem);
mainSystem.init(512, INITFLAGS.NORMAL, (IntPtr)0);
FMOD.Sound sound = new FMOD.Sound();
var newArr = wp.getBytesOfAssetsArray()[4];
var info = new FMOD.CREATESOUNDEXINFO();
info.cbsize = MarshalHelper.SizeOf(typeof(FMOD.CREATESOUNDEXINFO));
info.format = SOUND_FORMAT.PCM16;
info.defaultfrequency = 51000;
info.length = (uint)newArr.Length;
mainSystem.createSound(newArr, FMOD.MODE.OPENMEMORY | FMOD.MODE.OPENRAW | FMOD.MODE.CREATESAMPLE, ref info, out sound);
var channelGroup = new FMOD.ChannelGroup();
var mainChannel = new FMOD.Channel();
var mainDSP = new FMOD.DSP();
mainSystem.playSound(sound, channelGroup, false, out mainChannel);
mainSystem.createDSPByType(Helper.FMODHelper.generateRandomDsp(3), out mainDSP);
mainChannel.addDSP(0, mainDSP);
System.Threading.Thread.Sleep(new Random().Next(5000, 8000));
sound.release();
mainChannel.removeDSP(mainDSP);