304 lines
6.8 KiB
Plaintext
304 lines
6.8 KiB
Plaintext
W W H W W W H
|
|
C D E F G A B
|
|
I II III IV V VI VII
|
|
|
|
|
|
inline
|
|
void MelodicMinorScale::createScale()
|
|
{
|
|
AeolianScale::createScale();
|
|
// Note note=getDegree(Degree::VI);
|
|
// note++; // MelodicMinor sharps the 6th of the minor scale
|
|
Note note=getDegree(Degree::V); // MelodicMinor sharps the 5th degree of the natural minor scale
|
|
note++;
|
|
setDegree(Degree::VI,note);
|
|
note=getDegree(Degree::VII);
|
|
note++; // MelodicMinor sharps the 7th of the natural minor scale
|
|
setDegree(Degree::VII,note);
|
|
}
|
|
|
|
|
|
class Progression
|
|
{
|
|
public:
|
|
typedef enum Mode{Ionian,Dorian,Phrygian,Lydian,Mixolydian,Aeolian,Locrian};
|
|
Progression();
|
|
virtual ~Progression();
|
|
bool create(Mode mode,Note::NoteType key);
|
|
private:
|
|
void handleIonian(Note::NoteType key);
|
|
void handleDorian(Note::NoteType key);
|
|
void handlePhrygian(Note::NoteType key);
|
|
void handleLydian(Note::NoteType key);
|
|
void handleMixolydian(Note::NoteType key);
|
|
void handleAeolian(Note::NoteType key);
|
|
void handleLocrian(Note::NoteType key);
|
|
|
|
Array<Music::Chord> mChords;
|
|
};
|
|
|
|
Progression::Progression()
|
|
{
|
|
}
|
|
|
|
Progression::~Progression()
|
|
{
|
|
}
|
|
|
|
bool Progression::create(Mode mode,Note::NoteType key)
|
|
{
|
|
switch(mode)
|
|
{
|
|
case Ionian :
|
|
handleIonian(key);
|
|
break;
|
|
case Dorian :
|
|
handleDorian(key);
|
|
break;
|
|
case Phrygian :
|
|
handlePhrygian(key);
|
|
break;
|
|
case Lydian :
|
|
handleLydian(key);
|
|
break;
|
|
case Mixolydian :
|
|
handleMixolydian(key);
|
|
break;
|
|
case Aeolian :
|
|
handleAeolian(key);
|
|
break;
|
|
case Locrian :
|
|
handleLocrian(key);
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void Progression::handleIonian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
void Progression::handleDorian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
void Progression::handlePhrygian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
void Progression::handleLydian(Note::NoteType key)
|
|
{
|
|
LydianScale lydianScale(key);
|
|
}
|
|
|
|
void Progression::handleMixolydian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
void Progression::handleAeolian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
void Progression::handleLocrian(Note::NoteType key)
|
|
{
|
|
}
|
|
|
|
/*
|
|
void main()
|
|
{
|
|
MIDIOutputDevice midiOut;
|
|
|
|
if(!midiOut.openDevice())return;
|
|
Music::Chord chord;
|
|
|
|
chord.create(Note::C,Music::Chord::MajorTriad);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MajorSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MinorTriad);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::DiminishedTriad);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::AugmentedTriad);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::DiminishedSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::HalfDiminishedSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MinorSixth);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MinorSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MinorMajorSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::DominantSixth);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::DominantSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
chord.create(Note::C,Music::Chord::MajorSeventh);
|
|
::OutputDebugString(chord.toString()+String("\n"));
|
|
// chord.play(midiOut);
|
|
|
|
}
|
|
*/
|
|
|
|
|
|
class ChordParser
|
|
{
|
|
public:
|
|
static Chord parse(const string &strChord);
|
|
private:
|
|
ChordParser();
|
|
virtual ~ChordParser();
|
|
};
|
|
|
|
Music::Chord Music::ChordParser::parse(const string &strChordRep)
|
|
{
|
|
string strChord(strChordRep);
|
|
string strRoot;
|
|
bool isSharp;
|
|
bool isFlat;
|
|
bool isMinor;
|
|
int length;
|
|
Chord chord;
|
|
Chord::ChordType chordType;
|
|
Note rootNote;
|
|
|
|
isSharp=false;
|
|
isFlat=false;
|
|
isMinor=false;
|
|
chordType=Chord::MajorTriad;
|
|
strChord.upper();
|
|
length=strChord.length();
|
|
if(strChord.isNull()||0==length)return Chord();
|
|
strRoot=strChord.substr(0,0);
|
|
rootNote=strRoot;
|
|
if(1==length)
|
|
{
|
|
chord.create(rootNote,chordType);
|
|
return chord;
|
|
}
|
|
isSharp=strChord.charAt(1)=='#';
|
|
isFlat=strChord.charAt(1)=='B';
|
|
if(isFlat)rootNote-=Note::HalfStep;
|
|
else if(isSharp)rootNote+=Note::HalfStep;
|
|
if(isFlat || isSharp)isMinor=strChord.charAt(2)=='-';
|
|
else isMinor=strChord.charAt(1)=='-';
|
|
if(isMinor)
|
|
{
|
|
chordType=Chord::MinorTriad; // "G-","G-7","Gb-7","Gb-"
|
|
if(length==2)
|
|
{
|
|
chord.create(rootNote,chordType);
|
|
return chord;
|
|
}
|
|
if(strChord.substr(length-1,length-1)=='7')
|
|
{
|
|
chordType=Chord::MinorSeventh;
|
|
chord.create(rootNote,chordType);
|
|
return chord;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
chordType=Chord::MajorTriad;
|
|
if(length==2)
|
|
{
|
|
if(strChord.substr(length-1,length-1)=='^')chordType=Chord::MajorSeventh;
|
|
else if(strChord.substr(length-1,length-1)=='7')chordType=Chord::DominantSeventh;
|
|
chord.create(rootNote,chordType);
|
|
return chord;
|
|
}
|
|
}
|
|
|
|
|
|
// typedef enum ChordType{MajorTriad,MinorTriad,DiminishedTriad,AugmentedTriad,MajorSeventh,DiminishedSeventh,
|
|
// HalfDiminishedSeventh,MinorSixth,MinorSeventh,MinorMajorSeventh,DominantSixth,DominantSeventh};
|
|
// void create(const Note &root=Note(Note::C),ChordType chordType=MajorTriad);
|
|
|
|
|
|
// void create(const Note &root=Note(Note::C),ChordType chordType=MajorTriad);
|
|
|
|
|
|
// if(length>1)
|
|
return chord;
|
|
}
|
|
|
|
|
|
// Music::Chord chord=ChordParser::parse("Gb-7");
|
|
// Music::Chord chord=ChordParser::parse("G-7");
|
|
// Music::Chord chord=ChordParser::parse("G-");
|
|
// Music::Chord chord=ChordParser::parse("G^");
|
|
// Music::Chord chord=ChordParser::parse("G7");
|
|
|
|
// Music::Chord chord=ChordParser::parse("Gb7");
|
|
// ::OutputDebugString(chord.toString()+String("\n"));
|
|
|
|
|
|
// insertSymbols(mSharpFlatSymbols);
|
|
// if(!nextSymbol())break;
|
|
// while(symbolIn(mSharpFlatSymbols))
|
|
// {
|
|
// parseSharpsFlats();
|
|
// nextSymbol();
|
|
// }
|
|
// removeSymbols(mSharpFlatSymbols);
|
|
|
|
if(symbolIn(ScanSymbols::Degree1))
|
|
{
|
|
parseDegree();
|
|
nextSymbol();
|
|
}
|
|
|
|
// insertSymbols(mSharpFlatSymbols);
|
|
// if(!nextSymbol())break;
|
|
while(symbolIn(ScanSymbols::Inflection1))
|
|
{
|
|
parseSharpsFlats();
|
|
nextSymbol();
|
|
}
|
|
// removeSymbols(mSharpFlatSymbols);
|
|
|
|
|
|
// if(symbolIn(ScanSymbols::Inflection1))
|
|
// {
|
|
// parseInflection();
|
|
// nextSymbol();
|
|
// }
|
|
|
|
|
|
if(!nextSymbol())break;
|
|
}
|
|
return returnCode;
|
|
|
|
|
|
/* ::OutputDebugString(mRootNote.toString()+String("\n"));
|
|
for(int index=0;index<mNotes.size();index++)
|
|
{
|
|
::OutputDebugString(mNotes[index].toString()+String("\n"));
|
|
}*/
|