#include #include #include #include #include #include "proboard.hpp" struct music_data { unsigned freq,dur; }; char playsong(char *name,char *hotkeys,int length) { int silent=0,i,j; music_data *data; time_t tm; File fp(FileName(syspath,name,".MUS"),fmode_read | fmode_text); if(!fp.opened()) { if(!length) return 1; tm=time(NULL); for(i=0;;i++) { if(int(time(NULL)-tm)>length) break; if(!silent && !noyell_flag) tsw_beep(100*(i%20)+200,40); if(KB.hit()) { KEY c=KB.uget(); if(hotkeys) for(j=0;jlength) { nosound(); delete [] data; return 0; } if(!noyell_flag) { if(data[i].freq) { sound(data[i].freq); msleep(data[i].dur*10); } else { nosound(); msleep(data[i].dur*10); } } } if(!length) break; } nosound(); delete [] data; return 0; }