From bc743d4c150946686050f73257f6ec38171da885 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 10 Jan 2013 17:44:35 +0000 Subject: [PATCH] Cadence: Initial work for multi-channel aloop bridge; cleanup --- TODO | 3 ++ src/cadence.py | 5 +- src/cadence_aloop_daemon.py | 9 ++-- src/shared.py | 104 ++---------------------------------- 4 files changed, 15 insertions(+), 106 deletions(-) diff --git a/TODO b/TODO index 60ad05f..16f800e 100644 --- a/TODO +++ b/TODO @@ -28,6 +28,7 @@ Claudia: Claudia-Launcher: - Finish plugins - Auto-close option + - jamin -p ------------------- - MODULES - @@ -36,3 +37,5 @@ PatchCanvas: - Cleanup C++ - Implement export to Catarina file - Implement auto-arrange + + \ No newline at end of file diff --git a/src/cadence.py b/src/cadence.py index ad22aef..be270a1 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -176,6 +176,7 @@ asoundrc_aloop = ("" " ipc_key_add_uid true\n" " slave {\n" " pcm \"hw:Loopback,1,0\"\n" +" channels 2\n" " format S32_LE\n" " rate {\n" " @func igetenv\n" @@ -198,6 +199,8 @@ asoundrc_aloop = ("" " slave.pcm \"hw:Loopback,1,1\"\n" "}") +asoundrc_aloop_check = asoundrc_aloop.split("pcm.aloopPlayback", 1)[0] + asoundrc_jack = ("" "pcm.!default {\n" " type plug\n" @@ -1341,7 +1344,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): asoundrcRead = asoundrcFd.read().strip() asoundrcFd.close() - if asoundrcRead == asoundrc_aloop: + if asoundrcRead.startswith(asoundrc_aloop_check): if isAlsaAudioBridged(): self.b_alsa_start.setEnabled(False) self.b_alsa_stop.setEnabled(True) diff --git a/src/cadence_aloop_daemon.py b/src/cadence_aloop_daemon.py index 7dd9652..89f5723 100755 --- a/src/cadence_aloop_daemon.py +++ b/src/cadence_aloop_daemon.py @@ -24,9 +24,10 @@ checkFile = "/tmp/.cadence-aloop-daemon.x" # -------------------------------------------------- # Global JACK variables -global bufferSize, sampleRate +global bufferSize, sampleRate, channels bufferSize = 1024 sampleRate = 44100 +channels = 2 # -------------------------------------------------- # quit on SIGINT or SIGTERM @@ -77,7 +78,7 @@ def shutdown_callback(arg): # -------------------------------------------------- # run alsa_in and alsa_out def run_alsa_bridge(): - global bufferSize, sampleRate + global bufferSize, sampleRate, channels global procIn, procOut global useZita @@ -92,8 +93,8 @@ def run_alsa_bridge(): procIn.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "zita-a2j", "-L", "-j", "alsa2jack", "-d", "hw:Loopback,1,0"]) procOut.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "zita-j2a", "-L", "-j", "jack2alsa", "-d", "hw:Loopback,1,1"]) else: - procIn.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_in", "-j", "alsa2jack", "-d", "cloop", "-q", "1"]) - procOut.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_out", "-j", "jack2alsa", "-d", "ploop", "-q", "1"]) + procIn.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_in", "-j", "alsa2jack", "-d", "cloop", "-q", "1", "-c", "%i" % channels]) + procOut.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_out", "-j", "jack2alsa", "-d", "ploop", "-q", "1", "-c", "%i" % channels]) if procIn.waitForStarted(): sleep(1) diff --git a/src/shared.py b/src/shared.py index 8e7fb93..55e7eb0 100644 --- a/src/shared.py +++ b/src/shared.py @@ -112,9 +112,9 @@ if not os.path.exists(HOME): # ------------------------------------------------------------------------------------------------------------ # Set PATH -PATH_env = os.getenv("PATH") +PATH = os.getenv("PATH") -if PATH_env is None: +if PATH is None: qWarning("PATH variable not set") if MACOS: @@ -125,105 +125,7 @@ if PATH_env is None: PATH = ("/usr/local/bin", "/usr/bin", "/bin") else: - PATH = PATH_env.split(os.pathsep) - -del PATH_env - -# ------------------------------------------------------------------------------------------------------------ -# Static MIDI CC list - -MIDI_CC_LIST = ( - #"0x00 Bank Select", - "0x01 Modulation", - "0x02 Breath", - "0x03 (Undefined)", - "0x04 Foot", - "0x05 Portamento", - #"0x06 (Data Entry MSB)", - "0x07 Volume", - "0x08 Balance", - "0x09 (Undefined)", - "0x0A Pan", - "0x0B Expression", - "0x0C FX Control 1", - "0x0D FX Control 2", - "0x0E (Undefined)", - "0x0F (Undefined)", - "0x10 General Purpose 1", - "0x11 General Purpose 2", - "0x12 General Purpose 3", - "0x13 General Purpose 4", - "0x14 (Undefined)", - "0x15 (Undefined)", - "0x16 (Undefined)", - "0x17 (Undefined)", - "0x18 (Undefined)", - "0x19 (Undefined)", - "0x1A (Undefined)", - "0x1B (Undefined)", - "0x1C (Undefined)", - "0x1D (Undefined)", - "0x1E (Undefined)", - "0x1F (Undefined)", - #"0x20 *Bank Select", - #"0x21 *Modulation", - #"0x22 *Breath", - #"0x23 *(Undefined)", - #"0x24 *Foot", - #"0x25 *Portamento", - #"0x26 *(Data Entry MSB)", - #"0x27 *Volume", - #"0x28 *Balance", - #"0x29 *(Undefined)", - #"0x2A *Pan", - #"0x2B *Expression", - #"0x2C *FX *Control 1", - #"0x2D *FX *Control 2", - #"0x2E *(Undefined)", - #"0x2F *(Undefined)", - #"0x30 *General Purpose 1", - #"0x31 *General Purpose 2", - #"0x32 *General Purpose 3", - #"0x33 *General Purpose 4", - #"0x34 *(Undefined)", - #"0x35 *(Undefined)", - #"0x36 *(Undefined)", - #"0x37 *(Undefined)", - #"0x38 *(Undefined)", - #"0x39 *(Undefined)", - #"0x3A *(Undefined)", - #"0x3B *(Undefined)", - #"0x3C *(Undefined)", - #"0x3D *(Undefined)", - #"0x3E *(Undefined)", - #"0x3F *(Undefined)", - #"0x40 Damper On/Off", # <63 off, >64 on - #"0x41 Portamento On/Off", # <63 off, >64 on - #"0x42 Sostenuto On/Off", # <63 off, >64 on - #"0x43 Soft Pedal On/Off", # <63 off, >64 on - #"0x44 Legato Footswitch", # <63 Normal, >64 Legato - #"0x45 Hold 2", # <63 off, >64 on - "0x46 Control 1 [Variation]", - "0x47 Control 2 [Timbre]", - "0x48 Control 3 [Release]", - "0x49 Control 4 [Attack]", - "0x4A Control 5 [Brightness]", - "0x4B Control 6 [Decay]", - "0x4C Control 7 [Vib Rate]", - "0x4D Control 8 [Vib Depth]", - "0x4E Control 9 [Vib Delay]", - "0x4F Control 10 [Undefined]", - "0x50 General Purpose 5", - "0x51 General Purpose 6", - "0x52 General Purpose 7", - "0x53 General Purpose 8", - "0x54 Portamento Control", - "0x5B FX 1 Depth [Reverb]", - "0x5C FX 2 Depth [Tremolo]", - "0x5D FX 3 Depth [Chorus]", - "0x5E FX 4 Depth [Detune]", - "0x5F FX 5 Depth [Phaser]" - ) + PATH = PATH.split(os.pathsep) # ------------------------------------------------------------------------------------------------------------ # Remove/convert non-ascii chars from a string