const AlphaTexStructure = require("./AlphaTexStructure.js");
/**
* @class
* @classdesc Encapsulates each chord in the music composed of an array of notes
*/
class Chord {
/**
* Constructs a new Chord
*/
constructor() {
this.notes = [];
}
/**
* Adds a note to the array of notes
* @param {Object} note Note object to add to this chord
*/
addNote(note) {
this.notes.push(note);
}
/**
* Converts Chord to a pretty string
* @returns {String} The pretty string representation of the chord
*/
toString() {
let output = "";
output += "{";
let noteCounter = this.notes.length;
this.notes.forEach((note) => {
output += note.toString();
if (noteCounter > 1) {
output += " ";
noteCounter--;
}
});
output += "}";
return output;
}
}
module.exports = Chord