I am new to fmod and am trying to create a simple vu meter.
I have not been able to get the FSOUND_GetCurrentLevels() function to work yet. It will compile (dev_Cpp) fine but when I run the program I get “your program has encountered a problem and needs to close” dialog.
I am not sure what Ive done wrong. Any suggestions would be great.
using namespace std;
int main(int argc, char *argv)
float *l; float *r; FSOUND_Init(44100, 32, 0); cout <<"fsound initialized"<< endl; FSOUND_SAMPLE * mysample; mysample = FSOUND_Sample_Load(0,"drive_on.wav",0,0,0); cout <<"sample drive_on.wav loaded"<< endl; FSOUND_PlaySound(0,mysample); cout <<"sample drive_on.wav playing"<<endl; FSOUND_GetCurrentLevels(0,l,r); system("PAUSE"); FSOUND_Close(); return EXIT_SUCCESS;
- williac asked 13 years ago
you are passing null pointers to the function so it is crashing, you should declare l and r as float variables then pass pointers to them to the function like this:
- birty answered 13 years ago
Thanks for the reply [color=yellow:qpano6x8]birty[/color:qpano6x8].
The code edited as you suggested works perfectly!!!!!!!!
I am new to C++ and was having a hard time with pointers.
Yesterday I purchased a book on C++ and now understand them much better.
thanks again for the quick response!!!!!!!
- williac answered 13 years ago
Please login first to submit.