From 32b6bdde02904e9879ee471508e3989c2d86ef18 Mon Sep 17 00:00:00 2001 From: hirsch Date: Sun, 31 Jul 2016 17:50:47 -0400 Subject: [PATCH] Extend tests to cover V2 models --- test.py | 262 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 170 insertions(+), 92 deletions(-) diff --git a/test.py b/test.py index 64db057..ec3f45e 100755 --- a/test.py +++ b/test.py @@ -24,6 +24,9 @@ mido.set_backend('mido.backends.rtmidi') pc = mido.Message('program_change') cc = mido.Message('control_change') +# 1 == v1, 2 == v2 +type = 0 + def analog_send( outport, sleeptime=0.25 ): for value in [ 0, 32, 64, 96, 127, 96, 64, 32, 0 ]: cc.value = value @@ -43,29 +46,34 @@ def amp_screen1( outport ): analog_send( outport ) # Some variation in screen 2 across models -def amp_screen2( outport, bias_sag, extra ): - if bias_sag: - cc.control = 74 - discrete_send( outport, 2 ) - cc.control = 75 - analog_send( outport ) +def amp_screen2( outport, template ): + limit = len(template) - cc.control = 76 - discrete_send( outport, 4 ) - - cc.control = 77 - discrete_send( outport, 12 ) - - if extra: - cc.control = 78 - analog_send( outport ) - cc.control = 79 - analog_send( outport ) + i = 74 + j = 5 + while j < limit: + cc.control = i + i += 1 + if template[j] == "A": + analog_send( outport ) + elif template[j] == "D": + j += 1 + count = int( template[j:j+2] ) + j += 1 + discrete_send( outport, count ) + elif template[j] == "-": + pass + j += 1 # Step through all amp models def amp_select( outport ): + if type == 2: + max = 18 + else: + max = 13 + cc.control = 68 - for i in range( 0, 13 ): + for i in range( 0, max ): cc.value = i outport.send( cc ) sleep( 0.5 ) @@ -75,18 +83,20 @@ def run_amp_test( struct, outport ): amp_select( outport ) for i in range( 0, len(struct) ): - amp_rec = struct[i] + control_rec = struct[i] + if control_rec[3] and type != 2: + continue - raw_input( "Hit ENTER to run parm edit check for %s\n" % amp_rec[0] ) + raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] ) cc.control = 68 - cc.value = amp_rec[1] + cc.value = control_rec[1] outport.send( cc ) raw_input( "Enter amp edit mode on Mustang and hit ENTER to proceed...\n" ) amp_screen1( outport ) raw_input( "Step to amp edit screen 2 and hit ENTER...\n" ) - amp_screen2( outport, amp_rec[2], amp_rec[3] ) + amp_screen2( outport, control_rec[2] ) # Step through all reverb models def reverb_select( outport ): @@ -119,29 +129,43 @@ def run_delay_test( struct, outport ): delay_select( outport ) for i in range( 0, len(struct) ): - delay_rec = struct[i] + control_rec = struct[i] + if control_rec[3] and type != 2: + continue - raw_input( "Hit ENTER to run parm edit check for %s\n" % delay_rec[0] ) + raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] ) cc.control = 48 - cc.value = delay_rec[1] + cc.value = control_rec[1] outport.send( cc ) raw_input( "Enter delay edit mode on Mustang and hit ENTER to proceed...\n" ) - for i in range( 49, 54 ): - cc.control = i - # Multitap Delay has a single discrete control - if i==53 and delay_rec[2]: - discrete_send( outport, 3 ) - else: - analog_send( outport ) + limit = len(control_rec[2]) + template = control_rec[2] + + i = 49 + j = 0 + while j < limit: + cc.control = i + i += 1 + if template[j] == "A": + analog_send( outport ) + elif template[j] == "D": + j += 1 + count = int( template[j:j+2] ) + j += 1 + discrete_send( outport, count ) + j += 1 - if delay_rec[3]: - analog_send( outport ) # Step through all mod models def mod_select( outport ): + if type == 2: + max = 15 + else: + max = 12 + cc.control = 38 - for i in range( 0, 12 ): + for i in range( 0, max ): cc.value = i outport.send( cc ) sleep( 0.5 ) @@ -151,25 +175,42 @@ def run_mod_test( struct, outport ): mod_select( outport ) for i in range( 0, len(struct) ): - mod_rec = struct[i] + control_rec = struct[i] + if control_rec[3] and type != 2: + continue - raw_input( "Hit ENTER to run parm edit check for %s\n" % mod_rec[0] ) + raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] ) cc.control = 38 - cc.value = mod_rec[1] + cc.value = control_rec[1] outport.send( cc ) raw_input( "Enter mod edit mode on Mustang and hit ENTER to proceed...\n" ) - for i in range( 39, 44 ): + limit = len(control_rec[2]) + template = control_rec[2] + + i = 39 + j = 0 + while j < limit: cc.control = i - if (i==42 and mod_rec[2]) or (i==43 and mod_rec[3]): - discrete_send( outport, 1 ) - else: + i += 1 + if template[j] == "A": analog_send( outport ) + elif template[j] == "D": + j += 1 + count = int( template[j:j+2] ) + j += 1 + discrete_send( outport, count ) + j += 1 # Step through all stomp models def stomp_select( outport ): + if type == 2: + max = 13 + else: + max = 8 + cc.control = 28 - for i in range( 0, 8 ): + for i in range( 0, max ): cc.value = i outport.send( cc ) sleep( 0.5 ) @@ -179,23 +220,32 @@ def run_stomp_test( struct, outport ): stomp_select( outport ) for i in range( 0, len(struct) ): - stomp_rec = struct[i] + control_rec = struct[i] + if control_rec[3] and type != 2: + continue - raw_input( "Hit ENTER to run parm edit check for %s\n" % stomp_rec[0] ) + raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] ) cc.control = 28 - cc.value = stomp_rec[1] + cc.value = control_rec[1] outport.send( cc ) raw_input( "Enter stomp edit mode on Mustang and hit ENTER to proceed...\n" ) - for i in range( 29, 34 ): + limit = len(control_rec[2]) + template = control_rec[2] + + i = 29 + j = 0 + while j < limit: cc.control = i - if i==33 and stomp_rec[2]: - discrete_send( outport, 1 ) - elif i==29 and stomp_rec[3]: - discrete_send( outport, 3 ) - break - else: + i += 1 + if template[j] == "A": analog_send( outport ) + elif template[j] == "D": + j += 1 + count = int( template[j:j+2] ) + j += 1 + discrete_send( outport, count ) + j += 1 # Step through program changes def program_change_test( outport ): @@ -207,8 +257,10 @@ def program_change_test( outport ): args = sys.argv -if not len(args) == 3: - print "Usage: test.py \n" +if len(args) < 4: + print "Usage: test.py [test_name]\n" + print " Pass test name in {pc, stomp, mod, reverb, delay, amp} for single test\n" + print " Default is to run all of them if no arg 4 passed\n" sys.exit( 1 ) try: @@ -217,51 +269,77 @@ except ValueError: print "Arg2 must be numeric!\n" sys.exit( 1 ) +if args[3] == "v1": + type = 1 +elif args[3] == "v2": + type = 2 +else: + print "Arg 3 must be 'v1' or 'v2'" + sys.exit( 1 ) + +single = "all" +if len(args) == 5: + single = args[4] + outport = mido.open_output( args[1] ) -program_change_test( outport ) +if single == "all" or single == "pc": + program_change_test( outport ) -# Model # 33 Dig? -stomp_test = ( - ( "Overdrive", 1, False, False ), - ( "Wah", 2, True, False ), - ( "Simple Comp", 6, False, True ), - ( "Comp", 7, False, False ) - ) +if single == "all" or single == "stomp": + # Model # Ctrl v2only + stomp_test = ( + ( "Ranger Boost", 8, "AAAA", True ), + ( "Green Box", 9, "AAAA", True ), + ( "Orange Box", 10, "AAA", True ), + ( "Black Box", 11, "AAA", True ), + ( "Big Fuzz", 12, "AAA", True ), -run_stomp_test( stomp_test, outport ) + ( "Overdrive", 1, "AAAAA", False ), + ( "Wah", 2, "AAAAD01", False ), + ( "Simple Comp", 6, "D03", False ), + ( "Comp", 7, "AAAAA", False ) + ) + run_stomp_test( stomp_test, outport ) -# Model # 42 Dig? 43 Dig? -mod_test = ( - ( "Sine Chorus", 1, False, False ), - ( "Vibratone", 5, False, False ), - ( "Vintage Trem", 6, False, False ), - ( "Ring Mod", 8, True, False ), - ( "Phaser", 10, False, True ), - ( "Pitch Shift", 11, False, False ) - ) +if single == "all" or single == "mod": + # Model # Ctrl v2only + mod_test = ( + ( "Wah", 12, "AAAAD02", True ), + ( "Touch Wah", 13, "AAAAD02", True ), + ( "Dia Shift", 14, "AD22D12D09A", True ), -run_mod_test( mod_test, outport ) + ( "Sine Chorus", 1, "AAAAA", False ), + ( "Vibratone", 5, "AAAAA", False ), + ( "Vintage Trem", 6, "AAAAA", False ), + ( "Ring Mod", 8, "AAAD01A", False ), + ( "Phaser", 10, "AAAAD01", False ), + ( "Pitch Shift", 11, "AAAAA", False ) + ) + run_mod_test( mod_test, outport ) -run_reverb_test( outport ) +if single == "all" or single == "reverb": + run_reverb_test( outport ) -# Model # 53 Dig?, Has 54? -delay_test = ( - ( "Mono Delay", 1, False, False ), - ( "Multitap", 4, True, False ), - ( "Tape Delay", 8, False, False ) - ) +if single == "all" or single == "delay": + # Model # Ctrl v2only + delay_test = ( + ( "Mono Delay", 1, "AAAAA", False ), + ( "Multitap", 4, "AAAAD03", False ), + ( "Tape Delay", 8, "AAAAA", False ) + ) + run_delay_test( delay_test, outport ) -run_delay_test( delay_test, outport ) +if single == "all" or single == "amp": + # Model, #, Bias/Sag? Has 78+79? + amp_test = ( + ( "Studio Preamp", 13, "AAAAA--D04D12", True ), -# Model, #, Bias/Sag?, Extra? -amp_test = ( - ( "Fender 65 Twin", 6, True, False ), - ( "Fender SuperSonic", 7, True, True ), - ( "British 60s", 8, True, True ), - ( "British 70s", 9, True, True ), - ( "British 80s", 10, True, True ) - ) - -run_amp_test( amp_test, outport ) + ( "Fender 65 Twin", 6, "AAAAAD02AD04D12", False ), + ( "Fender SuperSonic", 7, "AAAAAD02AD04D12AA", False ), + ( "British 60s", 8, "AAAAAD02AD04D12AA", False ), + ( "British 70s", 9, "AAAAAD02AD04D12AA", False ), + ( "British 80s", 10, "AAAAAD02AD04D12AA", False ) + ) + run_amp_test( amp_test, outport )