I’m new to FMOD. I have created a little test app in C# using the latest FMOD Ex. I am analysing the wave data and FFT graph in order to run some very simple threshold analysis, ie how often do values on the graph exceed a specified value. This works great, but I have placed this code in the OnPaint() method (not great I know but its just a quick test app). This means that the analysis is only carried out on a sample when the form is re-drawn, and therefore I assume that the analysis will ‘miss’ many samples which are being played from the MP3 file while the form is not being re-drawn.
My question is: where is the best place to carry out this analysis? Should I place the analysis in the timer_Tick() event, or is there a better location which would allow me to analyse every sample in turn coming from the mp3 file?
Hope I’ve explained that well enough.
Thanks for your time
- sharris asked 9 years ago
The FMOD examples uses a timer to invoke a controls Update() method (usually a picbox). However, you may also consider a backgroundworker object. I have done some analysis with Threads before, but I dont reccomend it (maybe its becuase I have bad luck with those).
If you want to catch "everything" you could probably do the analysis in a backgroundworker / timer, store the values, then draw the data with a timer that calls an Update() method. This way it calculates what it needs to, but doesnt have to draw it that often.
- nci answered 9 years ago
Using a DSP, no need to update the system to trigger the callbacks.
Unless you are synchronizing specifically the mixer thread with update calls (which is not the default case, and not supported the same way depending on the architecture))
btw, you will have to deal with threads as the mixer thread is not in the same as the main thread (suposedly the one which created the system)
you could lock the fmod engine then access your data from the main thread for example.
Thanks for the above help. Looking at the dsp_custom example, I think I will start by trying FMOD_DSP_READCALLBACK as that callback can be inserted into the DSP network to read the data as it passes through the DSP unit.
Thanks again for the help, much appreciated.
- steve.h84 answered 9 years ago
Please login first to submit.