Skip to content

Commit

Permalink
updated loading IOSenders
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmpercussion committed Aug 15, 2024
1 parent 08e6894 commit fe92c3a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions impsy/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,36 @@ def __init__(self, config: dict):

## Set up IO.
self.senders = []

if "midi" in self.config:
# Set up MIDI
self.midi_sender = impsio.MIDIServer(
midi_sender = impsio.MIDIServer(
self.config, self.construct_input_list, self.dense_callback
)
self.midi_sender.connect()
self.senders.append(self.midi_sender)
self.senders.append(midi_sender)

if "websocket" in self.config:
# Set up websocket
self.websocket_sender = impsio.WebSocketServer(
websocket_sender = impsio.WebSocketServer(
self.config, self.construct_input_list, self.dense_callback
)
self.websocket_sender.connect()
self.senders.append(self.websocket_sender)
self.senders.append(websocket_sender)

if "osc" in self.config:
# Set up OSC
self.osc_sender = impsio.OSCServer(
osc_sender = impsio.OSCServer(
self.config, self.construct_input_list, self.dense_callback
)
self.osc_sender.connect()
self.senders.append(self.osc_sender)
# if "serial" in self.config: ... TODO
self.senders.append(osc_sender)

if "serial" in self.config:
self.senders.append(impsio.SerialServer(self.config, self.construct_input_list, self.dense_callback))

if "serialmidi" in self.config:
self.senders.append(impsio.SerialMIDIServer(self.config, self.construct_input_list, self.dense_callback))

# connect all the senders
for sender in self.senders:
sender.connect()

# Import MDRNn
# Import MDRNN
click.secho("Importing MDRNN.", fg="yellow")
start_import = time.time()
import impsy.mdrnn as mdrnn
Expand Down Expand Up @@ -253,7 +259,6 @@ def monitor_user_action(self):
self.rnn_output_buffer.task_done()
# send MIDI noteoff messages to stop previous sounds
# TODO: this could be framed as "control switching"
# self.midi_sender.send_midi_note_offs()

def playback_rnn_loop(self):
"""Plays back RNN notes from its buffer queue. This loop blocks and should run in a separate thread."""
Expand Down

0 comments on commit fe92c3a

Please sign in to comment.