From b8dadd82d4afff0e5e6b6a8a00df948045d31503 Mon Sep 17 00:00:00 2001 From: Simon Gagne Date: Thu, 16 Mar 2023 10:06:04 -0400 Subject: Commit pour deplacement vers VSStudio --- chordNote.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 chordNote.cpp (limited to 'chordNote.cpp') diff --git a/chordNote.cpp b/chordNote.cpp new file mode 100644 index 0000000..cea7ae5 --- /dev/null +++ b/chordNote.cpp @@ -0,0 +1,52 @@ +#include "chordNote.h" + +ChordNote::ChordNote(int btn, int startTime, int endTime) { + start = startTime; + end = endTime; + for (int i=0; i<5; i++) { + notes[i] = false; + } + notes[btn] = true; +}; + +ChordNote::~ChordNote() {}; + +void ChordNote::change(int button) { + notes[button] = !notes[button]; +}; + +void ChordNote::setEnd(int endTime) { + end = endTime; +}; + +void ChordNote::setRenderStart(int renderTime) { + renderStart = start - renderTime; +}; + +bool* ChordNote::getNotes() { + return notes; +}; + +int ChordNote::getStart() { + return start; +}; + +int ChordNote::getEnd() { + return end; +}; + +int ChordNote::getRenderStart() { + return renderStart; +}; + +std::regex ChordNote::getRegex() { + // empty string + std::string regex = ""; + // true becomes "t" and false becomes "f" + // this is used to create a string of 5 characters + // which can be used as a regex + for (int i=0; i<5; i++) { + regex += notes[i] ? "t" : "f"; + } + return std::regex(regex); +}; -- cgit v1.2.3