Hello again, I switched from SquareTangle’s FMOD integration to the official integration and found some key differences. I was able to fix most of the problems but I am still having trouble with something. When I write channel.getSpectrum(left, 512, 0, FMOD.DSP_FFT_WINDOW.HAMMING); I get an FMOD.Channel' does not contain a definition forgetSpectrum’ and no extension method getSpectrum' of typeFMOD.Channel’ could be found error. I searched the forums and I found out that I need to add a DSP to the channel after I have played the sound in order to be able to get the spectrum and then I have to use getParameters to get the spectrum and wave data. But how exactly am I supposed to do that ? I am reusing this channel (meaning that I play different sounds on it) should I add a DSP every time after I play a new sound ? I want to get the current spectrum and wave data on every frame of the game.
System.IntPtr data;
int dataLength = 0;
FMOD.DSP_PARAMETER_FFT fftParam;
spectrumDSP.getParameterData ((int)FMOD.DSP_FFT.SPECTRUMDATA, out data, out dataLength);
After a whole night of struggling I was able to finally get it to sort of work but I found out that with the new FMOD I have to have the channel playing with volume bigger than 0 for the spectrum to return anything else bigger than zero. I’m currently not being able to return the right values (they seem to be a lot smaller than before) but I’ll keep working on it!
I also need to add the DSP every time I want to get the spectrum:
Use FMOD_CHANNELCONTROL_DSP_TAIL as the first argument to addDSP, this will put the FFT node before the filter so it will be unaffected by volume changes.
Also you need to for wait for audio data to pass through the FFT between calling addDSP and the time you call getParameterData, otherwise it will return all zero.
Thanks, Nicholas! That’s a great tip! I managed to get the spectrum working but I’m still trying to find out the equivalent to getWaveData from the old FMOD. So far I’ve found that I can use Sound.lock but I am unsure how to use it exactly.