Browse Source

update template

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

2
template/configure.template

@ -39,7 +39,7 @@ echo "Checking Dependencies. No output is good"
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
ldconfig -p | grep $required_soname_cbox >/dev/null 2>&1 || { echo "$required_soname_cbox required, but it's not installed. Aborting."; exit 1; }
ldconfig -p | grep $required_soname_cbox >/dev/null 2>&1 || { echo "$required_soname_cbox required, but it's not installed. https://git.laborejo.org/lss/libcalfbox-lss . Aborting."; exit 1; }
command -v python3 >/dev/null 2>&1 || { echo >&2 "Python3 >= $required_version_python is required but it's not installed. Aborting."; exit 1; }
PY3VERSION=$(python3 -c 'import platform; print(platform.python_version())')

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