Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: trigger.hpp
- Revision:
- 4:e56a755aeaf1
- Parent:
- 3:086e556b57f9
- Child:
- 7:8b1c2d0bee9b
diff -r 086e556b57f9 -r e56a755aeaf1 trigger.hpp
--- a/trigger.hpp Wed Jul 24 12:24:05 2019 +0000
+++ b/trigger.hpp Wed Jul 24 15:06:20 2019 +0000
@@ -9,6 +9,11 @@
wait(0.0001);
}
+void loopFall(){
+ loop = !loop;
+
+}
+
void runonce(void){
getfaderdata();
//tempo calculations
@@ -29,6 +34,7 @@
determineduration();
outputdecision();
}
+
void firetrig(void){
if(clockcount<32){
clockcount++;
@@ -46,6 +52,19 @@
fire();
//getfaderdata
if(clockcount == 1 && storedduration == 1){
+ if (loop == 1){
+ ToPlay = (dataTail-PlayPos)% MAX_SAMPLES;
+ note = loopBuffer[ToPlay].note();
+ octive = loopBuffer[ToPlay].octave();
+ duration = loopBuffer[ToPlay].duration();
+ if (PlayPos >= MAX_SAMPLES){
+ PlayPos = 0;
+ }
+ else{
+ PlayPos++;
+ }
+ }
+ else{
allledoff();
getfaderdata();
gettempodata();
@@ -88,13 +107,16 @@
// pc.printf("NOTE: %i OCTIVE: %i DURATION: %i \n\r",note,octive,duration);
// pc.printf("abstemmp %f \n\r",abstempo);
if(clockcount == storedduration && sumnotes > 1){
- senddacout();
+
+ senddacout();
+
trigout = 1;
wait(0.0001);
trigout = 0;
wait(0.0001);
clockcount = 0;
}
+ }
if(clockcount == 1 && storedduration == 1){
updateled();
}