Beispiel #1
0
    def seq(self):
        sq = VHTSequence(
            libcvht.timestrip_get_seq(self._ptr), self._mod, self._mod.cb_new_track
        )

        for cb in self._mod.cb_new_sequence:
            cb(sq.index)

        return sq
Beispiel #2
0
    def __getitem__(self, itm):
        if type(itm) is tuple:
            return self.timeline.strips.get_seq(itm[1])
        else:
            if itm >= self.__len__():
                raise IndexError()

            if itm < 0:
                raise IndexError()

            return VHTSequence(libcvht.module_get_seq(self._mod_handle, itm),
                               self, self.cb_new_track)
Beispiel #3
0
    def update_strrep(self):
        seq_id = VHTSequence(libcvht.timestrip_get_seq(self._ptr), self._mod).index[1]
        col = libcvht.timestrip_get_col(self._ptr)
        start = libcvht.timestrip_get_start(self._ptr)
        length = libcvht.timestrip_get_length(self._ptr)
        rpb_start = libcvht.timestrip_get_rpb_start(self._ptr)
        rpb_end = libcvht.timestrip_get_rpb_end(self._ptr)

        self._strrep = "%d %d %d %d %d %d" % (
            seq_id,
            col,
            start,
            length,
            rpb_start,
            rpb_end,
        )
Beispiel #4
0
    def clone_sequence(self, s):
        seq = None
        if type(s) is int:
            seq = libcvht.sequence_clone(self[s]._seq_handle)
        else:
            seq = libcvht.sequence_clone(
                libcvht.timeline_get_seq(self.timeline._tl_handle, s[1]))

            libcvht.sequence_strip_parent(seq)

        libcvht.module_add_sequence(self._mod_handle, seq)
        for cb in self.cb_new_sequence:
            cb(libcvht.sequence_get_index(seq))

        for t in self[len(self) - 1]:
            for cb in self.cb_new_track:
                cb(libcvht.sequence_get_index(seq), t.index)

        return VHTSequence(seq, self, self.cb_new_track)
Beispiel #5
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
Beispiel #6
0
 def curr_seq(self):
     cs = libcvht.module_get_curr_seq(self._mod_handle)
     if cs:
         return VHTSequence(cs, self).index
     else:
         return 0
Beispiel #7
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)
Beispiel #8
0
 def new_sequence(self, length=-1):
     seq = libcvht.sequence_new(length)
     return VHTSequence(seq, self, self.cb_new_track)
Beispiel #9
0
 def __iter__(self):
     for itm in range(self.__len__()):
         yield VHTSequence(libcvht.module_get_seq(self._mod_handle, itm),
                           self, self.cb_new_track)
Beispiel #10
0
 def get_seq(self, itm):
     sq = libcvht.timeline_get_seq(self._tl_handle, itm)
     if sq:
         return VHTSequence(sq, self._mod, self._mod.cb_new_track)
     else:
         return None