def recurse(query_tree_node, node): for query_tree_child in query_tree_node.children: if isinstance(query_tree_child, QueryTreeGroup): group = Group() group._register_with_local_server( node_id=query_tree_child.node_id, server=self) node._children.append(group) recurse(query_tree_child, group) elif isinstance(query_tree_child, QueryTreeSynth): synth = Synth() synth._register_with_local_server( node_id=query_tree_child.node_id, server=self) node._children.append(synth) for query_tree_control in query_tree_child.children: pass
def _handle_node_info_response(self, message): from supriya.commands import Response from supriya.realtime import Group, Synth response = Response.from_osc_message(message) with self._lock: node_id = response.node_id node = self._nodes.get(node_id) if node is not None: node._handle_response(response) elif response.action == NodeAction.NODE_CREATED: if response.is_group: node = Group() else: node = self._pending_synths.pop(node_id, Synth()) node._register_with_local_server(server=self, node_id=response.node_id) parent = self._nodes[response.parent_id] node._set_parent(parent) if response.previous_node_id: previous_child = self._nodes[response.previous_node_id] index = parent.index(previous_child) parent._children.insert(index + 1, node) else: parent._children.append(node)
def _reallocate(self): DawNode._reallocate(self) if int(self.parent.parent.bus_group) == self.synth["out"]: return self.synth.release() self.synth = Synth(synthdef=self._build_synthdef(self.channel_count)) self.node.append(self.synth)
def _reallocate(self): DawNode._reallocate(self) if not (self.source.server and self.actual_target.server): if self.node is not None: self.node.release() self._debug_tree("Bailing") return actual_state = self._actual_state() expected_state = self._expected_state() if actual_state == expected_state: self._debug_tree("Matches") return self._debug_tree("Recreating") if actual_state["target"] != expected_state["target"]: actual_state["target"].receive._remove_incoming_send(self) expected_state["target"].receive._add_incoming_send(self) self._cached_target = expected_state["target"] if self.node is not None: self.node.release() self._channel_counts = expected_state["channel_counts"] self._node = Synth( name=f"to {self.cached_target.node.name}", synthdef=build_send_synthdef(*self.channel_counts), in_=expected_state["in_bus_id"], out=expected_state["out_bus_id"], ) if self.post_fader: self.parent.post_fader_group.append(self.node) else: self.parent.pre_fader_group.append(self.node)
def recurse(query_tree_node, node): for query_tree_child in query_tree_node.children: if isinstance(query_tree_child, QueryTreeGroup): group = Group() group._register_with_local_server( node_id=query_tree_child.node_id, server=self ) node._children.append(group) recurse(query_tree_child, group) elif isinstance(query_tree_child, QueryTreeSynth): synth = Synth() synth._register_with_local_server( node_id=query_tree_child.node_id, server=self ) node._children.append(synth) for query_tree_control in query_tree_child.children: pass
def _apply_local(self, server): from supriya.realtime import Node, Synth if isinstance(self.node_id, Synth): node_id = None synth = self.node_id else: node_id = self.node_id synth = Synth(synthdef=self.synthdef, **dict(self.kwargs)) if isinstance(self.target_node_id, Node): target_node = self.target_node_id else: target_node = server._nodes[self.target_node_id] synth._register_with_local_server( server, node_id=node_id, node_id_is_permanent=synth.node_id_is_permanent) target_node._move_node(add_action=self.add_action, node=synth)
def __init__(self, *, channel_count=2, dc=1.0, name=None): AudioDevice.__init__( self, channel_count=channel_count, name=" ".join(_.lower() for _ in delimit_words(type(self).__name__)), ) self._synth = Synth(synthdef=self._build_synthdef(channel_count), dc=dc) self.node.append(self.synth)
def __init__(self, *, device_types=None, channel_count=2, name=None): DawNode.__init__(self) self._device_types = device_types or ( DeviceType.MIDI, DeviceType.INSTRUMENT, DeviceType.AUDIO, ) self._bus_group = BusGroup.audio(bus_count=channel_count) self._devices = DeviceContainer(device_types=self.device_types) self._input_bus_group = BusGroup.audio(bus_count=channel_count) self._input_synth = Synth( synthdef=build_track_input_synthdef(channel_count)) self._levels = dict(input=None, prefader=None, postfader=None) self._osc_callbacks = dict(input=None, prefader=None, postfader=None) self._output_synth = Synth( synthdef=build_track_output_synthdef(channel_count)) self._receive = TrackReceive() self._sends = SendManager() self._slots = ClipSlotContainer() self._slots._parent = self self._is_active = True self._is_muted = False self._is_soloed = False self._soloed_tracks = set() UniqueTreeTuple.__init__( self, children=[self.receive, self.devices, self.sends]) self._node = Group( children=[ self.input_synth, self.devices.node, self.sends.pre_fader_group, self.output_synth, self.sends.post_fader_group, ], name=name or " ".join(_.lower() for _ in delimit_words(type(self).__name__)), )
def __init__(self, channel_count=2): Chain.__init__(self) self._levels = dict(input=None, prefader=None, postfader=None) self._osc_callbacks = dict(input=None, prefader=None, postfader=None) self._bus_group = BusGroup.audio(bus_count=channel_count) self._input_synth = Synth( synthdef=build_chain_input_synthdef(channel_count)) self._output_synth = Synth( synthdef=build_chain_output_synthdef(channel_count)) self._sends = SendManager() self._mutate([self.devices, self.sends]) self._node = Group( children=[ self.input_synth, self.devices.node, self.sends.pre_fader_group, self.output_synth, self.sends.post_fader_group, ], name="audio chain", )
def __init__(self, channel_count=2): RackDevice.__init__(self) self._levels = dict(output=None) self._osc_callbacks = dict(output=None) self._bus_group = BusGroup.audio(bus_count=channel_count) self._chains = ChainContainer(chain_class=AudioChain) self._receive = RackReceive() UniqueTreeTuple.__init__(self, children=[self.chains, self.receive]) self._rack_output_synth = Synth( synthdef=build_rack_output_synthdef(channel_count), name="rack output" ) self._node = Group( children=[self.chains.node, self.rack_output_synth], name="audio rack" )
def __init__(self): DawNode.__init__(self) self._clock = TempoClock() self._node = Synth(synthdef=self._build_synthdef(), name="transport")