computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit dc8b422eaf99b6932c27915c47c8b6dbfd1db07d
parent 20162386d6820c8c980e1ca13c82d5481f48ccd5
Author: Adam M <[email protected]>
Date:   Sat, 30 Jan 2021 16:16:02 -0600

blank slideshow mode

Diffstat:
Msrc/ComputerscareBlank.cpp | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -98,6 +98,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { dsp::SchmittTrigger nextFileButtonTrigger; dsp::Timer syncTimer; + dsp::Timer slideshowTimer; ComputerscareSVGPanel* panelRef; @@ -118,6 +119,8 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { END_BEHAVIOR, SHUFFLE_SEED, NEXT_FILE_BEHAVIOR, + SLIDESHOW_ACTIVE, + SLIDESHOW_TIME, NUM_PARAMS }; enum InputIds { @@ -157,6 +160,9 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { configMenuParam(NEXT_FILE_BEHAVIOR, 0.f, "Next File Trigger / Button Behavior", nextFileDescriptions); configMenuParam(SHUFFLE_SEED, 0.f, 1.f, 0.5f, "Shuffle Seed", 2); + configParam(SLIDESHOW_ACTIVE, 0.f, 1.f, 0.f, "Slideshow Active"); + configMenuParam(SLIDESHOW_TIME, 0.f, 1.f, 0.f, "Slideshow Time", 2, " Computerscare Time Units", 2, 1, 0); + paths.push_back("empty"); leftExpander.producerMessage = leftMessages[0]; @@ -179,6 +185,15 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { } } + if (params[SLIDESHOW_ACTIVE].getValue()) { + float dTime = exp(5 * params[SLIDESHOW_TIME].getValue()); + if (slideshowTimer.process(args.sampleTime) > dTime) { + checkAndPerformEndAction(true); + slideshowTimer.reset(); + } + + } + samplesDelay = frameDelay * args.sampleRate; bool shouldAdvanceAnimation = false; @@ -1053,6 +1068,12 @@ struct ComputerscareBlankWidget : MenuParamModuleWidget { menu->addChild(shuffleParam); + MenuParam* slideshowEnabled = new MenuParam(blank->paramQuantities[ComputerscareBlank::SLIDESHOW_ACTIVE], 0); + menu->addChild(slideshowEnabled); + + MenuParam* slideshowSpeedParam = new MenuParam(blank->paramQuantities[ComputerscareBlank::SLIDESHOW_TIME], 2); + menu->addChild(slideshowSpeedParam); + } void step() override { if (module) {