computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 3bc4717d3680404eb6c04bd86f2655ca3a041257
parent 447c2b47fb649678292d87a3dc389f4e11ace06d
Author: Adam M <[email protected]>
Date:   Thu, 31 Dec 2020 21:51:02 -0600

Blank scan input

Diffstat:
Msrc/ComputerscareBlank.cpp | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -132,7 +132,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { if (clockTriggered) { syncTimer.reset(); setSyncTime(currentSyncTime); - if(params[ANIMATION_ENABLED].getValue()) { + if (params[ANIMATION_ENABLED].getValue()) { goToFrame(0); } } @@ -141,6 +141,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { else if (clockMode == 1) { //scan float scanPosition = messageFromExpander[2]; + scanToPosition(scanPosition); } else if (clockMode == 2) { //frame advance @@ -353,6 +354,16 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { currentFrame = (int) std::floor(random::uniform() * numFrames); setCurrentFrameDelayFromTable(); } + void scanToPosition(float scanVoltage) { + /* 0v = frame 0 + 10.0v = frame n-1 + + */ + if (ready) { + int frameNum = floor(((scanVoltage + 10.f) / 10.01f) * numFrames); + goToFrame(frameNum); + } + } void toggleAnimationEnabled() { float current = params[ANIMATION_ENABLED].getValue(); if (current == 1.0) {