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
trigger.hpp
00001 #ifndef __trigger__ 00002 #define __trigger__ 00003 #include "variables.hpp" 00004 #include "math.hpp" 00005 void fire(void){ 00006 clockout = 1; 00007 wait(0.0001); 00008 clockout = 0; 00009 wait(0.0001); 00010 } 00011 00012 void runonce(void){ 00013 getfaderdata(); 00014 //tempo calculations 00015 gettempodata(); 00016 //note calculations 00017 sumprobabilitynotes(); 00018 randomgeneratenotes(); 00019 determinenotes(); 00020 00021 //octive calculation 00022 sumprobabilityoctives(); 00023 randomgenerateoctives(); 00024 determineoctives(); 00025 00026 //duration calculation 00027 sumprobabilityduration(); 00028 randomgenerateduration(); 00029 determineduration(); 00030 outputdecision(); 00031 } 00032 void firetrig(void){ 00033 if(clockcount<32){ 00034 clockcount++; 00035 clockcountneg = clockcount - 1; 00036 } 00037 else 00038 { 00039 clockcount = 0; 00040 clockcount++; 00041 } 00042 if(clockcount == 1){ 00043 storedduration = duration; 00044 } 00045 pc.printf("%i \n\r",clockcount); 00046 fire(); 00047 //getfaderdata 00048 if(clockcount == 1 && storedduration == 1){ 00049 allledoff(); 00050 getfaderdata(); 00051 gettempodata(); 00052 pc.printf("TEMPO %f \n\r",tempoval); 00053 //tempo calculations 00054 //note calculations 00055 sumprobabilitynotes(); 00056 randomgeneratenotes(); 00057 determinenotes(); 00058 //octive calculation 00059 sumprobabilityoctives(); 00060 randomgenerateoctives(); 00061 determineoctives(); 00062 //duration calculation 00063 sumprobabilityduration(); 00064 randomgenerateduration(); 00065 determineduration(); 00066 outputdecision(); 00067 } 00068 if(clockcount == storedduration-1){ 00069 allledoff(); 00070 getfaderdata(); 00071 //tempo calculations 00072 gettempodata(); 00073 //note calculations 00074 sumprobabilitynotes(); 00075 randomgeneratenotes(); 00076 determinenotes(); 00077 //octive calculation 00078 sumprobabilityoctives(); 00079 randomgenerateoctives(); 00080 determineoctives(); 00081 //duration calculation 00082 sumprobabilityduration(); 00083 randomgenerateduration(); 00084 determineduration(); 00085 outputdecision(); 00086 00087 } 00088 // pc.printf("NOTE: %i OCTIVE: %i DURATION: %i \n\r",note,octive,duration); 00089 // pc.printf("abstemmp %f \n\r",abstempo); 00090 if(clockcount == storedduration && sumnotes > 1){ 00091 senddacout(); 00092 trigout = 1; 00093 wait(0.0001); 00094 trigout = 0; 00095 wait(0.0001); 00096 clockcount = 0; 00097 } 00098 if(clockcount == 1 && storedduration == 1){ 00099 updateled(); 00100 } 00101 if(clockcount == storedduration-1){ 00102 updateled(); 00103 } 00104 } 00105 #endif
Generated on Sun Jul 17 2022 20:28:39 by
1.7.2