コード例 #1
0
ファイル: Synth.py プロジェクト: marksweiss/supriya
 def __init__(
     self,
     synthdef=None,
     name=None,
     register_controls=None,
     node_id_is_permanent=False,
     **kwargs
 ):
     import supriya.assets.synthdefs
     import supriya.realtime
     import supriya.synthdefs
     Node.__init__(
         self,
         name=name,
         node_id_is_permanent=node_id_is_permanent,
         )
     synthdef = synthdef or supriya.assets.synthdefs.default
     assert isinstance(synthdef, supriya.synthdefs.SynthDef)
     self._synthdef = synthdef
     self._control_interface = supriya.realtime.SynthInterface(
         client=self,
         synthdef=self._synthdef,
         )
     if register_controls is not None:
         register_controls = bool(register_controls)
     self._register_controls = register_controls
     self._control_interface._set(**kwargs)
コード例 #2
0
ファイル: Group.py プロジェクト: teotikalki/supriya
    def __init__(self, children=None, name=None, node_id_is_permanent=False):
        import supriya.realtime

        self._control_interface = supriya.realtime.GroupInterface(client=self)
        Node.__init__(self,
                      name=name,
                      node_id_is_permanent=node_id_is_permanent)
        UniqueTreeList.__init__(self, children=children, name=name)
コード例 #3
0
ファイル: Group.py プロジェクト: teotikalki/supriya
    def allocate(self,
                 add_action=None,
                 node_id_is_permanent=False,
                 sync=False,
                 target_node=None):
        # TODO: Consolidate this with Group.allocate()
        import supriya.commands
        import supriya.realtime

        if self.is_allocated:
            return
        self._node_id_is_permanent = bool(node_id_is_permanent)
        target_node = Node.expr_as_target(target_node)
        server = target_node.server
        group_new_request = supriya.commands.GroupNewRequest(items=[
            supriya.commands.GroupNewRequest.Item(
                add_action=add_action,
                node_id=self,
                target_node_id=target_node.node_id,
            )
        ])
        (
            nodes,
            paused_nodes,
            requests,
            synthdefs,
        ) = self._collect_requests_and_synthdefs(self, server)
        requests = [group_new_request, *requests]
        if self.is_paused:
            paused_nodes.add(self)
        return self._allocate(paused_nodes, requests, server, synthdefs)
コード例 #4
0
    def allocate(
        self, add_action=None, node_id_is_permanent=False, sync=False, target_node=None
    ):
        # TODO: Consolidate this with Group.allocate()
        import supriya.commands
        import supriya.realtime

        if self.is_allocated:
            return
        self._node_id_is_permanent = bool(node_id_is_permanent)
        target_node = Node.expr_as_target(target_node)
        server = target_node.server
        group_new_request = supriya.commands.GroupNewRequest(
            items=[
                supriya.commands.GroupNewRequest.Item(
                    add_action=add_action,
                    node_id=self,
                    target_node_id=target_node.node_id,
                )
            ]
        )
        (
            nodes,
            paused_nodes,
            requests,
            synthdefs,
        ) = self._collect_requests_and_synthdefs(self, server)
        requests = [group_new_request, *requests]
        if self.is_paused:
            paused_nodes.add(self)
        return self._allocate(paused_nodes, requests, server, synthdefs)
コード例 #5
0
ファイル: Synth.py プロジェクト: ocaml-pirates/supriya
    def allocate(
        self,
        add_action=None,
        node_id_is_permanent=False,
        sync=True,
        target_node=None,
        **kwargs,
    ):
        import supriya.commands
        import supriya.realtime

        if self.is_allocated:
            return
        self._node_id_is_permanent = bool(node_id_is_permanent)
        target_node = Node.expr_as_target(target_node)
        server = target_node.server
        self.controls._set(**kwargs)
        # TODO: Map requests aren't necessary during /s_new
        settings, map_requests = self.controls._make_synth_new_settings()
        synth_request = supriya.commands.SynthNewRequest(
            add_action=add_action,
            node_id=self,
            synthdef=self.synthdef,
            target_node_id=target_node.node_id,
            **settings,
        )
        requests = [synth_request, *map_requests]
        paused_nodes = set()
        synthdefs = set()
        if self.is_paused:
            paused_nodes.add(self)
        if not self.synthdef.is_allocated:
            synthdefs.add(self.synthdef)
        return self._allocate(paused_nodes, requests, server, synthdefs)
