commit - cce21a4d4fb1285fd07ce47c0cc5a57392e09026
commit + ce0d6424ca093024b516454badfced4c3f5d4d15
blob - 7b3e12e6316f21c3873224b7d83ce8618e86883c
blob + a17e9f627e9042947ee425f134ee7d3a07e7f30a
--- morse.c
+++ morse.c
void decode(char *);
char *encode(int);
void show(char *);
-void sound(char *);
+void play(char *);
static int sflag = 0;
static int dflag = 0;
}
if (aflag)
- sound(s); /* play back iff decoded */
+ play(s); /* play back iff decoded */
if (x < 0) /* negative means prosign */
printf(" %s ", ps[-x].c); /* surround with whitespace */
putchar('t');
}
if (aflag)
- sound(s);
+ play(s);
printf("\n");
}
void
-sound(char *s)
+play(char *s)
{
if (*s == '\0')
silence(7 * pditlen - ditlen); /* inter-word pause */
blob - f9c5ded420dd99b2d8720ee47b9b856e47c4ecd7
blob + e554dc61f8bb868917fd0a06b18d214ef45cd015
--- morseteach.c
+++ morseteach.c
int Dflag = 0; /* level of diagnostic output */
void
-play(char c)
+sound(char c)
{
fputc(c, fout);
while (fgetc(fin) != '\n') ; /* wait for sound to finish */
blob - 4ddc1dec8e7c451562d62bdd2d557bf4e60485f5
blob + 289fb07b979f6ac168b2a56edc7428966155dd3c
--- teach.c
+++ teach.c
/* externally supplied */
extern int Dflag; /* level of diagnostic output */
-void play(char); /* sound output routine */
+void sound(char); /* sound output routine */
double
square(double x)
putchar('\n');
printscores();
fputs("- pause (press Return to continue, ^D to quit) - ", stdout);
- play('&'); /* <AS> wait */
+ sound('&'); /* <AS> wait */
while ((input = getchar()) != '\n' && input != 4) ;
clock_gettime(CLOCK_MONOTONIC, &t1);
timespecsub(&t1, &t0, &delta);
timespecadd(&tpause, &delta, &tpause);
if (input == 4) {
puts("^D");
- play('+'); /* <AR> end of transmission */
- play('\n');
+ sound('+'); /* <AR> end of transmission */
+ sound('\n');
return -1; /* quit */
}
- play('\a'); /* <KA> attention / start of transmission */
- play('\n'); /* inter-word pause */
+ sound('\a'); /* <KA> attention / start of transmission */
+ sound('\n'); /* inter-word pause */
puts("\r ");
return 0;
* shown them after playback.
*/
if (failprob[i] > 0.9)
- play(' '); /* inter-word pause */
- play(ch);
+ sound(' '); /* inter-word pause */
+ sound(ch);
clock_gettime(CLOCK_MONOTONIC, &t0);
if (failprob[i] > 0.9)
printf("%c\b", ch);
return -1;
/* otherwise resound, reset timer, and restart */
- play(ch);
+ sound(ch);
clock_gettime(CLOCK_MONOTONIC, &t0);
continue;
}
/* if ^D pressed, then quit */
else if (input == 4) {
puts("^D");
- play('+'); /* <AR> end of transmission */
- play('\n');
+ sound('+'); /* <AR> end of transmission */
+ sound('\n');
printscores();
return -1;
}
/* if space pressed, resound and show hint */
if (input == ' ') {
printf("%c\b", ch);
- play(ch);
+ sound(ch);
printf(" \b");
continue;
}
break;
} else if (taken > avgtime + sigma) {
/* resound the symbol */
- play(ch);
+ sound(ch);
}
}
if (input == 4)
puts("^D");
else if (input == '\n') {
- play('\a'); /* <KA> attention / start of transmission */
- play('\n'); /* inter-word pause */
+ sound('\a'); /* <KA> attention / start of transmission */
+ sound('\n'); /* inter-word pause */
puts("\r ");
}