Browse Source

update template

master
Nils 3 years ago
parent
commit
db83234471
  1. 23
      template/engine/sampler_sf2.py
  2. 2
      template/engine/session.py

23
template/engine/sampler_sf2.py

@ -47,7 +47,7 @@ class Sampler_sf2(Data):
but we always fetch the active patches (16 channels) live from calfbox through
self.activePatches()
"""
def __init__(self, parentSession, filePath, activePatches, ignoreProgramChanges, mixer:bool, defaultSoundfont=None):
def __init__(self, parentSession, filePath, activePatches, ignoreProgramChanges, defaultSoundfont=None):
super().__init__(parentSession)
self._unlinkOnSave:List[Union[str, PathLike]] = [] #old sf2 files no longer in use.
@ -79,16 +79,12 @@ class Sampler_sf2(Data):
except:
self._correctActivePatches()
#Create a dynamic pair of audio output ports and route all stereo pairs to our summing channel.
#This does _not_ need updating when loading another sf2 or changing instruments.
assert not self.parentSession.standaloneMode is None
if self.parentSession.standaloneMode:
lmixUuid = cbox.JackIO.create_audio_output('left_mix', "#1") #add "#1" as second parameter for auto-connection to system out 1
rmixUuid = cbox.JackIO.create_audio_output('right_mix', "#2") #add "#2" as second parameter for auto-connection to system out 2
else:
lmixUuid = cbox.JackIO.create_audio_output('left_mix')
rmixUuid = cbox.JackIO.create_audio_output('right_mix')
#There is also a function below to connect those to system 1/2
lmixUuid = cbox.JackIO.create_audio_output('left_mix')
rmixUuid = cbox.JackIO.create_audio_output('right_mix')
for i in range(16):
router = cbox.JackIO.create_audio_output_router(lmixUuid, rmixUuid)
@ -344,6 +340,15 @@ class Sampler_sf2(Data):
return self.midiInputJackName, self.midiInput.cboxMidiPortUid
def connectMixerToSystemPorts(self):
hardwareAudioPorts = cbox.JackIO.get_ports("system*", cbox.JackIO.AUDIO_TYPE, cbox.JackIO.PORT_IS_SINK | cbox.JackIO.PORT_IS_PHYSICAL) #don't sort. This is correctly sorted. Another sorted will do 1, 10, 11,
l = f"{cbox.JackIO.status().client_name}:left_mix"
r = f"{cbox.JackIO.status().client_name}:right_mix"
cbox.JackIO.port_connect(l, hardwareAudioPorts[0])
cbox.JackIO.port_connect(r, hardwareAudioPorts[1])
#Save / Load / Export
def serialize(self)->dict:

2
template/engine/session.py

@ -105,7 +105,7 @@ class Session(object):
self.sessionPrefix = ourPath #if we want to save and load resources they need to be in the session dir. We never load from outside, the scheme is always "import first, load local file"
self.absoluteJsonFilePath = os.path.join(ourPath, "save." + METADATA["shortName"] + ".json")
self.standaloneMode = sessionName == "NOT-A-SESSION"
self.standaloneMode = sessionName == "NOT-A-SESSION" #this is a bool! not a chain variable creation. The second is a double ==
try:
self.data = self.openFromJson(self.absoluteJsonFilePath)

Loading…
Cancel
Save