コード例 #6
0
 def allocate(
     self,
     add_action=None,
     node_id_is_permanent=False,
     sync=False,
     target_node=None,
 ):
     # TODO: Handle AddAction.REPLACE un-allocation of target node
     import supriya.commands
     import supriya.realtime
     if self.is_allocated:
         return
     add_action, node_id, target_node_id = Node.allocate(
         self,
         add_action=add_action,
         node_id_is_permanent=node_id_is_permanent,
         target_node=target_node,
     )
     group_new_request = supriya.commands.GroupNewRequest(
         add_action=add_action,
         node_id=node_id,
         target_node_id=target_node_id,
     )
     nodes, paused_nodes, requests, synthdefs = \
         self._collect_requests_and_synthdefs(self)
     if self.is_paused:
         paused_nodes.add(self)
     requests.insert(0, group_new_request)
     if synthdefs:
         self._allocate_synthdefs(synthdefs)
     if paused_nodes:
         pairs = sorted((node.node_id, False) for node in paused_nodes)
         request = supriya.commands.NodeRunRequest(
             node_id_run_flag_pairs=pairs, )
         requests.append(request)
     if 1 < len(requests):
         message_bundler = supriya.realtime.MessageBundler(
             server=self.server,
             sync=True,
         )
         message_bundler.add_messages(requests)
         message_bundler.add_synchronizing_request(group_new_request)
         message_bundler.send_messages()
     else:
         group_new_request.communicate(
             server=self.server,
             sync=True,
         )
     return self
コード例 #7
0
 def allocate(self,
              add_action=None,
              node_id_is_permanent=False,
              sync=True,
              target_node=None,
              **kwargs):
     import supriya.commands
     import supriya.realtime
     if self.is_allocated:
         return
     add_action, node_id, target_node_id = Node.allocate(
         self,
         add_action=add_action,
         node_id_is_permanent=node_id_is_permanent,
         target_node=target_node,
     )
     if not self.synthdef.is_allocated:
         self.synthdef.allocate()
     self.controls._set(**kwargs)
     requests = []
     settings, map_requests = self.controls._make_synth_new_settings()
     synth_request = supriya.commands.SynthNewRequest(
         add_action=add_action,
         node_id=node_id,
         synthdef=self.synthdef,
         target_node_id=target_node_id,
         **settings)
     requests.append(synth_request)
     requests.extend(map_requests)
     if self.is_paused:
         pause_request = supriya.commands.NodeRunRequest([(self.node_id,
                                                           False)])
         requests.append(pause_request)
     if 1 < len(requests):
         message_bundler = supriya.realtime.MessageBundler(
             server=self.server,
             sync=True,
         )
         message_bundler.add_messages(requests)
         message_bundler.add_synchronizing_request(synth_request)
         message_bundler.send_messages()
     else:
         synth_request.communicate(
             server=self.server,
             sync=True,
         )
     return self
コード例 #8
0
 def _unregister_with_local_server(self):
     node_id = Node._unregister_with_local_server(self)
     if "gate" in self.controls:
         self.controls["gate"].reset()
     return node_id
コード例 #9
0
 def free(self):
     Node.free(self)
コード例 #10
0
 def _unregister_with_local_server(self):
     node_id = Node._unregister_with_local_server(self)
     if 'gate' in self.controls:
         self['gate'].reset()
     return node_id
コード例 #11
0
ファイル: Group.py プロジェクト: teotikalki/supriya
 def free(self):
     for node in self:
         node._unregister_with_local_server()
     Node.free(self)
     return self
コード例 #12
0
ファイル: Group.py プロジェクト: teotikalki/supriya
 def _unregister_with_local_server(self):
     for child in self:
         child._unregister_with_local_server()
     return Node._unregister_with_local_server(self)
コード例 #13
0
 def __init__(self, children=None, name=None):
     import supriya.realtime
     Node.__init__(self, name=name)
     UniqueTreeContainer.__init__(self, children=children, name=name)
     self._control_interface = supriya.realtime.GroupInterface(client=self)
コード例 #14
0
    def __init__(self, children=None, name=None, node_id_is_permanent=False):
        import supriya.realtime

        self._control_interface = supriya.realtime.GroupInterface(client=self)
        Node.__init__(self, name=name, node_id_is_permanent=node_id_is_permanent)
        UniqueTreeContainer.__init__(self, children=children, name=name)
コード例 #15
0
 def free(self):
     for node in self:
         node._unregister_with_local_server()
     Node.free(self)
     return self
コード例 #16
0
 def _unregister_with_local_server(self):
     for child in self:
         child._unregister_with_local_server()
     return Node._unregister_with_local_server(self)