123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- #include "OpenDoor.h"
- #include <string.h>
- void PlayANSISound(char *pszSounds);
- char TestSound(void);
- char bSoundEnabled = TRUE;
- #ifdef ODPLAT_WIN32
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpszCmdLine, int nCmdShow)
- #else
- int main(int argc, char *argv[])
- #endif
- {
-
- #ifdef ODPLAT_WIN32
- od_control.od_cmd_show = nCmdShow;
- od_parse_cmd_line(lpszCmdLine);
- #else
- od_parse_cmd_line(argc, argv);
- #endif
-
- od_printf("This is a simple door program that will play the song Happy Birthday\n\r");
- od_printf("tune on the remote system, if the user's terminal program supports ANSI\n\r");
- od_printf("music. Music is not played on the local speaker, as BBS system operators\n\r");
- od_printf("do not wish to have the BBS computer making sounds at any time of the day\n\r");
- od_printf("or night. However, the program can easily be modified to also echo sound to\n\r");
- od_printf("the local speaker.\n\r\n\r");
-
- TestSound();
-
-
- od_clr_scr();
-
- od_printf("\n\rHappy Birthday!\n\r");
-
- PlayANSISound("MBT120L4MFMNO4C8C8DCFE2C8C8DCGF2C8C8O5CO4AFED2T90B-8B-8AFGF2");
-
- PlayANSISound("00m");
-
- od_printf("\n\rPress any key to return to BBS...\n\r");
- od_get_key(TRUE);
- od_exit(0, FALSE);
- return(0);
- }
- char TestSound(void)
- {
-
- char chResponse;
-
- od_printf("We need to know whether or not your terminal program supports ANSI music.\n\r");
- od_printf("In order to test this, we will send a short ANSI music sequence. We will then\n\r");
- od_printf("ask whether or not you heard any sound.\n\r");
- od_printf("Press any key to begin this test... ");
-
- od_get_key(TRUE);
- od_printf("\n\r\n\r");
-
- bSoundEnabled = TRUE;
-
- PlayANSISound("MBT120L4MFMNO4C8C8DC");
-
- PlayANSISound("00m");
-
- od_clr_scr();
- od_printf("Did you just hear sound from your speaker? (Y/n)");
- chResponse = od_get_answer("YN");
-
- bSoundEnabled = (chResponse == 'Y');
-
- return(bSoundEnabled);
- }
- void PlayANSISound(char *pszSounds)
- {
-
- char szStartSound[255] = {27, '[', '\0'};
-
- if(!bSoundEnabled) return;
-
- od_disp(szStartSound, strlen(szStartSound), FALSE);
-
- od_disp(pszSounds, strlen(pszSounds), FALSE);
- }
|