Skip to content
Snippets Groups Projects
Commit 39393fa9 authored by SeeLook's avatar SeeLook :musical_note:
Browse files

QML invokable method for default scale of supported instruments

- or tuning if any kind of guitar
parent ca0a865a
Branches
Tags
No related merge requests found
......@@ -288,6 +288,26 @@ Ttune TnootkaQML::tuning(const Tnote& s1, const Tnote& s2, const Tnote& s3, cons
}
Ttune TnootkaQML::defaultScale(int instr) {
switch (static_cast<Tinstrument::Etype>(instr)) {
case Tinstrument::ClassicalGuitar:
case Tinstrument::ElectricGuitar:
return Ttune::stdTune;
case Tinstrument::BassGuitar:
return Ttune::bassTunes[0];
case Tinstrument::Piano:
return tuning(Tnote(-11), Tnote(49), Tnote(), Tnote(), Tnote(), Tnote());
case Tinstrument::Bandoneon:
return tuning(Tnote(-11), Tnote(48), Tnote(), Tnote(), Tnote(), Tnote());
case Tinstrument::AltSax:
case Tinstrument::TenorSax:
return tuning(Tnote(11), Tnote(49), Tnote(), Tnote(), Tnote(), Tnote());
default: // NoInstrument and any unexpected case
return tuning(Tnote(10), Tnote(54), Tnote(), Tnote(), Tnote(), Tnote());
}
}
Tinstrument TnootkaQML::instr(int type) {
return Tinstrument(static_cast<Tinstrument::Etype>(type < 0 || type > INSTR_COUNT - 1 ? 0 : type));
}
......
......@@ -129,6 +129,12 @@ public:
Q_INVOKABLE QStringList bassTunings();
Q_INVOKABLE Ttune tuning(int tuningType);
Q_INVOKABLE Ttune tuning(const Tnote& s1, const Tnote& s2, const Tnote& s3, const Tnote& s4, const Tnote& s5, const Tnote& s6);
/**
* Returns default scale (or tuning if any kind of guitar)
* for given @p instr instrument
*/
Q_INVOKABLE Ttune defaultScale(int instr);
Q_INVOKABLE Tinstrument instr(int type);
Q_INVOKABLE QString getXmlToOpen();
Q_INVOKABLE QString getXmlToSave(const QString& fileName = QString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment