def test(): print("KeyTableRegistry test") r = KeyTableRegistry() dump(r) r.eqtemp(56) template = ((1, 1), (13, 12), (14, 12), (15, 12), (16, 12), (17, 12), (18, 12), (19, 12), (20, 12), (21, 21), (22, 12), (23, 12)) r.just(template, "zzz") dump(r)
def test_clone(): a = SourceMapper("velocity") a.add_parameter("vibrato") b = clone(a) dump(a) dump(b) print(a is b) c = CCMapper() c.add_parameter(1, "vibrato") d = clone(c) dump(c) dump(d) print(c is d)
def test(): cca = CCAssignments() cca[16] = "Joystick x" cca[17] = "Joystick y" s1 = cca.serialize() ccb = CCAssignments.deserialize(s1) dump(cca) dump(ccb) cha = ChannelAssignments() cha[1] = "TX1" cha[2] = "TX2" s2 = cha.serialize() chb = ChannelAssignments.deserialize(s2) dump(cha) dump(chb)
def test_source_mapper(): print("*** SourceMapper test ***") sm1 = SourceMapper("velocity") sm1.add_parameter("A") sm1.add_parameter("B", curve="exp", modifier=2, range_=(100, 200)) sm1.add_parameter("C") dump(sm1) print("len : ", len(sm1)) print("keys : ", sm1.keys()) print("sm1['B'] --> ", sm1["B"]) print("\n*** Serilization, eq and clone ***") s = sm1.serialize() sm2 = SourceMapper.deserialize(s) dump(sm2) print("sm1 == sm2", sm1 == sm2, " sm1 is sm2", sm1 is sm2) sm3 = clone(sm1) dump(sm3) print("\n*** Remove parameters ***") sm1.remove_parameter("C") dump(sm1) sm2.remove_parameter("ALL") dump(sm2)
def test_cc_mapper(): print("*** CCMapper test ***") a = CCMapper() a.add_parameter(1, "vibrato") a.add_parameter(4, "volume") a.add_parameter(4, "filter", "exp", range_=(100, 10000)) a.add_parameter(4, "filterRes") dump(a) print("\n*** Serialization, clone and eq ***") s = a.serialize() b = CCMapper.deserialize(s) c = clone(a) dump(b) dump(c) print("a == b", a == b, " a is b", a is b) print("a == c", a == c, " a is c", a is c) print("\n*** Remove parameters ***") b.remove_parameter(4, "filter") dump(b) b.remove_parameter(4) dump(b) c.reset() dump(c)