0
0

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.

[code:2pv4of2e]#include <cstdlib>

include <iostream>

include "fmod.h"

using namespace std;

int main(int argc, char *argv[])
{

float *l;
float *r; 
FSOUND_Init(44100, 32, 0);
cout &lt;&lt;&quot;fsound initialized&quot;&lt;&lt; endl;
FSOUND_SAMPLE * mysample;
mysample = FSOUND_Sample_Load(0,&quot;drive_on.wav&quot;,0,0,0);
cout &lt;&lt;&quot;sample drive_on.wav loaded&quot;&lt;&lt; endl;
FSOUND_PlaySound(0,mysample);
cout &lt;&lt;&quot;sample drive_on.wav playing&quot;&lt;&lt;endl;
FSOUND_GetCurrentLevels(0,l,r);
system(&quot;PAUSE&quot;);
FSOUND_Close();
return EXIT_SUCCESS;

}[/code:2pv4of2e]
Thanks WILLIAC.

  • You must to post comments
0
0

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:
[code:3aa9thpk]float l;
float r;
FSOUND_GetCurrentLevels(0,&l,&r); [/code:3aa9thpk]

  • You must to post comments
0
0

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

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.