From 9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 13 Apr 2025 18:48:02 +0100 Subject: initial --- site/udo/bussing_quad.udo | 172 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100755 site/udo/bussing_quad.udo (limited to 'site/udo/bussing_quad.udo') diff --git a/site/udo/bussing_quad.udo b/site/udo/bussing_quad.udo new file mode 100755 index 0000000..b857012 --- /dev/null +++ b/site/udo/bussing_quad.udo @@ -0,0 +1,172 @@ +#ifndef UDO_BUSSINGQUAD +#define UDO_BUSSINGQUAD ## +/* + Quad bus handling + + This file is part of the SONICS UDO collection by Richard Knight 2021, 2023, 2025 + License: GPL-2.0-or-later + http://1bpm.net +*/ + + +/* + Get the quad left/right/front/rear names for a singular bus name + + SnameLF, SnameRF, SnameLR, SnameRR qbus_name Sbus + + SnameLF left front bus identifier + SnameRF right front bus identifier + SnameLR left rear bus identifier + SnameRR right rear bus identifier + + Sbus bus name +*/ +opcode qbus_name, SSSS, S + Sbus xin + xout sprintf("%sLF", Sbus), sprintf("%sRF", Sbus), sprintf("%sLR", Sbus), sprintf("%sRR", Sbus) +endop + + +/* + Read from a quad bus, but do not clear it + + aLF, aRF, aLR, aRR qbus_tap Sbus + + aLF left front channel + aRF right front channel + aLR left rear channel + aRR right rear channel + + Sbus bus name +*/ +opcode qbus_tap, aaaa, S + Sbus xin + SbusLF, SbusRF, SbusLR, SbusRR qbus_name Sbus + aLF chnget SbusLF + aRF chnget SbusRF + aLR chnget SbusLR + aRR chnget SbusRR + xout aLF, aRF, aLR, aRR +endop + +/* + Read from a quad bus, and then clear the bus + + aLF, aRF, aLR, aRR qbus_read Sbus + + aLF left front channel + aRF right front channel + aLR left rear channel + aRR right rear channel + + Sbus bus name +*/ +opcode qbus_read, aaaa, S + Sbus xin + SbusLF, SbusRF, SbusLR, SbusRR qbus_name Sbus + aLF chnget SbusLF + aRF chnget SbusRF + aLR chnget SbusLR + aRR chnget SbusRR + chnclear SbusLF + chnclear SbusRF + chnclear SbusLR + chnclear SbusRR + xout aLF, aRF, aLR, aRR +endop + + +/* + Set to a quad bus + + qbus_set Sbus, aLF, aRF, aLR, aRR + + Sbus bus name + aLF left front channel + aRF right front channel + aLR left rear channel + aRR right rear channel +*/ +opcode qbus_set, 0, Saaaa + Sbus, aLF, aRF, aLR, aRR xin + SbusLF, SbusRF, SbusLR, SbusRR qbus_name Sbus + chnset aLF, SbusLF + chnset aRF, SbusRF + chnset aLR, SbusLR + chnset aRR, SbusRR +endop + + +/* + Mix to a quad bus + + qbus_mix Sbus, aLF, aRF, aLR, aRR + + Sbus bus name + aLF left front channel + aRF right front channel + aLR left rear channel + aRR right rear channel + +*/ +opcode qbus_mix, 0, Saaaa + Sbus, aLF, aRF, aLR, aRR xin + SbusLF, SbusRF, SbusLR, SbusRR qbus_name Sbus + chnmix aLF, SbusLF + chnmix aRF, SbusRF + chnmix aLR, SbusLR + chnmix aRR, SbusRR +endop + + +/* + Mix to master bus + + qbus_masterout aLF, aRF, aLR, aRR + + aLF left front channel + aRF right front channel + aLR left rear channel + aRR right rear channel +*/ +opcode qbus_masterout, 0, aaaa + aLF, aRF, aLR, aRR xin + chnmix aLF, "mainLF" + chnmix aRF, "mainRF" + chnmix aLR, "mainLR" + chnmix aRR, "mainRR" +endop + + +/* + Record a bus to a wave file + + qbus_record Sbus, Spath + + Sbus bus name + Spath path to file to record to +*/ +opcode qbus_record, 0, SS + Sbus, Spath xin + aLF, aRF, aLR, aRR qbus_tap Sbus + fout Spath, 14, aLF, aRF, aLR, aRR +endop + + +; TODO: is this really used? +;gkqmastervolume init 1 +/* + Main output: anything mixed to the "main" bus goes to main outputs + +instr _qmainmixer + aLF, aRF, aLR, aRR qbus_read "main" + aLF *= gkqmastervolume + aRF *= gkqmastervolume + aLR *= gkqmastervolume + aRR *= gkqmastervolume + outq aLF, aRF, aLR, aRR +endin +alwayson "_qmainmixer" +*/ + +#end -- cgit v1.2.3