aboutsummaryrefslogtreecommitdiff
path: root/scripts/showstoppedmtc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/showstoppedmtc')
-rwxr-xr-xscripts/showstoppedmtc33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/showstoppedmtc b/scripts/showstoppedmtc
new file mode 100755
index 0000000..e1e42fe
--- /dev/null
+++ b/scripts/showstoppedmtc
@@ -0,0 +1,33 @@
1#!/usr/bin/perl -w --
2$|=1; # disable output buffering
3use strict;
4open (MTCSOURCE, "amidi --dump --port=hw:1,0,0|");
5my $hour=0;
6my $min=0;
7my $sec=0;
8my $frame=0;
9my $qframe=-1;
10while (<MTCSOURCE>) {
11 chomp($_);
12 if (/F0 7F (.*) 06 44 06 01 (.*) F7/) {
13 print $_;
14 my @tc=split(' ',substr($_,21,17));
15 $hour=hex("0x".$tc[0]) & 31;
16 $min=hex("0x".$tc[1]);
17 $sec=hex("0x".$tc[2]);
18 $frame=hex("0x".$tc[3]);
19 $qframe=hex("0x".$tc[4]);
20 $roundedframe=$frame;
21 if ($qframe>=50) {
22 $roundedframe++;
23 }
24 if ($hour>0) {
25 print "$hour hours $min minutes $sec seconds $roundedframe\r\n";
26 }
27 else
28 {
29 print "$min minutes $sec seconds $roundedframe\r\n";
30 }
31 }
32}
33close (MTCSOURCE);