0
0

ive read the help and i understand what all the functions should do but i just cant seem to get wavs and mp3s to play. Midi i can do. so whats wrong with this code:

pragma comment(lib, “fmodvc.lib”)

include “conio.h”

include <iostream>

include “fmod.h”

using namespace std;

define SONG “chimes.wav”

int main()
{
FSOUND_Init(44100, 32, 0);
FSOUND_SAMPLE* fmodModule;
fmodModule = FSOUND_Sample_Load(SONG);
FSOUND_PlaySound(fmodModule);
cout << “Playing ” << FMUSIC_GetName(fmodModule);

getch();

FMUSIC_FreeSong(fmodModule);
FSOUND_Close();

return 0;

}

so my questions are, what do i have to do to get my chimes wav playing and yes it is in the same directory. Problems seem to be occuring aroud the sampleload function.

also what does getch() mean, i can only assume that it means ‘get character’ if it measn this why wont it play the midi (which i can get working) if you take it out?

thanks for any help and sorry for being such a no0b

  • You must to post comments
0
0

getch means wait for an input from the keyboard

  • You must to post comments
0
0

yeah i thought as much, i cant explain why if i remove that, and the include that allows it, the entire file doesnt play if you do the midi set up. Do you have any idea why the wav file wont play from the code?

  • You must to post comments
0
0

i dont suppose you can rewrite the code i give so that it plays the file?

im really stuck with this.

  • You must to post comments
0
0

im no c expert and i havent tested it but this should work
[code:2f1kmkwc]

pragma comment(lib, "fmodvc.lib")

include "conio.h"

include <iostream>

include "fmod.h"

using namespace std;

define SONG "chimes.wav"

int main()
{
FSOUND_Init(44100, 32, 0);
FSOUND_SAMPLE* fmodModule;
fmodModule = FSOUND_Sample_Load(FSOUND_FREE,SONG,FSOUND_NORMAL);
FSOUND_PlaySound(FSOUND_FREE,fmodModule);
cout << "Playing " << SONG;

getch();

FSOUND_Sample_Free(fmodModule);
FSOUND_Close();

return 0;
}
[/code:2f1kmkwc]

  • You must to post comments
0
0

thanks for the code and yes i did check the simple example but if the above works then that is simpler, or at least i think so.

the above code produces

a line that says eh.h this is not c++ or something, this poinys to the header file as well. Whats that all about? or it says

main.cpp(13) : error C2660: ‘FSOUND_Sample_Load’ : function does not take 3 parameters

or 2 if i remove the end one and leave free and song. Man it looked like i could have a good bash at this butits looking increasingly harder. phew

finally – last edit – now that i can get files to play mids and wavs (the two ill prolly use most i need to make this thing do something now. Thanks again people you have been great
waw ive got it working now

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.