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: TextLCD mbed MMA8451Q TSI
Note.cpp@7:98bccc314b54, 2015-09-18 (annotated)
- Committer:
- mfurlanetto
- Date:
- Fri Sep 18 15:46:20 2015 +0000
- Revision:
- 7:98bccc314b54
- Child:
- 8:60231840370f
Aggiunta una classe per rappresentare le note;; Aggiunto il codice per considerare il diesis
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfurlanetto | 7:98bccc314b54 | 1 | #include "math.h" |
mfurlanetto | 7:98bccc314b54 | 2 | class Note { |
mfurlanetto | 7:98bccc314b54 | 3 | public: |
mfurlanetto | 7:98bccc314b54 | 4 | Note(int frequency, bool hasDiesis, int* octaveRegister, bool* diesisRegister): _frequency(frequency), _diesis(hasDiesis), dReg(diesisRegister), oReg(octaveRegister){ |
mfurlanetto | 7:98bccc314b54 | 5 | } |
mfurlanetto | 7:98bccc314b54 | 6 | |
mfurlanetto | 7:98bccc314b54 | 7 | double getFrequency(){ |
mfurlanetto | 7:98bccc314b54 | 8 | double result = pow (double(_frequency), *(oReg)+1); |
mfurlanetto | 7:98bccc314b54 | 9 | if (_diesis&&(*dReg)) |
mfurlanetto | 7:98bccc314b54 | 10 | result+=pow(2.0,1/12); |
mfurlanetto | 7:98bccc314b54 | 11 | return result; |
mfurlanetto | 7:98bccc314b54 | 12 | } |
mfurlanetto | 7:98bccc314b54 | 13 | |
mfurlanetto | 7:98bccc314b54 | 14 | private: |
mfurlanetto | 7:98bccc314b54 | 15 | int _frequency; |
mfurlanetto | 7:98bccc314b54 | 16 | bool _diesis; |
mfurlanetto | 7:98bccc314b54 | 17 | int* oReg; |
mfurlanetto | 7:98bccc314b54 | 18 | bool* dReg; |
mfurlanetto | 7:98bccc314b54 | 19 | }; |