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@8:60231840370f, 2015-09-19 (annotated)
- Committer:
- mfurlanetto
- Date:
- Sat Sep 19 10:04:37 2015 +0000
- Revision:
- 8:60231840370f
- Parent:
- 7:98bccc314b54
Aggiunta le gestione delle ottave
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfurlanetto | 7:98bccc314b54 | 1 | #include "math.h" |
mfurlanetto | 8:60231840370f | 2 | |
mfurlanetto | 7:98bccc314b54 | 3 | class Note { |
mfurlanetto | 7:98bccc314b54 | 4 | public: |
mfurlanetto | 8:60231840370f | 5 | Note(int frequency, bool hasDiesis, int* octaveRegister, bool* diesisRegister): _frequency(frequency), _diesis(hasDiesis), oReg(octaveRegister), dReg(diesisRegister){ |
mfurlanetto | 7:98bccc314b54 | 6 | } |
mfurlanetto | 7:98bccc314b54 | 7 | |
mfurlanetto | 7:98bccc314b54 | 8 | double getFrequency(){ |
mfurlanetto | 8:60231840370f | 9 | double result = _frequency*pow (2.0, *(oReg)); |
mfurlanetto | 7:98bccc314b54 | 10 | if (_diesis&&(*dReg)) |
mfurlanetto | 8:60231840370f | 11 | result*=1.0594630943593;//pow(2.0,1/12); |
mfurlanetto | 7:98bccc314b54 | 12 | return result; |
mfurlanetto | 7:98bccc314b54 | 13 | } |
mfurlanetto | 7:98bccc314b54 | 14 | |
mfurlanetto | 7:98bccc314b54 | 15 | private: |
mfurlanetto | 7:98bccc314b54 | 16 | int _frequency; |
mfurlanetto | 7:98bccc314b54 | 17 | bool _diesis; |
mfurlanetto | 7:98bccc314b54 | 18 | int* oReg; |
mfurlanetto | 7:98bccc314b54 | 19 | bool* dReg; |
mfurlanetto | 7:98bccc314b54 | 20 | }; |