public Chord(ChordEnum _chord, MusicalKey _key, ChordFunction _function, List <Note> _notes) { this.chord = _chord; this.keyThisChordIsIn = _key; this.functionWithinKey = _function; this.notes = _notes; }
public Chord GetChordOfType(MusicalKey key, ChordFunction function) // returns random chord in a given key that performs given function, (functional harmony) { Chord chord; ChordEnum chordname = ChordEnum.none; if (functionalChords[key].ContainsKey(function)) // this should always pass, just to be safe { chordname = functionalChords[key][function][Random.Range((int)0, functionalChords[key][function].Count)]; // get a random chord of this function } else { Debug.LogError("Functional type not recognised"); } if (allChords.ContainsKey(chordname)) // just in case { chord = new Chord(chordname, key, function, allChords[chordname]); return(chord); } else { Debug.LogError("chord does not exist: " + chordname.ToString()); return(null); } }