You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ColorScale.cpp 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "ColorScale.h"
  2. ColorScale::ColorScale(){
  3. allTones[0].setColor(Qt::red);
  4. allTones[0].setName("C");
  5. allTones[0].setFlatTone(true);
  6. allTones[1].setColor(QColor(150,127,192));
  7. allTones[1].setName("Cis");
  8. allTones[1].setFlatTone(false);
  9. allTones[2].setColor(Qt::yellow);
  10. allTones[2].setName("D");
  11. allTones[2].setFlatTone(true);
  12. allTones[3].setColor(QColor(63,32,127));
  13. allTones[3].setName("Dis");
  14. allTones[3].setFlatTone(false);
  15. allTones[4].setColor(QColor(200,255,255));
  16. allTones[4].setName("E");
  17. allTones[4].setFlatTone(true);
  18. allTones[5].setColor(Qt::darkRed);
  19. allTones[5].setName("F");
  20. allTones[5].setFlatTone(true);
  21. allTones[6].setColor(Qt::cyan);
  22. allTones[6].setName("Fis");
  23. allTones[6].setFlatTone(false);
  24. allTones[7].setColor(QColor(255,100,0));
  25. allTones[7].setName("G");
  26. allTones[7].setFlatTone(true);
  27. allTones[8].setColor(Qt::magenta);
  28. allTones[8].setName("Gis");
  29. allTones[8].setFlatTone(false);
  30. allTones[9].setColor(Qt::green);
  31. allTones[9].setName("A");
  32. allTones[9].setFlatTone(true);
  33. allTones[10].setColor(Qt::gray);
  34. allTones[10].setName("Ais");
  35. allTones[10].setFlatTone(false);
  36. allTones[11].setColor(Qt::blue);
  37. allTones[11].setName("H");
  38. allTones[11].setFlatTone(true);
  39. }
  40. Tone * ColorScale::getToneByName(QString name){
  41. for(int i=0; i<12; i++){
  42. if(QString::compare(allTones[i].getName(), name, Qt::CaseInsensitive)==0)
  43. return allTones+i;
  44. }
  45. return nullptr;
  46. };
  47. Tone * ColorScale::getToneByKeyboardPosition(int pos){
  48. return allTones + ((pos-12)%12);
  49. }