diff options
Diffstat (limited to 'scripts/showstoppedmtc')
-rwxr-xr-x | scripts/showstoppedmtc | 33 |
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 | ||
3 | use strict; | ||
4 | open (MTCSOURCE, "amidi --dump --port=hw:1,0,0|"); | ||
5 | my $hour=0; | ||
6 | my $min=0; | ||
7 | my $sec=0; | ||
8 | my $frame=0; | ||
9 | my $qframe=-1; | ||
10 | while (<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 | } | ||
33 | close (MTCSOURCE); | ||