--- morse.d/morse.c- 2007-12-06 17:48:47 +0300 +++ morse.d/morse.c 2007-12-06 18:00:39 +0300 @@ -82,6 +82,7 @@ static float inter_word_time; static float catchup_time; static int showletters = 0; +static int nosound = 0; static int showmorse = 0; static int wordsbefore = 0; static int wordsafter = 0; @@ -313,6 +314,7 @@ #ifdef FLUSHCODE printf (" (this printing-intensive option slows the wpm down!)\n"); #endif + printf ("-Q turn all sounds off (use with -m to convert a text)\n"); printf ("-t Type along with the morse, but don't see what\n"); printf (" you're typing (unless you make a mistake).\n"); printf (" You are allowed to get ahead as much as you want.\n"); @@ -463,7 +465,7 @@ fwords_per_minute = -1.; /* DGHJKLMOPQUVWYZhjkouyz are still available */ - while ((ch = getopt (argc, argv, "ABC:E:F:IM:N:R:STXabcdef:g:ilmn:p:qrstv:w:x:")) != EOF) + while ((ch = getopt (argc, argv, "ABC:E:F:IM:N:QR:STX:abcdef:g:ilmn:p:qrstv:w:x:")) != EOF) switch ((char) ch) { case 'A': @@ -555,6 +557,10 @@ case 'l': showletters = 1; break; + case 'Q': + nosound = 1; + error_volume = 0; + break; case 'm': showmorse = 1; break; @@ -608,7 +614,7 @@ frequency = frequency1; - if (BeepInit () != 0) + if (!nosound && BeepInit () != 0) { fprintf (stderr, "Can't access speaker.\n"); exit (1); @@ -1696,14 +1702,16 @@ static void tone (float hertz, float duration, float amplitude) { - Beep ((int) (duration * 1000), (int) (amplitude * 100), (int) hertz); + if (!nosound) + Beep ((int) (duration * 1000), (int) (amplitude * 100), (int) hertz); } static void toneflush (void) { - BeepWait (); + if(!nosound) + BeepWait (); } @@ -1775,7 +1783,8 @@ { if (termopen) closeterminal (); - BeepCleanup (); + if(!nosound) + BeepCleanup (); } static void @@ -1791,7 +1800,8 @@ kill (getpid (), SIGSTOP); if (termopen) openterminal (); - BeepResume (); + if(!nosound) + BeepResume (); } --- morse.1- 2007-12-06 18:09:58 +0300 +++ morse.1 2007-12-06 18:13:13 +0300 @@ -112,6 +112,10 @@ print morse dots and dashes as they sound (this printing\-intensive option slows the wpm down!) .TP +\-Q +turn all sounds off (use with -m to convert a text) + +.TP \-t Type along with the morse, but don't see what you're typing (unless you make a mistake)\&. You are allowed to get ahead as much as you want\&. If you get too far behind it will stop and resync with you\&. You can force it to resync at the next word end by hitting control\-H\&. Hit ESC to see how you are doing, control\-D to end\&. (The rightmost space in the printout marks where the average is\&. Farther left spaces separate off blocks of letters that are about twice as probable as the average to occur, three times, etc\&.)