Skip to content

Commit

Permalink
digi out bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vlazzarini committed Dec 21, 2017
1 parent 11eb091 commit 72441c3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Bela/BelaCsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ struct DigiIn : csnd::Plugin<1, 1> {

int kperf() {
outargs[0] = digitalRead(context,fcount,pin);
if(fcount == frms - 1) fcount = 0;
else fcount += nsmps;
fcount += nsmps;
fcount %= frms;
return OK;
}

int aperf() {
csnd::AudioSig out(this, outargs(0));
int cnt = fcount;
for (auto &s : out) {
s = digitalRead(context,fcount,pin);
s = digitalRead(context,cnt,pin);
if(cnt == frms - 1) cnt = 0;
else cnt++;
}
Expand Down Expand Up @@ -101,17 +101,17 @@ struct DigiOut : csnd::Plugin<0, 2> {

int kperf() {
digitalWrite(context,fcount,pin,inargs[0]);
if(fcount == frms - 1) fcount = 0;
else fcount+=nsmps;
fcount += nsmps;
fcount %= frms;
return OK;
}

int aperf() {
csnd::AudioSig in(this, inargs(0));
int cnt = fcount;
for (auto s : in) {
digitalWriteOnce(context,fcount,pin,s);
if(cnt == frms - 1) cnt =0;
digitalWriteOnce(context,cnt,pin,s);
if(cnt == frms - 1) cnt = 0;
else cnt++;
}
fcount = cnt;
Expand Down

0 comments on commit 72441c3

Please sign in to comment.