int scripting_playmidi(const char* midi_file) { //StopMidi(); int regm = atol(midi_file); log_debug("Processing playmidi command."); if (regm > 1000) //cd directive { int cd_track = regm - 1000; log_info("playmidi - cd play command detected."); if (cd_inserted) { if (cd_track == last_cd_track && cdplaying()) { return 1; } log_info("Playing CD track %d.", cd_track); if (PlayCD(cd_track) >= 0) return 0; } else { //cd isn't instered, can't play CD song!!! char buf[10+4+1]; sprintf(buf, "%d.mid", cd_track); log_info("Playing midi %s.", buf); PlayMidi(buf); // then try to play 'midi_file' as well: // (necessary for START.c:playmidi("1003.mid")) } } log_info("Playing midi %s.", midi_file); PlayMidi(midi_file); return 0; }
BOOL C4MusicFileMID::Play(BOOL loop) { // check existance if(!FileExists(FileName)) // try extracting it if(!ExtractFile()) // doesn't exist - or file is corrupt return FALSE; // Play Song PlayMidi(SongExtracted ? Config.AtTempPath(C4CFN_TempMusic2) : FileName, Application.hWindow); return TRUE; }