From 7f7c6c64bbe7c31575a9e03915f1a56d6175771e Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 22 Jan 2005 04:29:53 +0000
Subject: [PATCH] The xptone() wave shape number (currently 0-6) may be
 specified on the command line (-x#).

---
 src/tone/tone.c | 52 ++++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/src/tone/tone.c b/src/tone/tone.c
index 93a5737b38..a188589c16 100644
--- a/src/tone/tone.c
+++ b/src/tone/tone.c
@@ -58,7 +58,9 @@ int octave=4;	/* Default octave */
 
 double pitch=523.50/32.0;	 /* low 'C' */
 
-BOOL use_xp_beep=FALSE;
+BOOL use_xptone=FALSE;
+
+enum WAVE_SHAPE wave_shape;
 
 void play(char *freq, char *dur)
 {
@@ -145,8 +147,8 @@ void play(char *freq, char *dur)
 	else
 		len=(d*t);
 	if(f) {
-		if(use_xp_beep)
-			xpbeep(f,len);
+		if(use_xptone)
+			xptone(f,len,wave_shape);
 		else
 			BEEP(f,len);
 	}
@@ -185,6 +187,8 @@ void usage(void)
 	printf("               f display frequency or note value\n");
 	printf("               n not abortable with key-stroke\n");
 	printf("               v disable visual text commands\n");
+	printf("               x# use xptone (wave/dsp output) instead of beep macro\n");
+	printf("                  optionally, specify wave shape number\n");
 	exit(0);
 }
 
@@ -193,7 +197,7 @@ int main(int argc, char **argv)
 	char*	p;
 	char	str[128];
 	char	revision[16];
-	int		i,j;
+	int		i;
 	FILE*	stream;
 
 	sscanf("$Revision$", "%*s %s", revision);
@@ -206,26 +210,26 @@ int main(int argc, char **argv)
 	setvbuf(stdout,NULL,_IONBF,0);
 	for(i=1;i<argc;i++) {
 		if(argv[i][0]=='-') {
-			for(j=1;argv[i][j];j++)
-				switch(toupper(argv[i][j])) {
-					case 'D':
-						mode^=SHOW_DOT;
-						break;
-					case 'F':
-						mode^=SHOW_FREQ;
-						break;
-					case 'N':
-						mode^=NOT_ABORTABLE;
-						break;
-					case 'V':
-						mode^=NO_VISUAL;
-						break;
-					case 'X':
-						use_xp_beep=TRUE;
-						break;
-					default:
-						usage();
-						break;
+			switch(toupper(argv[i][1])) {
+				case 'D':
+					mode^=SHOW_DOT;
+					break;
+				case 'F':
+					mode^=SHOW_FREQ;
+					break;
+				case 'N':
+					mode^=NOT_ABORTABLE;
+					break;
+				case 'V':
+					mode^=NO_VISUAL;
+					break;
+				case 'X':
+					use_xptone=TRUE;
+					wave_shape=atoi(argv[i]+2);
+					break;
+				default:
+					usage();
+					break;
 			}
 			continue; 
 		}
-- 
GitLab