Howdie allegators.. I'm working on a simple openGL (allegroGL) demo and It's coming along quite nicely:
http://www.allegro.cc/files/attachment/594379
http://www.allegro.cc/files/attachment/594380
http://www.allegro.cc/files/attachment/594381
(sorry for the size)
But i have a problem(duh), These effects are somewhat boring and i want to create scenes with more fluffy side content, one thing i want too do is syncing some effect with the music I'll be playing, to do this i want to get the channel spectrum from fmod to use, I've searched their forum for post on the matter but they all seem to old to work with my current version or something :S..
here's how i play a sound:
FMOD_System_Create(&fmod_system); FMOD_System_Init(fmod_system, 16, 0, NULL); FMOD_System_CreateSound(fmod_system, "music.mp3", FMOD_2D, NULL, &music); FMOD_System_PlaySound(core->fmod_system, (FMOD_CHANNELINDEX)1, core->music, FALSE, NULL);
I hope someone has a spectrum analyzing code compatible with my code
..
Thank you very much for your support
.
FMOD Ex has a Channel::getSpectrum method that does exactly what you want. It basically gives you a parametrized spectrum of whatever sound is playing on the channel.
I don't really know about regular FMOD, but it should have something similar, and I'm pretty sure it has some very general FFT stuff.
EDIT: A quick Google revealed regular FMOD has something called FMOD_System_GetSpectrum that is equivalent.
EDIT: I think I've gotten it to work.. NOT.
It doesn't crash now at least..
Here's a picture of the visualisation:
{"name":"594386","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/c\/6c313d7c8d357f9f84b068d6810b143d.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/c\/6c313d7c8d357f9f84b068d6810b143d"}
This does not move at all :S. I've read a lot about every value being 0 but i haven't found any information on this..
Hmm.. it seems to return 0.
I call FMOD_System_GetSpectrum every time i draw this.
Well, it wouldn't hurt if you showed us some code, you know.
Like what sort of code? All possible code related to the spectrum has already been posted :S.
woops.. when i said it returns 0 i meant FMOD_System_GetSpectrum retuned 0
..
FMOD_System_GetSpectrum return something between 0 and 1, so if you cast that into an int, there is a high chance you will always got a 0
if(FMOD_System_GetSpectrum(fmod_system, spectrum, 512, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE) == 0.0f)core->running = false; is the condition valid? This closes my application as supposed to if GetSpectrum returns 0.0f.
I do not see why you use GetSpectrum to see if the song is finished or not.
Edit: I got it work now
, thank you.
I don't.. i just use the core->running = false; approach to confirm things fast and easy.. when "running" is true the application will go on, when "running" is false the application will close.