mt-32-display.cpp
branchv_0
changeset 2 a84830179027
parent 1 6733bd832b61
child 3 51a8362261a9
equal deleted inserted replaced
1:6733bd832b61 2:a84830179027
    26  * 
    26  * 
    27  * The SysEx message contains a checksum.
    27  * The SysEx message contains a checksum.
    28  * If the checksum is wrong, the MT-32 unit shows the "Exc. Checksum error" message for few seconds
    28  * If the checksum is wrong, the MT-32 unit shows the "Exc. Checksum error" message for few seconds
    29  * and then returns back to the default screen.
    29  * and then returns back to the default screen.
    30  * 
    30  * 
    31  * Usage:
    31  * Only printable ASCII characters are supported. Other characters (bytes) are replaced by "."
       
    32  * 
       
    33  * Some characters are displayed differently:
       
    34  *   ASCII   MT-32
       
    35  *       ~   →
       
    36  *       \   ¥
       
    37  * 
       
    38  * Usage examples:
    32  *     amidi --port="hw:2,0,0" --send-hex="$(echo -n '   Run GNU/Linux    ' | ./mt-32-display )"
    39  *     amidi --port="hw:2,0,0" --send-hex="$(echo -n '   Run GNU/Linux    ' | ./mt-32-display )"
       
    40  *     while read message; do amidi --port="hw:2,0,0" --send-hex="$(echo -n "$message" | ./mt-32-display )"; done
    33  * 
    41  * 
    34  * @param argc
    42  * @param argc
    35  * @param argv
    43  * @param argv
    36  * @return 
    44  * @return 
    37  */
    45  */
    45 	sum += 0x20;
    53 	sum += 0x20;
    46 	sum += 0x00;
    54 	sum += 0x00;
    47 	sum += 0x00;
    55 	sum += 0x00;
    48 
    56 
    49 	for (char ch; std::cin.read(&ch, 1).good();) {
    57 	for (char ch; std::cin.read(&ch, 1).good();) {
       
    58 		if (ch < 32 || ch > 126) ch = '.';
    50 		std::cout << std::setw(2) << ((int) ch) << " ";
    59 		std::cout << std::setw(2) << ((int) ch) << " ";
    51 		sum += ch;
    60 		sum += ch;
    52 	}
    61 	}
    53 
    62 
    54 	sum %= 128;
    63 	sum %= 128;