Advertisement

FMOD.

Started by September 28, 2004 02:23 AM
0 comments, last by rholding2001 20 years, 1 month ago
ok ive done the quick tutorial on this and added everything, im getting no errors but i cant hear the chimes sound on execute. I dont see anywhere in the code where its dir is being defined so i put the file in the projects folder and in its debug folder but still noting. How do i get the file to play. here is the code : #include <conio.h> #include "fmod.h" FMUSIC_MODULE* handle; int main () { // init FMOD sound system FSOUND_Init (44100, 32, 0); // load song handle=FMUSIC_LoadSong ("chimes.wav"); // play song only once // when you want to play a midi file you have to disable looping // BEFORE playing the song else this command has no effect! FMUSIC_SetLooping (handle, false); // play song FMUSIC_PlaySong (handle); // wait until the users hits a key to end the app while (!_kbhit()) { } //clean up FMUSIC_FreeSong (handle); FSOUND_Close(); return 0; } the file is in the windoes media folder. How do you make this sound play?
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
to add. it works with .mid files if you make the code look like this

#pragma comment(lib, "fmodvc.lib")

#include <stdio.h> // Here we include the standard include file
#include <stdlib.h> // This is included so we can use exit()
#include <conio.h> // This is used so we can use _kbhit() and getch()
#include "fmod.h" // This is the fmod header file that we need to use fmod

#define SONG "chimes.mid"

int main()
{
FMUSIC_MODULE* fmodModule;


// Initialize our FMod Sound System with good quality sound and a global focus

FSOUND_Init(44100, 32, 0);
//FSOUND_INIT_GLOBALFOCUS can be added for the 0 to make the sound play whatever window is open

fmodModule = FMUSIC_LoadSong(SONG);

// PLAY SONG

FMUSIC_PlaySong(fmodModule);
printf("Press any key to quit\n");

printf("Playing %s...\n", FMUSIC_GetName(fmodModule));
getch();
FMUSIC_FreeSong(fmodModule);
FSOUND_Close();


return 0;
}
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.

This topic is closed to new replies.

Advertisement