Exemplo n.º 1
0
 def allocate(
     self,
     add_action=None,
     node_id_is_permanent=False,
     sync=True,
     target_node=None,
     **kwargs
     ):
     from supriya.tools import requesttools
     from supriya.tools import servertools
     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 = requesttools.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 = requesttools.NodeRunRequest(
             [(self.node_id, False)])
         requests.append(pause_request)
     if 1 < len(requests):
         message_bundler = servertools.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
Exemplo n.º 2
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
     from supriya.tools import requesttools
     from supriya.tools import servertools
     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 = requesttools.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 = requesttools.NodeRunRequest(
             node_id_run_flag_pairs=pairs,
             )
         requests.append(request)
     if 1 < len(requests):
         message_bundler = servertools.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
Exemplo n.º 3
0
 def allocate(
     self,
     add_action=None,
     node_id_is_permanent=False,
     sync=True,
     target_node=None,
     **kwargs
     ):
     from supriya.tools import requesttools
     from supriya.tools import servertools
     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 = requesttools.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 = requesttools.NodeRunRequest(
             [(self.node_id, False)])
         requests.append(pause_request)
     if 1 < len(requests):
         message_bundler = servertools.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
Exemplo n.º 4
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
     from supriya.tools import requesttools
     from supriya.tools import servertools
     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 = requesttools.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 = requesttools.NodeRunRequest(
             node_id_run_flag_pairs=pairs, )
         requests.append(request)
     if 1 < len(requests):
         message_bundler = servertools.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