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: EFM32_SegmentLCD IOFuncLib mbed
midiFunctions.h
00001 #include <string> 00002 #include "IOFuncLib.h" 00003 genFunctions fnz; 00004 00005 00006 int getScala(char notaf, bool tiposcala) 00007 { 00008 //idx= nota da calcolare NB 0-6 00009 //tiposcala true=maggiore, flase=minore 00010 int idx = kcount; 00011 int scalamaggiore[] = {0,2,2,1,2,2,2 }; 00012 int scalaminore[] = {0,2,1,2,2,1,2 }; 00013 notaf = fnz.constrain(notaf, 0, 6); 00014 for (int i = 0; i < notaf + 1; i++) { 00015 if (tiposcala) idx = idx + scalamaggiore[i]; 00016 else idx = idx + scalaminore[i]; 00017 } 00018 return idx; 00019 } 00020 00021 00022 void printKey(int valk) 00023 { 00024 char score[] = {'C', 'c', 'D', 'd', 00025 'E', 'F', 'f', 'G', 00026 'g', 'A', 'a', 'B' 00027 }; 00028 char posidxs = 0; 00029 string strnota; 00030 00031 for (int i = 0; i < 7; i++) { 00032 //scala anglosassone 00033 if ((valk%2) == 0) strnota = strnota+score[getScala(i, true) % 12]; //se maggiore 00034 else strnota = strnota+score[getScala(i, false) % 12]; //se minore 00035 posidxs = posidxs + 8 + 3; 00036 } 00037 segmentDisplay.Number(valk); 00038 segmentDisplay.Write(fnz.string2char(strnota)); 00039 if ((valk%2)==0) segmentDisplay.Symbol(LCD_SYMBOL_MINUS, false); 00040 else segmentDisplay.Symbol(LCD_SYMBOL_MINUS, true); 00041 00042 00043 } 00044 00045 00046 00047 00048
Generated on Tue Jul 19 2022 21:46:38 by
