Nautical bell: Difference between revisions
Content deleted Content added
m added an image of a ship's bell to the task's preamble. |
m →{{header|REXX}}: changed/added comments and whitespace, changed indentations. |
||
Line 965: | Line 965: | ||
Also, some REXXes don't have a '''sound''' BIF, which produces sounds via the PC speaker, |
Also, some REXXes don't have a '''sound''' BIF, which produces sounds via the PC speaker, |
||
so one is included [[SOUND.REX|here]]. |
so one is included [[SOUND.REX|here]]. |
||
<lang rexx>/*REXX program sounds "bells" (using PC speaker) when |
<lang rexx>/*REXX program sounds "ship's bells" (using PC speaker) when executing (perpetually).*/ |
||
echo= arg()\==0 /*echo time and bells if any arguments.*/ |
echo= (arg()\==0) /*echo time and bells if any arguments.*/ |
||
signal on halt /*allow a clean way to stop the program*/ |
signal on halt /*allow a clean way to stop the program*/ |
||
t.1 |
t.1= '00:30 01:00 01:30 02:00 02:30 03:00 03:30 04:00' |
||
t.2 |
t.2= '04:30 05:00 05:30 06:00 06:30 07:00 07:30 08:00' |
||
t.3 |
t.3= '08:30 09:00 09:30 10:00 10:30 11:00 11:30 12:00' |
||
do forever; t=time(); ss=right(t,2); mn=substr(t,4,2) /*the time.*/ |
do forever; t=time(); ss=right(t,2); mn=substr(t,4,2) /*the current time. */ |
||
ct=time('C') /*[↓] maybe add leading zero*/ |
ct=time('C') /*[↓] maybe add leading zero*/ |
||
hhmmc=left( right( ct, 7, 0), 5) /*HH:MM (with leading zero).*/ |
hhmmc=left( right( ct, 7, 0), 5) /*HH:MM (with leading zero).*/ |
||
Line 983: | Line 983: | ||
end /*j*/ |
end /*j*/ |
||
if $\==0 & echo then say center($ "bells", 79) /*echo the bells? */ |
if $\==0 & echo then say center($ "bells", 79) /*echo the bells ? */ |
||
do k=1 for $; call sound 650,1; call delay 1 +(k//2==0) |
do k=1 for $; call sound 650,1; call delay 1 +(k//2==0) |
||
Line 989: | Line 989: | ||
call delay 60 /*ensure we don't re-peel. */ |
call delay 60 /*ensure we don't re-peel. */ |
||
end /*forever*/ |
end /*forever*/ |
||
halt: /*stick a fork in it, we're all done. */</lang> |
halt: /*stick a fork in it, we're all done. */</lang> |
||
'''output''' when using the input of: <tt> the time is: </tt> |
'''output''' when using the input of: <tt> the time is: </tt> |
||
<pre> |
<pre> |