home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
LNF
/
PIANO.TEM
< prev
next >
Wrap
Text File
|
1991-11-09
|
7KB
|
158 lines
/* This program was created in less time than it took
Josh to go and smoke a cigarette (don't worry he says he's quitting).
*/
#include <stdio.h>
#include <cscape.h>
#include <teddecl.h>
#include <msys.h>
#include <kbrecord.h>
int lnf_Beep(void * sdata, int idata);
int lnf_Beep(void * sdata, int idata)
/*
a sample user function for lnf.
beeps the speaker using the value passed by idata
audible values are between 300 and 5000.
*/
{
if (idata > 0) {
hard_speaker(idata, 10);
}
return(0);
}
int piano()
{
menu_type menu;
sed_type sed;
int ret;
menu = menu_Open();
menu_Printf(menu, " │ @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ @a[0x07]│ ");
menu_Printf(menu, "│@a[0x00] @a[0x07]│ │@a[0x00] @a[0x07]│ │@a[0x00] │ │\n │");
menu_Printf(menu, " @a[0x07]└─┬─┘@a[0x00] @a[0x07]└─┬─┘@a[0x00] │ @a[0x07]└─┬─");
menu_Printf(menu, "┘@a[0x00] @a[0x07]└─┬─┘@a[0x00] @a[0x07]└─┬─┘@a[0x00] │ │\n │ │ │ │ │ │ │ │ │\n │ │ │ │");
menu_Printf(menu, " │ │ │ │ │\n │ │ │ │ │ │ │ │ │\n │ │");
menu_Printf(menu, " │ │ │ │ │ │ │\n │ │ │ │ │ │ │ ");
menu_Printf(menu, "│ │\n └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘");
menu_Printf(menu, "@p[16,3]@fb[ AA ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 2000));
menu_Printf(menu, "@p[10,7]@fb[ W ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1887));
menu_Printf(menu, "@p[10,14]@fb[ E ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1681));
menu_Printf(menu, "@p[10,28]@fb[ T ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1414));
menu_Printf(menu, "@p[10,35]@fb[ Y ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1260));
menu_Printf(menu, "@p[10,42]@fb[ U ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1122));
menu_Printf(menu, "@p[16,10]@fb[ SS ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1781));
menu_Printf(menu, "@p[16,17]@fb[ DD ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1587));
menu_Printf(menu, "@p[16,24]@fb[ FF ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1498));
menu_Printf(menu, "@p[16,31]@fb[ GG ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1335));
menu_Printf(menu, "@p[16,38]@fb[ HH ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1189));
menu_Printf(menu, "@p[16,45]@fb[ JJ ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1059));
menu_Printf(menu, "@p[16,52]@fb[ KK ]",
NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1000));
menu_Flush(menu);
sed = sed_Open(menu);
sed_SetColors(sed, 0x70, 0x70, 0x07);
sed_MarkField(sed, 1, 0x07, 0x70);
sed_MarkField(sed, 2, 0x07, 0x70);
sed_MarkField(sed, 3, 0x07, 0x70);
sed_MarkField(sed, 4, 0x07, 0x70);
sed_MarkField(sed, 5, 0x07, 0x70);
sed_SetPosition(sed, 3, 11);
sed_SetHeight(sed, 18);
sed_SetWidth(sed, 59);
sed_SetMouse(sed, sedmou_Framer);
sed_Repaint(sed);
ret = sed_Go(sed);
sed_Close(sed);
return(ret);
}
void main(int argc, char *argv[])
/*
Uses kb_Record if the following command line arguments are given.
The -r command records a sequence of keystrokes to a file.
The -p command plays the sequence back from a file.
For example, the command line
piano -rmusic
will record keystrokes in the file "music".
The command line
piano -pmusic
will play back the recording.
*/
{
FILE *key = NULL;
disp_Init(def_ModeText, NULL);
/* check for kb record */
if (argc > 1) {
if (argv[1][0] == '-' && argv[1][1] == 'r') {
/* open file for record keystrokes */
key = fopen(argv[1]+2, "w");
kb_Record(key, KB_RECORD, 0);
}
else if (argv[1][0] == '-' && argv[1][1] == 'p') {
/* open file to play back keystrokes */
key = fopen(argv[1]+2, "r");
kb_Record(key, KB_PLAY, 0);
}
}
piano();
disp_Close();
if (key != NULL) {
fclose(key);
}
}