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
Diff: Note.cpp
- Revision:
- 8:60231840370f
- Parent:
- 7:98bccc314b54
--- a/Note.cpp Fri Sep 18 15:46:20 2015 +0000 +++ b/Note.cpp Sat Sep 19 10:04:37 2015 +0000 @@ -1,13 +1,14 @@ #include "math.h" + class Note { public: - Note(int frequency, bool hasDiesis, int* octaveRegister, bool* diesisRegister): _frequency(frequency), _diesis(hasDiesis), dReg(diesisRegister), oReg(octaveRegister){ + Note(int frequency, bool hasDiesis, int* octaveRegister, bool* diesisRegister): _frequency(frequency), _diesis(hasDiesis), oReg(octaveRegister), dReg(diesisRegister){ } double getFrequency(){ - double result = pow (double(_frequency), *(oReg)+1); + double result = _frequency*pow (2.0, *(oReg)); if (_diesis&&(*dReg)) - result+=pow(2.0,1/12); + result*=1.0594630943593;//pow(2.0,1/12); return result; }