Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (restTiming) {
if (restTiming.start) {
break // do nothing
}
if (restTiming.duration) {
duration *= restTiming.duration
}
}
state.position += duration
break
}
case "keySignature": {
state.keySignature = new KeySignature(+command[1])
break
}
case "timeSignature": {
let [, perBeat, noteValue] = command
state.beatsPerNote = 4 / noteValue
state.beatsPerMeasure = state.beatsPerNote * perBeat
break
}
case "macro": {
let [, macroName] = command
let chord = AutoChords.coerceChord(macroName)
if (chord) {
if (!song.autoChords) {
song.autoChords = []
}
it("gets name for key signature", function() {
expect(new KeySignature(0).name()).toBe("C")
expect(new KeySignature(1).name()).toBe("G")
expect(new KeySignature(2).name()).toBe("D")
expect(new KeySignature(3).name()).toBe("A")
expect(new KeySignature(4).name()).toBe("E")
expect(new KeySignature(5).name()).toBe("B")
expect(new KeySignature(-1).name()).toBe("F")
expect(new KeySignature(-2).name()).toBe("Bb")
expect(new KeySignature(-3).name()).toBe("Eb")
expect(new KeySignature(-4).name()).toBe("Ab")
expect(new KeySignature(-5).name()).toBe("Db")
expect(new KeySignature(-6).name()).toBe("Gb")
})
it("gets name for key signature", function() {
expect(new KeySignature(0).name()).toBe("C")
expect(new KeySignature(1).name()).toBe("G")
expect(new KeySignature(2).name()).toBe("D")
expect(new KeySignature(3).name()).toBe("A")
expect(new KeySignature(4).name()).toBe("E")
expect(new KeySignature(5).name()).toBe("B")
expect(new KeySignature(-1).name()).toBe("F")
expect(new KeySignature(-2).name()).toBe("Bb")
expect(new KeySignature(-3).name()).toBe("Eb")
expect(new KeySignature(-4).name()).toBe("Ab")
expect(new KeySignature(-5).name()).toBe("Db")
expect(new KeySignature(-6).name()).toBe("Gb")
})
it("should create generator", function() {
let generator = new MultiKeyChordGenerator(new KeySignature(0))
for (let i = 0; i < 10; i++) {
let chord = generator.nextChord()
expect(chord).toBeTruthy()
}
})
})
it("gets name for key signature", function() {
expect(new KeySignature(0).name()).toBe("C")
expect(new KeySignature(1).name()).toBe("G")
expect(new KeySignature(2).name()).toBe("D")
expect(new KeySignature(3).name()).toBe("A")
expect(new KeySignature(4).name()).toBe("E")
expect(new KeySignature(5).name()).toBe("B")
expect(new KeySignature(-1).name()).toBe("F")
expect(new KeySignature(-2).name()).toBe("Bb")
expect(new KeySignature(-3).name()).toBe("Eb")
expect(new KeySignature(-4).name()).toBe("Ab")
expect(new KeySignature(-5).name()).toBe("Db")
expect(new KeySignature(-6).name()).toBe("Gb")
})
it("gets key signature notes for E", function() {
let key = new KeySignature(4)
expect(key.isFlat()).toBe(false)
expect(key.isSharp()).toBe(true)
expect(key.accidentalNotes()).toEqual(["F", "C", "G", "D"])
expect(key.notesInRange(...trebleCleff)).toEqual(["F5", "C6", "G6", "D6"])
expect(key.notesInRange(...trebleCleff)).toEqual(["F5", "C6", "G6", "D6"])
})
it("gets name for key signature", function() {
expect(new KeySignature(0).name()).toBe("C")
expect(new KeySignature(1).name()).toBe("G")
expect(new KeySignature(2).name()).toBe("D")
expect(new KeySignature(3).name()).toBe("A")
expect(new KeySignature(4).name()).toBe("E")
expect(new KeySignature(5).name()).toBe("B")
expect(new KeySignature(-1).name()).toBe("F")
expect(new KeySignature(-2).name()).toBe("Bb")
expect(new KeySignature(-3).name()).toBe("Eb")
expect(new KeySignature(-4).name()).toBe("Ab")
expect(new KeySignature(-5).name()).toBe("Db")
expect(new KeySignature(-6).name()).toBe("Gb")
})
midi: null,
noteShaking: false,
anyOctave: false,
heldNotes: {},
touchedNotes: {},
scrollSpeed: 100,
noteWidth: DEFAULT_NOTE_WIDTH,
bufferSize: 10,
keyboardOpen: true,
settingsOpen: false,
scale: window.innerWidth < 1000 ? 0.8 : 1,
stats: new NoteStats(N.session.currentUser),
keySignature: new KeySignature(0),
}
}