Anyway, I've managed to fix it by locking on the same semaphore as used in the callback function in frameStarted() and unlocking it in frameEnded(). So it's finally working, thanks to my friend for pointing it out. Release comming soon.
Meanwhile, I've been experimenting a bit with perl, I rewrote the SDL Music Visualizer example to render a frequency spectrum (aka bars).
I found a nice module for doing the Fourier Transform, Math::FFT.
You can find the code here: https://github.com/balazsbela/Visualizer/blob/master/frequency.pl
And here's a screenshot:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaxfjKVTuhHfbjvaNzEezOliIxnu0OqLr4t-iiE8aPorWJP3XPz447MqO-rJ9jpyKkh1VKK8-KuFJYmXlWrwf9q5XDVgdG_PO3oUzQCnvFgTIvZ45EzlWdk2p-Jgf3i3yzIzCJiTIOn2u8/s400/scrviz.png)
All this in 210 lines of Perl. Perl is indeed awesome.
No comments:
Post a Comment