0
0

Hi,

I’m beginning in c.. and I get a problem while trying to launch my first code using fmod :

[code:32qi41f4]#include <stdio.h>

include <stdlib.h>

include <fmod/fmod.h>

int
main(int argc, char *argv[])
{
FSOUND_SAMPLE *gun = NULL;

    FSOUND_Init(44100, 32, 0);

    gun = FSOUND_Sample_Load(FSOUND_FREE, &quot;gun.wav&quot;, 0, 0, 0);
    if (gun == NULL) {
            printf(&quot;can't load.\n&quot;);
            exit(EXIT_FAILURE);
    }
    FSOUND_PlaySound(FSOUND_FREE, gun);

    FSOUND_Sample_Free(gun);
    FSOUND_Close();

    return EXIT_SUCCESS;

}[/code:32qi41f4]

[quote:32qi41f4]$ gcc -O3 -std=gnu89 -pedantic -Wall -lfmod -o fmod main.c

$ ./fmod
can’t load.

$ ls -l
-rwxr-xr-x 1 nxt nxt 8365 2006-08-05 06:18 fmod
-rw-r–r– 1 nxt nxt 426 2006-08-05 06:16 main.c
-rw-r–r– 1 nxt nxt 107698 2006-08-05 04:02 gun.wav[/quote:32qi41f4]

Do you have any suggestion ? (I’m using the last version, my installation is may be not good :/ (on ubuntu dapper))

[quote:32qi41f4]$ wget http://52.88.2.202/files/fmodapi375linux.tar.gz
(…)

$ tar -xf fmodapi375linux.tar.gz

$ cd fmodapi375linux/api/ && tree
.
|– delphi
| -- (...)
|-- inc
| |-- fmod.h
| |-- fmod_errors.h
| |-- fmoddyn.h
|
— wincompat.h
`– libfmod-3.75.so

2 directories, 10 files

$ sudo cp libfmod-3.75.so /usr/lib/libfmod.so

$ sudo cp –recursive inc/ /usr/include/fmod
[/quote:32qi41f4]

Thanks for your help :}

  • You must to post comments
0
0

well, uh, i just need to reboot, don’t know why :/

sorry :/

[b:3m2x2s1g]EDIT:[/b:3m2x2s1g] hum, the problem is still there : when i begin a new project, it refuses to read the file – and when i reboot, it solves the problem. I can do with it, but if anyone has an idea, it would be great 😀 .

  • You must to post comments
0
0

Did you call FSOUND_GetError?. i dont know why you’re getting load failure, but i do know your program is not going to work if you just free the sample immediately after calling play. You have to wait for it to finish playing.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.