Commit Briefs
use arc4random (main)
While crappy old rand(3) is fine for this program and uses arc4random(3) on OpenBSD anyway, the linker spews a warning about it and the noise during compilation is annoying me. FWIW, Linux finally got arc4random(3) with glibc >= 2.36 (2022) so it could actually be considered fairly portable now. However, for the time being, I'd like to still support older systems. NB, the closest "native" alternative, getentropy(3), appears in glibc >= 2.25 (2017), so even it is not exactly ancient, yet. Thur, instead of mucking around with wrappers, feature flags and conditional compilation, rand() is still it for portable.
reset the clock in cwstart
This is a workaround to guard against the possibility that the onmove callback is not called at all. This happens if playback has not started before cwstop(), and hence sio_stop(), is called.
fix timing calculation
Measure and take into account the "return latency" of cwstop(), i.e. the time it took between playback stopping ang cwstop() returning, usually negative.
try to figure out proper timing
This is an intermediate commit of some experimental changes: - playback in synchronous mode (par.xrun = SIO_SYNC) - tracking of play position via sio_onmove() and total frames written - (broken/ignored) reporting of "time remaining" from sound() and friends - debug instrumentation (#ifdef DEBUGTIME)
fix two typos
Turns out my times were measured in centiseconds rather than milliseconds as advertised. Oops. Only discovered when looking to make them exact for the first time. Had mostly ignored the values as "probably way off anyway". That appears to have been an accurate assessment. X) It does show nicely how the algorithm doesn't care about absolute values. It operated just fine on centiseconds.
remove .boring
Artefact from darcs past, not used for git/got.
rename sound() <-> play()
The function sound(char) is now the audio hook required by teach.c and should "sound" the given character. The function play(char *) is internal to morse.c for "playing" a sequence of dits and dahs, given as a string of dots and dashes. The morseplay utility (as before) exposes the same functionality. This change also matches function name and signature of play() in the FreeBSD version of morse.c.
change default shape to sin rise, exp fall
I don't know what I'm doing. Just going by ear and pictures of purportedly clean waveforms.
add raised inverted cosine (ric) shape
This is the sigmoid function (1 - cos(pi t)) / 2. Also rename "icos" to "cos" to avoid confusion.