0
0

hi there everyone, ive just started to look at programming, in regards sound…yes im am a no0b so my skills are improving.

So far ive managed to get my midi file to play with the help of the tutorial but now i want to pause, stop and loop on command (it loops already) what would i have to look at to be able to do this. Here is the code, im using c++ on windows

void main()
{
//_MODULE good for MIDI (amongst others)
FMUSIC_MODULE *mod = NULL;

//Initialise to bitrate, channels and flags
if (!FSOUND_Init(44100, 64, 0))
{
    //check the init was ok
    printf("%s\n", FMOD_ErrorString(FSOUND_GetError()));
    exit(1);
}
//load the song
mod = FMUSIC_LoadSong("a.mid");

if (!mod)
{
    //check that the file loaded is correct
    printf("%s\n", FMOD_ErrorString(FSOUND_GetError()));
    exit(1);
}

FMUSIC_PlaySong(mod);   

printf("Press any key to quit\n");
printf("Playing %s\n", FMUSIC_GetName(mod));

//wait for a char press
getch();
//cleanup
FMUSIC_FreeSong(mod);
FSOUND_Close();

}

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.