Beispiel #1
0
    def fields(self, include_attributes=True):
        self.F("magic", Magic("<!-- dmx encoding "))
        self.F("version", FixedString(len("binary 2 format pcf 1")))
        self.F("magic2", Magic(" -->\n\0"))
        version = self["version"].data
        assert version in ["binary 2 format pcf 1",
                           "binary 5 format pcf 2"], version

        if version == "binary 2 format pcf 1":
            prefix = Format("h")
        else:
            prefix = Format("I")
        strings = self.F("strings", PrefixedArray(prefix, String))

        if version == "binary 2 format pcf 1":
            namefield = lambda: Index(strings, Format("h"))
            stringfield = String
        else:
            namefield = lambda: Index(strings, Format("I"))
            stringfield = namefield
        self.F(
            "elements",
            PrefixedArray(Format("I"),
                          lambda: Element(namefield, stringfield)))
        if include_attributes:
            self.F(
                "attributes",
                Array(len(self["elements"]),
                      field_function=lambda i, f: PrefixedArray(
                          Format("I"), lambda: Attribute(
                              namefield, stringfield, lambda: ElementIndex(
                                  self["elements"], f, Format("i"))))))
            for i in range(len(self["elements"])):
                self["elements"][i].attribute = self["attributes"][i]
Beispiel #2
0
 def fields(self, strings):
     self.F("name", Index(strings, Format("I")))
     self.F("flags", Flags(Format("B"), self.flag_types))
     self.F("range", Format("ff"))
     self.F("samples", PrefixedArray(Format("H"), BVCDFlexSample))
     if "combo" in self["flags"].data:
         self.F("combo_samples", PrefixedArray(Format("H"), BVCDFlexSample))
Beispiel #3
0
    def fields(self, strings):
        self.F("type", Mapping(Format("B"), self.event_types))
        self.F("name", Index(strings, Format("I")))
        self.F("time", Format("ff"))
        self.F("params", Array(3, lambda: Index(strings, Format("I"))))
        self.F("ramp", PrefixedArray(Format("B"), BVCDRamp))
        self.F("flags", Flags(Format("B"), self.flag_types))
        self.F("distancetotarget", Format("f"))
        self.F(
            "tags",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("B"), 255.))))
        self.F(
            "flextimingtags",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("B"), 255.))))
        self.F(
            "shifted_time",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("H"), 4096.))))
        self.F(
            "playback_time",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("H"), 4096.))))
        if self["type"].data == "gesture":
            self.F("sequenceduration", Format("f"))
        self.F(
            "relativetag",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, Index(strings, Format("I")))))

        self.F("flex",
               PrefixedArray(Format("B"), lambda: BVCDFlexTrack(strings)))

        if self["type"].data == "loop":
            self.F("loopcount", Format("B"))

        if self["type"].data == "speak":
            self.F("cctype", Format("B"))
            self.F("cctoken", Index(strings, Format("I")))
            self.F("ccflags", Flags(Format("B"), self.cc_flag_types))
Beispiel #4
0
 def fields(self, strings, paramfield):
     self.F("name", Index(strings, Format("I")))
     self.F("param", paramfield)
Beispiel #5
0
 def fields(self, strings):
     self.F("milliseconds", Format("I"))
     self.F("milliseconds_2", Format("I"))
     self.F("sounds",
            PrefixedArray(Format("I"), lambda: Index(strings, Format("I"))))
Beispiel #6
0
 def fields(self, strings):
     self.F("name", Index(strings, Format("I")))
     self.F("channels",
            PrefixedArray(Format("B"), lambda: BVCDChannel(strings)))
     self.F("disabled", Format("B"))
Beispiel #7
0
 def fields(self, strings):
     self.F("name", Index(strings, Format("I")))
     self.F("events", PrefixedArray(Format("B"),
                                    lambda: BVCDEvent(strings)))
     self.F("disabled", Format("B"))