From 7fe9e97884efcde522479f8f606fe5556ace3416 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 17 Oct 2012 15:46:34 +0200 Subject: [PATCH] midichannels: support multiple inputs --- misc/tools/midi2cfg/tuba-record.cfg | 4 ++-- misc/tools/midichannels.pl | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/misc/tools/midi2cfg/tuba-record.cfg b/misc/tools/midi2cfg/tuba-record.cfg index 6bd27b94..81275e4f 100644 --- a/misc/tools/midi2cfg/tuba-record.cfg +++ b/misc/tools/midi2cfg/tuba-record.cfg @@ -3,9 +3,9 @@ menu_vid_height 720 vid_width 1280 vid_height 720 -cl_capturevideo_framestep 4 +cl_capturevideo_framestep 1 cl_capturevideo_fps 25 -r_motionblur 2 +r_motionblur 0 bind x "toggle cl_capturevideo" exec effects-normal.cfg diff --git a/misc/tools/midichannels.pl b/misc/tools/midichannels.pl index dcc7812b..bcfe6265 100644 --- a/misc/tools/midichannels.pl +++ b/misc/tools/midichannels.pl @@ -5,7 +5,7 @@ use warnings; use MIDI; use MIDI::Opus; -my ($filename) = @ARGV; +my ($filename, @others) = @ARGV; my $opus = MIDI::Opus->new({from_file => $filename}); my %chanpos = ( @@ -42,6 +42,20 @@ sub clean(@) return reltime grep { ($isclean{$_->[0]} // sub { 0; })->(@$_) } abstime @_; } +for(@others) +{ + my $opus2 = MIDI::Opus->new({from_file => $_}); + if($opus2->ticks() != $opus->ticks()) + { + my $tickfactor = $opus->ticks() / $opus2->ticks(); + for($opus2->tracks()) + { + $_->events(reltime map { $_->[1] = int($_->[1] * $tickfactor + 0.5); $_; } abstime $_->events()); + } + } + $opus->tracks($opus->tracks(), $opus2->tracks()); +} + while() { chomp; -- 2.39.2