summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2022-11-16 11:41:47 +0000
committerTim Redfern <tim@getdrop.com>2022-11-16 11:41:47 +0000
commitcef7d23c526ff32ae2f2fd5a7b38b163672fc3a7 (patch)
tree1fd942c05d821a765fb8c31fc3961ec16d091e13
parent92db935dfa043d1e6e2f65b6fe157329c5ced521 (diff)
comments
-rw-r--r--audioin/src/ofApp.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/audioin/src/ofApp.h b/audioin/src/ofApp.h
index eeb8d21..f856ba1 100644
--- a/audioin/src/ofApp.h
+++ b/audioin/src/ofApp.h
@@ -24,9 +24,10 @@ public:
}
}
void add(float * input, int num){
+ //this assumes that num < size
memcpy(&data[writePoint],input,min(num,size-writePoint)*sizeof(float));
if (size-writePoint<num){ //we have to wrap
- //copy the remaining chunk to the start
+ //copy the remaining chunk to the start and set the new writePoint
memcpy(data,&input[size-writePoint],(num-(size-writePoint))*sizeof(float));
writePoint=num-(size-writePoint);
}