|
|
| Fmod Spectrum problems |
|
Albin Engström
Member #8,110
December 2006
|
Howdie allegators.. I'm working on a simple openGL (allegroGL) demo and It's coming along quite nicely: 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 |
|
Jakub Wasilewski
Member #3,653
June 2003
|
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. --------------------------- |
|
Albin Engström
Member #8,110
December 2006
|
EDIT: I think I've gotten it to work.. NOT. It doesn't crash now at least.. 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. |
|
Jakub Wasilewski
Member #3,653
June 2003
|
Well, it wouldn't hurt if you showed us some code, you know. --------------------------- |
|
Albin Engström
Member #8,110
December 2006
|
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 |
|
GullRaDriel
Member #3,861
September 2003
|
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 "Code is like shit - it only smells if it is not yours" |
|
Albin Engström
Member #8,110
December 2006
|
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. |
|
GullRaDriel
Member #3,861
September 2003
|
I do not see why you use GetSpectrum to see if the song is finished or not. "Code is like shit - it only smells if it is not yours" |
|
Albin Engström
Member #8,110
December 2006
|
Edit: I got it work now 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. |
|
|