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.

Tone.cpp 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "Tone.h"
  2. Tone::Tone(QString name, QColor color, bool flatTone): name(name), color(color), flatTone(flatTone){
  3. };
  4. Tone::Tone(){};
  5. int Tone::getKeyboardPosition()const{
  6. if(QString::compare(name, "c", Qt::CaseInsensitive)==0) return 0;
  7. if(QString::compare(name, "cis", Qt::CaseInsensitive)==0) return 0;
  8. if(QString::compare(name, "d", Qt::CaseInsensitive)==0) return 1;
  9. if(QString::compare(name, "dis", Qt::CaseInsensitive)==0) return 1;
  10. if(QString::compare(name, "e", Qt::CaseInsensitive)==0) return 2;
  11. if(QString::compare(name, "f", Qt::CaseInsensitive)==0) return 3;
  12. if(QString::compare(name, "fis", Qt::CaseInsensitive)==0) return 3;
  13. if(QString::compare(name, "g", Qt::CaseInsensitive)==0) return 4;
  14. if(QString::compare(name, "gis", Qt::CaseInsensitive)==0) return 4;
  15. if(QString::compare(name, "a", Qt::CaseInsensitive)==0) return 5;
  16. if(QString::compare(name, "ais", Qt::CaseInsensitive)==0) return 5;
  17. if(QString::compare(name, "h", Qt::CaseInsensitive)==0) return 6;
  18. return 7;
  19. };
  20. int Tone::getQuintenPosition()const{
  21. if(QString::compare(name, "c", Qt::CaseInsensitive)==0) return 0;
  22. if(QString::compare(name, "g", Qt::CaseInsensitive)==0) return 1;
  23. if(QString::compare(name, "d", Qt::CaseInsensitive)==0) return 2;
  24. if(QString::compare(name, "a", Qt::CaseInsensitive)==0) return 3;
  25. if(QString::compare(name, "e", Qt::CaseInsensitive)==0) return 4;
  26. if(QString::compare(name, "h", Qt::CaseInsensitive)==0) return 5;
  27. if(QString::compare(name, "fis", Qt::CaseInsensitive)==0) return 6;
  28. if(QString::compare(name, "cis", Qt::CaseInsensitive)==0) return 7;
  29. if(QString::compare(name, "gis", Qt::CaseInsensitive)==0) return 8;
  30. if(QString::compare(name, "dis", Qt::CaseInsensitive)==0) return 9;
  31. if(QString::compare(name, "ais", Qt::CaseInsensitive)==0) return 10;
  32. if(QString::compare(name, "f", Qt::CaseInsensitive)==0) return 11;
  33. return 30;
  34. };
  35. void Tone::setColor(QColor color){
  36. this->color = color;
  37. emit colorchanged();
  38. };
  39. void Tone::setName(QString name){
  40. this->name = name;
  41. };
  42. void Tone::setFlatTone(bool flatTone){
  43. this->flatTone = flatTone;
  44. };
  45. QString Tone::getName()const{
  46. return name;
  47. };
  48. QColor Tone::getColor()const{
  49. return color;
  50. };
  51. bool Tone::getFlatTone()const{
  52. return flatTone;
  53. };
  54. Tone::~Tone(){};