From 58a24c7232f65adbc9d0f9feec8a24712b176136 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 4f38c0de215..de8c902b702 100644 --- a/server/plugins/BELAUGens.cpp +++ b/server/plugins/BELAUGens.cpp @@ -690,6 +690,9 @@ void DigitalOut_Ctor(DigitalOut *unit) int writeMode = (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, unit->mDigitalPin );