Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
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
        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)