diff options
| author | yum <yum.food.vr@gmail.com> | 2022-11-05 13:19:47 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2022-11-05 13:20:28 -0700 |
| commit | da8e8d93813ca85a78653587ed23c90820763e69 (patch) | |
| tree | b5ab921d7c1edcf8a09dd85545f74a42f304d44d /osc_ctrl.py | |
| parent | 7f930340e3aa94d6aca120d28436594427469373 (diff) | |
OSC controller uses one sync per region instead of 2
My theory as to why this seems to work: VRChat batches parameter updates
together and applies them simultaneously. Thus we don't run into the
expected failure mode where we update the prior region before paging
over to the next region.
* Fix beep feature
* update the STT demo
Diffstat (limited to 'osc_ctrl.py')
| -rw-r--r-- | osc_ctrl.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/osc_ctrl.py b/osc_ctrl.py index 6b97b09..aebfa56 100644 --- a/osc_ctrl.py +++ b/osc_ctrl.py @@ -77,7 +77,6 @@ def encodeMessage(lines): def updateCell(client, cell_idx, letter_encoded): addr="/avatar/parameters/" + generate_utils.getBlendParam(cell_idx) letter_remapped = (-127.5 + letter_encoded) / 127.5 - print("Send encoded letter {} / {}".format(letter_encoded, letter_remapped)) client.send_message(addr, letter_remapped) def enable(client): @@ -96,34 +95,30 @@ def sendMessageCellDiscrete(client, msg_cell, which_cell): addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() client.send_message(addr, False) + if msg_cell != empty_cell: + addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() + client.send_message(addr, True) + # Really long messages just wrap back around. which_cell = (which_cell % (2 ** generate_utils.INDEX_BITS)) + enable(client) + # Seek to the current cell. addr="/avatar/parameters/" + getSelectParam() client.send_message(addr, which_cell) - enable(client) - - if msg_cell != empty_cell: - addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() - client.send_message(addr, False) - - # Wait for sync. - time.sleep(SYNC_DELAY_S) - # Update each letter for i in range(0, len(msg_cell)): updateCell(client, i, msg_cell[i]) - # If we're drawing something, turn the beep on. - if msg_cell != empty_cell: - addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() - client.send_message(addr, True) - # Wait for sync. time.sleep(SYNC_DELAY_S) + if msg_cell != empty_cell: + addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() + client.send_message(addr, False) + # The board is broken down into contiguous collections of characters called # cells. Each cell contains `NUM_LAYERS` characters. We can update one cell # every ~1.0 seconds. Going faster causes the board to display garbage to |
