From 2087665aacd8386ceed395ff15cc58a431dceea0 Mon Sep 17 00:00:00 2001 From: Giulio Moro Date: Wed, 3 Oct 2018 14:41:27 +0000 Subject: [PATCH] Properly initializing the DigitalOut buffer. Hopefully addresses BelaPlatform/supercollider#68 --- server/plugins/BELAUGens.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/plugins/BELAUGens.cpp b/server/plugins/BELAUGens.cpp index 235797d576b..7369ec8d064 100644 --- a/server/plugins/BELAUGens.cpp +++ b/server/plugins/BELAUGens.cpp @@ -679,6 +679,9 @@ void DigitalOut_Ctor(DigitalOut* unit) { (int)ZIN0(2); // method of writing; 1 = writeOnce; 0 = write on change -- cannot change after construction unit->mDigitalPin = (int)fDigital; unit->mLastOut = 0; + // initialize first buffer + pinMode(context, 0, unit->mDigitalPin, OUTPUT); + digitalWrite(context, 0, unit->mDigitalPin, unit->mLastOut); if ((unit->mDigitalPin < 0) || (unit->mDigitalPin >= context->digitalChannels)) { rt_printf("DigitalOut warning: digital pin must be between %i and %i, it is %i \n", 0, context->digitalChannels,