# HG changeset patch # User František Kučera # Date 1589900662 -7200 # Node ID a8483017902784cdb5b8d073d36d491e70947724 # Parent 6733bd832b61e924995c3082aa28538bcc1d553d filter ASCII characters diff -r 6733bd832b61 -r a84830179027 mt-32-display.cpp --- a/mt-32-display.cpp Tue May 19 16:03:25 2020 +0200 +++ b/mt-32-display.cpp Tue May 19 17:04:22 2020 +0200 @@ -28,8 +28,16 @@ * If the checksum is wrong, the MT-32 unit shows the "Exc. Checksum error" message for few seconds * and then returns back to the default screen. * - * Usage: + * Only printable ASCII characters are supported. Other characters (bytes) are replaced by "." + * + * Some characters are displayed differently: + * ASCII MT-32 + * ~ → + * \ ¥ + * + * Usage examples: * amidi --port="hw:2,0,0" --send-hex="$(echo -n ' Run GNU/Linux ' | ./mt-32-display )" + * while read message; do amidi --port="hw:2,0,0" --send-hex="$(echo -n "$message" | ./mt-32-display )"; done * * @param argc * @param argv @@ -47,6 +55,7 @@ sum += 0x00; for (char ch; std::cin.read(&ch, 1).good();) { + if (ch < 32 || ch > 126) ch = '.'; std::cout << std::setw(2) << ((int) ch) << " "; sum += ch; }