0
0

Hi,

fmod newbie (and weak programmer) needs your help coding a sample containing some seconds of noise. Based on the fmod “custom samples” tutorial I tried something like the following code. It compiles fine and runs without errors – but also without creating any sound. :-( .
All sample programs are running without problems.

Thanks!

[code:3fc5vn9m]

include ...

include "fmod\fmod.h"

include "fmod\fmod_errors.h"

int i, data1[88200];
FSOUND_SAMPLE* sample;

int main(int argc, char* argv[])
{
srand( (unsigned)time( NULL ) );

FSOUND_Init(44100, 32, FSOUND_INIT_ACCURATEVULEVELS);

sample = FSOUND_Sample_Alloc(FSOUND_FREE, 88200,FSOUND_LOOP_NORMAL |    

FSOUND_NORMAL | FSOUND_MONO, 44100, 255,128,255);

for(i=0; i<=88200; i++)
{
     data1[i]=rand();
}


if (!FSOUND_Sample_Upload(sample,data1,FSOUND_LOOP_NORMAL               |FSOUND_NORMAL|FSOUND_MONO))
{
    printf("%s\n", FMOD_ErrorString(FSOUND_GetError()));
    exit(1);
}

FSOUND_PlaySound(0, sample);

return 0;

}

[/code:3fc5vn9m]

  • You must to post comments
0
0

Why are you initializing FMOD with the FSOUND_INIT_ACCURATEVULEVELS flag? Since it doesnt seem like you are using the VU at all. What exactly is Data1 for?? It looks to me like all it does is fill an array with random data.

  • You must to post comments
0
0

Your program is exiting before the sound gets a chance to play. Try putting something like :

[code:2w7ncsll]char key = getch();[/code:2w7ncsll]

…after your FSOUND_PlaySound.

  • You must to post comments
0
0

Wow, that was an easy one. :roll: Thank’s a lot !

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.