Example #1
0
 def add_sequence(self, length=-1):
     seq = libcvht.sequence_new(length)
     libcvht.module_add_sequence(self._mod_handle, seq)
     for cb in self.cb_new_sequence:
         cb(libcvht.sequence_get_index(seq))
     return VHTSequence(seq, self, self.cb_new_track)
Example #2
0
    def unpack_seq(self, seq, matrix=False):
        sq = None
        par = -1

        if matrix:
            s = self.add_sequence()
            s.parent = par
        else:
            sq = libcvht.sequence_new(23)
            s = VHTSequence(sq, self)
            par = seq["parent"]

        s.length = seq["length"]
        s.rpb = seq["rpb"]
        s.parent = par
        s.extras.jsn = seq["extras"]

        if "playing" in seq:
            s.playing = seq["playing"]

        if "trg_playmode" in seq:
            s.trg_playmode = seq["trg_playmode"]
            s.trg_quantise = seq["trg_quantise"]

            s.set_trig(0, seq["trig"][0][0], seq["trig"][0][1],
                       seq["trig"][0][2])
            s.set_trig(1, seq["trig"][1][0], seq["trig"][1][1],
                       seq["trig"][1][2])
            s.set_trig(2, seq["trig"][2][0], seq["trig"][2][1],
                       seq["trig"][2][2])

        for trk in seq["trk"]:
            t = s.add_track(
                trk["port"],
                trk["channel"],
                trk["nrows"],
                trk["nsrows"],
                trk["ctrlpr"],
            )
            t.playing = trk["playing"]
            t.set_bank(trk["program"][0], trk["program"][1])
            t.send_program_change(trk["program"][2])
            t.set_qc1(trk["qc"][0], trk["qc"][1])
            t.set_qc2(trk["qc"][2], trk["qc"][3])

            t.loop = trk["loop"]

            t.extras.jsn = trk["extras"]

            nctrl = 0
            for ctrl in trk["ctrl"]:
                if ctrl["ctrlnum"] > -1:
                    t.ctrl.add(ctrl["ctrlnum"])

                for rw in ctrl["rows"]:
                    r = t.ctrl[nctrl][rw["n"]]
                    r.velocity = rw["velocity"]
                    r.linked = rw["linked"]
                    r.smooth = rw["smooth"]
                    r.anchor = rw["anchor"]

                    t.ctrl[nctrl].refresh()

                for dood in ctrl["doodles"]:
                    rn = dood[0] * t.ctrlpr
                    for d in dood[1]:
                        t.set_ctrl(nctrl, rn, d)
                        rn += 1

                nctrl += 1

            for cc, col in enumerate(trk["col"]):
                if cc == 0:
                    c = t[0]
                else:
                    c = t.add_column()

                for row in col:
                    rr = c[row["n"]]
                    rr.type = row["type"]
                    rr.note = row["note"]
                    rr.velocity = row["velocity"]
                    rr.delay = row["delay"]

        return sq
Example #3
0
 def new_sequence(self, length=-1):
     seq = libcvht.sequence_new(length)
     return VHTSequence(seq, self, self.cb_new_track)