summaryrefslogtreecommitdiffstats
path: root/osc_ctrl.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2022-10-30 15:06:46 -0700
committeryum <yum.food.vr@gmail.com>2022-10-30 15:06:46 -0700
commit20cfb71f92de56768dba44193032e835ae1e527f (patch)
tree40097dec4a3ee2b2a82527aa54e62812823377fa /osc_ctrl.py
parentcd4ef446d309a4666037c019dc461933d2f8ca7a (diff)
Reduce total # of select bits from 44 to 4
The board is divided into 16 regions. We select the region to be updated by updating 4 boolean parameters. We *used* to define 4 parameters per layer. Now we just have 4 params total, which affect every layer. Total param memory: 142 bits -> 102 bits Params updated per region update: 56 -> 16
Diffstat (limited to 'osc_ctrl.py')
-rw-r--r--osc_ctrl.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/osc_ctrl.py b/osc_ctrl.py
index 259a8c2..4c243f0 100644
--- a/osc_ctrl.py
+++ b/osc_ctrl.py
@@ -73,22 +73,10 @@ def encodeMessage(lines):
result += [state.encoding[' ']] * (BOARD_COLS - len(line))
return result
-def updateCell(client, cell_idx, letter_encoded, s0, s1, s2, s3):
+def updateCell(client, cell_idx, letter_encoded):
addr="/avatar/parameters/" + getLayerParam(cell_idx)
client.send_message(addr, letter_encoded)
- addr="/avatar/parameters/" + getSelectParam(cell_idx, 0)
- client.send_message(addr, s0)
-
- addr="/avatar/parameters/" + getSelectParam(cell_idx, 1)
- client.send_message(addr, s1)
-
- addr="/avatar/parameters/" + getSelectParam(cell_idx, 2)
- client.send_message(addr, s2)
-
- addr="/avatar/parameters/" + getSelectParam(cell_idx, 3)
- client.send_message(addr, s3)
-
def enable(client):
addr="/avatar/parameters/" + getEnableParam()
client.send_message(addr, True)
@@ -118,9 +106,23 @@ def sendMessageCellDiscrete(client, msg_cell, which_cell):
s2 = ((floor(which_cell / 2) % 2) == 1)
s3 = ((floor(which_cell / 1) % 2) == 1)
- # Seek each layer to the current cell.
+ # Seek to the current cell.
+ addr="/avatar/parameters/" + getSelectParam(0)
+ client.send_message(addr, s0)
+
+ addr="/avatar/parameters/" + getSelectParam(1)
+ client.send_message(addr, s1)
+
+ addr="/avatar/parameters/" + getSelectParam(2)
+ client.send_message(addr, s2)
+
+ addr="/avatar/parameters/" + getSelectParam(3)
+ client.send_message(addr, s3)
+
+ # Update each letter
for i in range(0, len(msg_cell)):
- updateCell(client, i, msg_cell[i], s0, s1, s2, s3)
+ updateCell(client, i, msg_cell[i])
+
if msg_cell != empty_cell:
addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam()
client.send_message(addr, False)