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.
This is the thread I’ve been reading: http://220.127.116.11/questions/question/dsp-getparameterdata-silent-crash-unity But I didn’t understand how to actually write the spectrum and wave data to a float array.
So far I have:
FMOD.DSP spectrumDSP; fmodSystem.createDSPByType(FMOD.DSP_TYPE.FFT, out spectrumDSP); spectrumDSP.setParameterInt((int)FMOD.DSP_FFT.WINDOWSIZE, 512); spectrumDSP.setParameterInt((int)FMOD.DSP_FFT.WINDOWTYPE, (int)FMOD.DSP_FFT_WINDOW.HAMMING); channel.addDSP(0, spectrumDSP);
I also have this:
System.IntPtr data; int dataLength = 0; FMOD.DSP_PARAMETER_FFT fftParam; spectrumDSP.getParameterData ((int)FMOD.DSP_FFT.SPECTRUMDATA, out data, out dataLength);
I’m getting the spectrum like in this thread:
However this will return an array of zeroes with the right amount of channels and the right size.