Jump to content
  • Advertisement
Sign in to follow this  
rholding2001

FMOD.

This topic is 5468 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!