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.
Diff: Envelope/Envelope.h
- Revision:
- 21:60f01b17b0a6
- Parent:
- 19:08862f49cd9e
- Child:
- 30:08cc4ec58d07
diff -r fe235c124c67 -r 60f01b17b0a6 Envelope/Envelope.h
--- a/Envelope/Envelope.h Fri May 22 21:11:12 2020 +0000
+++ b/Envelope/Envelope.h Sat May 23 14:40:40 2020 +0000
@@ -18,35 +18,55 @@
//methods
//Methods
- //Constructor
+ /**Constructor*/
Envelope();
- //Destructior
+ /**Destructior*/
~Envelope();
- //Modifies input to envelope
+ /**Outputs unigned value with input modulated by ADS input variables
+ *input -32767.>32767 Output 0->65535
+ * @returns a Unsigned Short corresponding to Envelope Output */
uint16_t env_in(int a, int d, int s, int r, int in, bool init);
+
+ /** Deals with the release part of the note
+ *(triggered when note off button pressed)
+ * @Returns an Unsigned short (for release part)
+ * @Corresponding to envelope output */
uint16_t release(int s, int r, int in, bool init);
private://----------------------------------------------------------------------
//variables
- uint16_t out;
- int samples;
+ uint16_t out; //main output variable
+ int samples; //itterator for samples counter
//float time;
+ //ADSR variables multiplied up when applied to volume envelope
int av; //a volume
int dv;
int sv;
int rv;
+ //Difference per sample variables
int a_vec;
int d_vec;
int r_vec;
+ //incramented multiplier for output
int at;
- int samples_r;
+ int samples_r;//release samples itterator
//methods
+ /** Calculates the a_vec variable for use
+ * (used as difference per sample in attack part of note) */
int a_vector_calc(int av);
+
+ /** Calculates the d_vec variable for use
+ * (used as difference per sample in decay part of note)
+ * Positive only value */
int d_vector_calc(int dv, int sv);
+
+ /** Calculates the r_vec variable for use
+ * (used as difference per sample in release part of note)
+ * Positive only value */
int r_vector_calc(int sv, int rv);
};
#endif
\ No newline at end of file