0
0

Ok so i’ll paste my code here…i dunno i readed the docs and get some tutorials but i don’t even get this code to work, it cannot open the mp3 file please someone help me to start with fmod !!! lol

include <stdio.h>

include <stdlib.h>

include <iostream.h>

include “fmod.h”

include “fmod_errors.h”

include <windows.h>

int main()
{

FSOUND_STREAM * my_mp3;

FSOUND_Init(44100, 64, 0);

my_mp3 = FSOUND_Stream_OpenFile(“C:\windows\media\chimes.wav”, FSOUND_LOOP_NORMAL, 0);
if(NULL == my_mp3)
{
cout << “Cannot open the file…” << endl;
}
else
{
cout << “Playing…!” << endl;
FSOUND_Stream_Play(FSOUND_FREE, my_mp3);
Sleep(15000);
return 0;
}

return 0;

}

  • You must to post comments
0
0

in fact this line is the problem…it returns always null…

mp3 = FSOUND_Stream_OpenFile(“../../media/test.mp3”,FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 0);

  • You must to post comments
0
0

Try this, ie change the NULL to 0 or false, at least thats how I do it.
You might also have to add a Sleep(10); after the open, in my case I found that I had to do this to make sure it worked correctly.

[code:habcf4kp]
my_mp3 = FSOUND_Stream_OpenFile("C:\windows\media\chimes.wav", FSOUND_LOOP_NORMAL, 0);
if(my_mp3 == 0 )
{
cout << "Cannot open the file..." << endl;
}
else
{
cout << "Playing...!" << endl;
FSOUND_Stream_Play(FSOUND_FREE, my_mp3);
Sleep(15000);
return 0;
}
[/code:habcf4kp]

++Cire.

  • You must to post comments
0
0

thx bud i’ll try it :)

  • You must to post comments
0
0

I found!!!
it work now cuz i put my mp3 file in my project folder and i juste specify :
my_mp3 = FSOUND_Stream_OpenFile(“drumloop.wav”, FSOUND_LOOP_NORMAL, 0);
but thats weird…anyway hehe :)

  • You must to post comments
0
0

lol yeah i just noticed the path, lol.

the path should be…
[code:1uif0vt0]
my_mp3 = FSOUND_Stream_OpenFile("C:\windows\media\chimes.wav", FSOUND_LOOP_NORMAL, 0);
[/code:1uif0vt0]

and lets hope no one else seen it and is rolling thier eyes. :)

++Cire

  • You must to post comments
0
0

well I am ๐Ÿ˜ณ ing and ๐Ÿ˜ฅ ing that you have noticed this. Now i’am hoping you will not be ๐Ÿ˜€ ing too much lol.

Two can play at this game. ๐Ÿ˜‰

++Cire.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.