public string addNewChord(string chordName) //adds a new chord with name 'chordName' and chord value equal to the current state of the strings to the dictionary { ChordObject tempChordObj = new ChordObject(); tempChordObj.setChord((int)(strings[0].value * (1 / fretPerc)), guitarStringsToPlay[0].value, (int)(strings[1].value * (1 / fretPerc)), guitarStringsToPlay[1].value, (int)(strings[2].value * (1 / fretPerc)), guitarStringsToPlay[2].value, (int)(strings[3].value * (1 / fretPerc)), guitarStringsToPlay[3].value, (int)(strings[4].value * (1 / fretPerc)), guitarStringsToPlay[4].value, (int)(strings[5].value * (1 / fretPerc)), guitarStringsToPlay[5].value); int i = 1; string newChordName = chordName; while (chordDictionary.ContainsKey(newChordName)) { newChordName = chordName + 'v' + i; i++; } chordDictionary.Add(newChordName, tempChordObj); return(newChordName); }
void setupDictionary() { ChordObject tempChordObj; string tempChord = "A"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 2, true, 2, true, 2, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "A7"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 2, true, 0, true, 2, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Am"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 1, true, 2, true, 2, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "B"; tempChordObj = new ChordObject(); tempChordObj.setChord(2, true, 4, true, 4, true, 4, true, 2, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "B7"; tempChordObj = new ChordObject(); tempChordObj.setChord(2, true, 0, true, 2, true, 1, true, 2, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Bm"; tempChordObj = new ChordObject(); tempChordObj.setChord(2, true, 3, true, 4, true, 4, true, 2, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "C"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 1, true, 0, true, 2, true, 3, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "C7"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 1, true, 3, true, 2, true, 3, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Cm"; tempChordObj = new ChordObject(); tempChordObj.setChord(3, true, 4, true, 5, true, 5, true, 0, false, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "D"; tempChordObj = new ChordObject(); tempChordObj.setChord(2, true, 3, true, 2, true, 0, true, 0, false, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "D7"; tempChordObj = new ChordObject(); tempChordObj.setChord(2, true, 1, true, 2, true, 0, true, 0, false, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Dm"; tempChordObj = new ChordObject(); tempChordObj.setChord(1, true, 3, true, 2, true, 0, true, 0, false, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "E"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 0, true, 1, true, 2, true, 2, true, 0, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "E7"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 0, true, 1, true, 0, true, 2, true, 0, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Em"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, true, 0, true, 0, true, 2, true, 2, true, 0, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "F"; tempChordObj = new ChordObject(); tempChordObj.setChord(1, true, 1, true, 2, true, 3, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "F7"; tempChordObj = new ChordObject(); tempChordObj.setChord(1, true, 4, true, 2, true, 3, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Fm"; tempChordObj = new ChordObject(); tempChordObj.setChord(1, true, 1, true, 3, true, 0, true, 0, true, 0, false); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "G"; tempChordObj = new ChordObject(); tempChordObj.setChord(3, true, 0, true, 0, true, 0, true, 2, true, 3, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "G7"; tempChordObj = new ChordObject(); tempChordObj.setChord(1, true, 0, true, 0, true, 0, true, 2, true, 3, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "Gm"; tempChordObj = new ChordObject(); tempChordObj.setChord(3, true, 3, true, 0, true, 0, true, 1, true, 3, true); chordDictionary.Add(tempChord, tempChordObj); originalChords.Add(tempChord); tempChord = "reset"; tempChordObj = new ChordObject(); tempChordObj.setChord(0, false, 0, false, 0, false, 0, false, 0, false, 0, false); chordDictionary.Add(tempChord, tempChordObj); }