New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a second button to inject a MIDI marker #3
Comments
This involved injecting a |
Time to update the post. circuit:identical to beep button code#define PLACE_MARKER_PIN 4
int lastMarkState = 0;
int nextMarker = 1;
...
void loop() {
checkForMarker();
}
void checkForMarker() {
int markState = digitalRead(PLACE_MARKER_PIN);
if (markState != lastMarkState) {
lastMarkState = markState;
if (markState == 1) {
writeMidiMarker();
}
}
}
void writeMidiMarker() {
if (!file) return;
// delta + op code
writeVarLen(file, getDelta());
file.write(0xFF);
file.write(0x06);
// how many bytes are we writing?
byte len = 1;
if (nextMarker > 9) len++;
if (nextMarker > 99) len++;
if (nextMarker > 999) len++;
file.write(len);
// our label:
byte marker[len];
String(nextMarker++).getBytes(marker, len);
file.write(marker, len);
} screenshot |
landed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that way you can go "oh that bit was particularly sweet, click" and then move on again.
The text was updated successfully, but these errors were encountered: