OSC.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:LiveScript 作者: rekliner 项目源码 文件源码
def append(self, argument, typehint = None):
        """Appends data to the bundle, creating an OSCMessage to encapsulate
        the provided argument unless this is already an OSCMessage.
        Any newly created OSCMessage inherits the OSCBundle's address at the time of creation.
        If 'argument' is an iterable, its elements will be encapsuated by a single OSCMessage.
        Finally, 'argument' can be (or contain) a dict, which will be 'converted' to an OSCMessage;
          - if 'addr' appears in the dict, its value overrides the OSCBundle's address
          - if 'args' appears in the dict, its value(s) become the OSCMessage's arguments
        """
        if isinstance(argument, OSCMessage):
            binary = OSCBlob(argument.getBinary())
        else:
            msg = OSCMessage(self.address)
            if type(argument) == types.DictType:
                if 'addr' in argument:
                    msg.setAddress(argument['addr'])
                if 'args' in argument:
                    msg.append(argument['args'], typehint)
            else:
                msg.append(argument, typehint)

            binary = OSCBlob(msg.getBinary())

        self.message += binary
        self.typetags += 'b'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号