Skip to content

Commit

Permalink
fix #11115: support solfeggio note names
Browse files Browse the repository at this point in the history
Actual support was added in previous commits; this is really just
cleanup and renaming the option from "Italian" to "Solfeggio".
  • Loading branch information
MarcSabatella committed Jun 28, 2013
1 parent 8864567 commit a90d21f
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 98 deletions.
2 changes: 1 addition & 1 deletion libmscore/chordlist.cpp
Expand Up @@ -1663,7 +1663,7 @@ void ChordList::write(Xml& xml) const
if (s.code.isNull())
xml.tagE(QString("sym name=\"%1\" value=\"%2\"").arg(s.name).arg(s.value));
else
xml.tagE(QString("sym name=\"%1\" code=\"%2\"").arg(s.name).arg(s.code.unicode()));
xml.tagE(QString("sym name=\"%1\" code=\"0x%2\"").arg(s.name).arg(s.code.unicode(),0,16));
}
}
xml.etag();
Expand Down
22 changes: 4 additions & 18 deletions libmscore/harmony.cpp
Expand Up @@ -42,11 +42,7 @@ QString Harmony::harmonyName()
r = tpc2name(_rootTpc, _rootSpelling, _rootLowerCase);

if (_textName != "")
#if 1
e = _textName.remove('=');
#else
e = _textName;
#endif
else if (!_degreeList.isEmpty()) {
hc.add(_degreeList);
// try to find the chord in chordList
Expand Down Expand Up @@ -328,8 +324,8 @@ void Harmony::determineRootBaseSpelling(NoteSpellingType& rootSpelling, bool& ro
rootSpelling = STANDARD;
else if (score()->styleB(ST_useGermanNoteNames))
rootSpelling = GERMAN;
else if (score()->styleB(ST_useItalianNoteNames))
rootSpelling = ITALIAN;
else if (score()->styleB(ST_useSolfeggioNoteNames))
rootSpelling = SOLFEGGIO;
baseSpelling = rootSpelling;
const ChordDescription* cd = getDescription();
if (cd) {
Expand Down Expand Up @@ -379,7 +375,7 @@ static int convertRoot(const QString& s, NoteSpellingType spelling, int& idx)
int acci;
switch (spelling) {
case GERMAN: acci = 1; break;
case ITALIAN: acci = 2; break;
case SOLFEGGIO: acci = 2; break;
default: acci = 1; break;
}
idx = acci;
Expand Down Expand Up @@ -424,7 +420,7 @@ static int convertRoot(const QString& s, NoteSpellingType spelling, int& idx)
return INVALID_TPC;
}
}
else if (spelling == ITALIAN) {
else if (spelling == SOLFEGGIO) {
QString ss = s.toLower().left(2);
if (ss == "do")
r = 0;
Expand Down Expand Up @@ -499,15 +495,11 @@ const ChordDescription* Harmony::parseHarmony(const QString& ss, int* root, int*
return 0;
}
*root = r;
#if 1
// enable this code to let "c" automatically imply C minor if lowerCaseMinorChords set
// doesn't work yet, but this is a start
bool preferMinor;
if (score()->styleB(ST_lowerCaseMinorChords) && s[0].isLower())
preferMinor = true;
else
preferMinor = false;
#endif
*base = INVALID_TPC;
int slash = s.indexOf('/');
if (slash != -1) {
Expand All @@ -525,15 +517,9 @@ const ChordDescription* Harmony::parseHarmony(const QString& ss, int* root, int*
cd = descr(s);
else {
_parsedForm = new ParsedChord();
#if 0
_parsedForm->parse(s, cl, syntaxOnly);
#else
// more code to allow "c" to automatically imply C minor
// this much works, but the problem is propagating this charade everywhere else
_parsedForm->parse(s, cl, syntaxOnly, preferMinor);
if (preferMinor)
s = _parsedForm->name();
#endif
cd = descr(s, _parsedForm);
}
if (cd) {
Expand Down
4 changes: 2 additions & 2 deletions libmscore/pitchspelling.cpp
Expand Up @@ -272,8 +272,8 @@ void tpc2name(int tpc, NoteSpellingType spelling, bool lowerCase, QString& s, in
acc = 0;
}
break;
case ITALIAN: s = inames[idx]; break;
default: s = names[idx]; break;
case SOLFEGGIO: s = inames[idx]; break;
default: s = names[idx]; break;
}
if (lowerCase)
s = s.toLower();
Expand Down
2 changes: 1 addition & 1 deletion libmscore/pitchspelling.h
Expand Up @@ -49,7 +49,7 @@ const int STEP_DELTA_TPC = 4; // the number of steps in a tpc step (
// pitch2tpc(pitch) replaced by pitch2tpc(pitch, KEY_C, PREFER_NEAREST)

enum { PREFER_FLATS=8, PREFER_NEAREST=11, PREFER_SHARPS=13 };
enum NoteSpellingType { STANDARD = 0, GERMAN, ITALIAN };
enum NoteSpellingType { STANDARD = 0, GERMAN, SOLFEGGIO };

extern int pitch2tpc(int pitch, int key, int prefer);

Expand Down
4 changes: 2 additions & 2 deletions libmscore/style.cpp
Expand Up @@ -140,7 +140,7 @@ StyleType styleTypes[] = {
StyleType("genCourtesyClef", ST_BOOL),
StyleType("useStandardNoteNames", ST_BOOL),
StyleType("useGermanNoteNames", ST_BOOL),
StyleType("useItalianNoteNames", ST_BOOL),
StyleType("useSolfeggioNoteNames", ST_BOOL),
StyleType("lowerCaseMinorChords", ST_BOOL),
StyleType("chordStyle", ST_STRING),
StyleType("chordsXmlFile", ST_BOOL),
Expand Down Expand Up @@ -537,7 +537,7 @@ StyleData::StyleData()

StyleVal(ST_useStandardNoteNames, true),
StyleVal(ST_useGermanNoteNames, false),
StyleVal(ST_useItalianNoteNames, false),
StyleVal(ST_useSolfeggioNoteNames, false),
StyleVal(ST_lowerCaseMinorChords, false),
StyleVal(ST_chordStyle, QString("std")),
StyleVal(ST_chordsXmlFile, false),
Expand Down
2 changes: 1 addition & 1 deletion libmscore/style.h
Expand Up @@ -258,7 +258,7 @@ enum StyleIdx {

ST_useStandardNoteNames,
ST_useGermanNoteNames,
ST_useItalianNoteNames,
ST_useSolfeggioNoteNames,
ST_lowerCaseMinorChords,
ST_chordStyle,
ST_chordsXmlFile,
Expand Down
4 changes: 2 additions & 2 deletions mscore/editstyle.cpp
Expand Up @@ -264,7 +264,7 @@ void EditStyle::getValues()

lstyle.set(ST_useStandardNoteNames, useStandardNoteNames->isChecked());
lstyle.set(ST_useGermanNoteNames, useGermanNoteNames->isChecked());
lstyle.set(ST_useItalianNoteNames, useItalianNoteNames->isChecked());
lstyle.set(ST_useSolfeggioNoteNames, useSolfeggioNoteNames->isChecked());
lstyle.set(ST_lowerCaseMinorChords, lowerCaseMinorChords->isChecked());

lstyle.set(ST_concertPitch, concertPitch->isChecked());
Expand Down Expand Up @@ -501,7 +501,7 @@ void EditStyle::setValues()
}
useStandardNoteNames->setChecked(lstyle.valueB(ST_useStandardNoteNames));
useGermanNoteNames->setChecked(lstyle.valueB(ST_useGermanNoteNames));
useItalianNoteNames->setChecked(lstyle.valueB(ST_useItalianNoteNames));
useSolfeggioNoteNames->setChecked(lstyle.valueB(ST_useSolfeggioNoteNames));
lowerCaseMinorChords->setChecked(lstyle.valueB(ST_lowerCaseMinorChords));
concertPitch->setChecked(lstyle.valueB(ST_concertPitch));

Expand Down
6 changes: 3 additions & 3 deletions mscore/editstyle.ui
Expand Up @@ -3720,12 +3720,12 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QRadioButton" name="useItalianNoteNames">
<widget class="QRadioButton" name="useSolfeggioNoteNames">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;La, Sib, Si, Do, Do#, ...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Italian</string>
<string>Solfeggio</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -4565,7 +4565,7 @@ p, li { white-space: pre-wrap; }
<tabstop>chordsXmlFile</tabstop>
<tabstop>useStandardNoteNames</tabstop>
<tabstop>useGermanNoteNames</tabstop>
<tabstop>useItalianNoteNames</tabstop>
<tabstop>useSolfeggioNoteNames</tabstop>
<tabstop>lowerCaseMinorChords</tabstop>
<tabstop>harmonyY</tabstop>
<tabstop>harmonyFretDist</tabstop>
Expand Down
93 changes: 26 additions & 67 deletions share/styles/chords_jazz.xml
Expand Up @@ -51,7 +51,7 @@
<sym code="0xe181" name="mi"/>
<sym code="0xe182" name="s11"/>
<sym code="0xe183" name="s13"/>
<sym code="0xe184" name="dim"/>
<sym code="0xe184" name="sdim"/>
<sym code="0xe185" name="sus"/>
<sym code="0xe186" name="+"/>
<sym code="0xe187" name="degree"/>
Expand Down Expand Up @@ -79,15 +79,28 @@
<sym code="0x266e" name="natural"/>
<sym code="0x266f" name="#"/>

<!-- these declarations enable b and mi render as literals when encountered as note names -->
<sym class="note" name="b"/>
<sym class="note" name="mi"/>

</font>

<font family="MuseJazz">
<mag>0.85</mag>

<sym code="0x28" name="("/>
<sym code="0x29" name=")"/>

<sym code="0x4d" name="M"/>
<sym name="("/>
<sym name=")"/>
<sym name="M"/>
<sym name="Ma"/>
<sym name="Maj"/>
<sym name="maj"/>
<sym name="m"/>
<sym name="min"/>
<sym name="aug"/>
<sym name="dim"/>
<sym name="alt"/>
<sym name="no"/>
<sym name="omit"/>

</font>

Expand All @@ -113,38 +126,14 @@
<font family="MuseJazz">
<mag>0.75</mag>

<sym code="0x28" name="s("/>
<sym code="0x29" name="s)"/>
<sym code="0x2c" name="s,"/>
<sym value="(" name="s("/>
<sym value=")" name="s)"/>
<sym value="," name="s,"/>

<sym code="0xe18a" name="striangle"/>

<sym code="0x61" name="a"/>
<sym code="0x62" name="letterb"/>
<sym code="0x63" name="c"/>
<sym code="0x64" name="d"/>
<sym code="0x65" name="e"/>
<sym code="0x66" name="f"/>
<sym code="0x67" name="g"/>
<sym code="0x68" name="h"/>
<sym code="0x69" name="i"/>
<sym code="0x6a" name="j"/>
<sym code="0x6b" name="k"/>
<sym code="0x6c" name="l"/>
<sym code="0x6d" name="m"/>
<sym code="0x6e" name="n"/>
<sym code="0x6f" name="o"/>
<sym code="0x70" name="p"/>
<sym code="0x71" name="q"/>
<sym code="0x72" name="r"/>
<sym code="0x73" name="s"/>
<sym code="0x74" name="t"/>
<sym code="0x75" name="u"/>
<sym code="0x76" name="v"/>
<sym code="0x77" name="w"/>
<sym code="0x78" name="x"/>
<sym code="0x79" name="y"/>
<sym code="0x7a" name="z"/>
<sym name="es"/>
<sym name="is"/>

</font>

Expand All @@ -170,29 +159,14 @@
<render>m:0:-&mod; striangle m:0:&mod;</render>
</token>

<token>
<name>Ma</name>
<render>M a</render>
</token>

<token>
<name>Maj</name>
<render>M a j</render>
</token>

<token>
<name>maj</name>
<render>m a j</render>
</token>

<token class="modifier">
<name>M</name>
<render>m:0:-&mod; M m:0:&mod;</render>
</token>

<token class="modifier">
<name>Ma</name>
<render>m:0:-&mod; M a m:0:&mod;</render>
<render>m:0:-&mod; Ma m:0:&mod;</render>
</token>

<token class="modifier">
Expand All @@ -202,22 +176,12 @@

<token class="modifier">
<name>Maj</name>
<render>m:0:-&mod; M a j m:0:&mod;</render>
<render>m:0:-&mod; Maj m:0:&mod;</render>
</token>

<token class="modifier">
<name>maj</name>
<render>m:0:-&mod; m a j m:0:&mod;</render>
</token>

<token>
<name>min</name>
<render>m i n</render>
</token>

<token>
<name>dim</name>
<render>d i m</render>
<render>m:0:-&mod; maj m:0:&mod;</render>
</token>

<token>
Expand All @@ -230,11 +194,6 @@
<render>m:0:-4 oslash m:0:4</render>
</token>

<token>
<name>aug</name>
<render>a u g</render>
</token>

<token>
<name>69</name>
<render>m:1:-2 s6 m:-4:7 s9 m:0:-5</render>
Expand Down
3 changes: 2 additions & 1 deletion share/styles/chords_std.xml
Expand Up @@ -41,6 +41,7 @@
<sym code="0x00f8" name="oslash"/>
<sym code="0x266f" name="#"/>
<sym code="0x266d" name="b"/>
<sym value="b" class="note" name="b"/>
</font>

<!--
Expand All @@ -64,7 +65,7 @@
<render>oslash</render>
</token>

<renderRoot>:n m:0:-1 :a m:.5:1</renderRoot>
<renderRoot>:n :a m:0.5:0</renderRoot>
<renderBase>m:-0.2:1 / m:0.2:1 :n :a m:0:-2</renderBase>

<!--
Expand Down

0 comments on commit a90d21f

Please sign in to comment.