Skip to content

Commit

Permalink
count fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vlazzarini committed Dec 21, 2017
1 parent 1d90d62 commit bce68b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Bela/BelaCsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ struct DigiIn : csnd::Plugin<1, 1> {

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

Expand All @@ -71,8 +71,8 @@ struct DigiIn : csnd::Plugin<1, 1> {
int cnt = fcount;
for (auto &s : out) {
s = digitalRead(context,fcount,pin);
if(cnt < frms) cnt++;
else cnt = 0;
if(cnt == frms -1 ) cnt = 0;
else cnt++;
}
fcount = cnt;
}
Expand Down

0 comments on commit bce68b0

Please sign in to comment.