diff --git a/Makefile b/Makefile index 13351a0..63d4965 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,11 @@ firmwares: MockBand.drums.hex MockBand.drums.hex: VID=0x1bad MockBand.drums.hex: PID=0x3110 -firmwares: MockBand.drumsx.hex -MockBand.drumsx.hex: VID=0x1bad -MockBand.drumsx.hex: PID=0x0003 +MockBand.drums-xbox.hex: VID=0x1bad +MockBand.drums-xbox.hex: PID=0x0003 -firmwares: MockBand.drums1.hex -MockBand.drums1.hex: VID=0x1bad -MockBand.drums1.hex: PID=00005 +MockBand.drums-rb1.hex: VID=0x1bad +MockBand.drums-rb1.hex: PID=00005 MockBand.%.hex: MockBand.ino diff --git a/MockBand.ino b/MockBand.ino index ac6d4b2..596087b 100644 --- a/MockBand.ino +++ b/MockBand.ino @@ -127,30 +127,33 @@ void loop() { // // Calculate and send an HID update // + uint16_t vbuttons = buttons; // We're going to mess with the button state - buttonState.buttons = (buttons & 0b1100111111); // +-..!OYRGB + buttonState.buttons = (vbuttons & 0b1100111111); // +-..!OYRGB #ifdef GUITAR - buttonState.buttons |= (buttons >> 10) & 0b11111; // Solo keys - bitWrite(buttonState.buttons, 6, buttons & (0b11111 << 10)); // Solo modifier + buttonState.buttons |= (vbuttons >> 10) & 0b11111; // Solo keys + bitWrite(buttonState.buttons, 6, vbuttons & (0b11111 << 10)); // Solo modifier - if (bitRead(buttons, 6)) { + if (bitRead(vbuttons, 6)) { buttonState.hatAndConstant = 0; // up - } else if bitRead(buttons, 7) { // + } else if bitRead(vbuttons, 7) { buttonState.hatAndConstant = 4; // down } else { buttonState.hatAndConstant = 8; // nothing } #else // DRUMS - buttonState.buttons |= (buttons >> 10) & 0b01011; // Cymbals - bitWrite(buttonState.buttons, 10, (buttons >> 0) & 0b01111); // Drum pad modifier - bitWrite(buttonState.buttons, 11, (buttons >> 10) & 0b01011); // Cymbals modifier - // High hat pedal (SOLO_RED) makes yellow cymbal strike a blue cymbal strike - if ((bitRead(buttons, 12) && bitRead(buttons, 13)) { - bitWrite(buttonState.buttons, 3, bitRead(buttons, 3)); // Yellow drum hit still counts - bitWrite(buttonState.buttons, 0); // Set blue + // Hi hat pedal (SOLO_RED) makes yellow cymbal strike a blue cymbal strike + if (bitRead(vbuttons, 12) && bitRead(vbuttons, 13)) { + bitClear(vbuttons, 13); + bitSet(vbuttons, 10); } + buttonState.buttons |= (vbuttons >> 10) & 0b01011; // Cymbals + bitWrite(buttonState.buttons, 10, (vbuttons >> 0) & 0b01111); // Drum pad modifier + bitWrite(buttonState.buttons, 11, (vbuttons >> 10) & 0b01011); // Cymbals modifier + + // rbdrum2midi wants these set: it ignores the button states. buttonState.velocity[0] = bitRead(buttonState.buttons, 3)?127:0; // Y buttonState.velocity[1] = bitRead(buttonState.buttons, 2)?127:0; // R @@ -160,9 +163,9 @@ void loop() { // Clone Hero 1.0.0.4080-final needs blue and yellow cymbals to send up and down on d-pad. // This is what the mysterous CymExt1 and CymExt2 mappings mean. // If these aren't set, all pads (except red) register as simultaneous drum and cymbal hits. - if (bitRead(buttons, 10)) { + if (bitRead(vbuttons, 13)) { buttonState.hatAndConstant = 0; // up - } else if (bitRead(buttons, 13)) { // + } else if (bitRead(vbuttons, 10)) { buttonState.hatAndConstant = 4; // down } else { buttonState.hatAndConstant = 8; // nothing diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 0000000..d328dc1 --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1,27 @@ +# Changelog + +## [1.0-beta2] - 2024-01-07 +### Added +- CI/CD build +- Make-based build, but it still works with the Arduino IDE! +- XBox controller + +### Fixed +- Blue and Yellow cymbal strikes send up and down on the D-pad. + - This fixes a bug with Clone Hero where Blue, Yellow, and Green pads, + both cymbal and drum pads, + triggered a drum and cymbal hit at the same time. + - Clone Hero's mysterious CymExt1 and CymExt2 are read on Yellow and Blue + cymbal hits, and must map to dpad up and down. In Windows this might be called "POV Hat"; + in Linux it's called "Hat 0" + +### Changed +- The "high hat" pin now causes the yellow cymbal to send a blue cymbal hit, + similar to devices sold in the past for this express purpose. + Previously it changed a hat axis, + because I thought "hat" meant "high hat". Heh. + +### Removed +- No more DEBUG option + +## [1.0-beta1] - 2024-01-04 diff --git a/docs/tech-notes.md b/docs/tech-notes.md index 27a7d43..ca7f158 100644 --- a/docs/tech-notes.md +++ b/docs/tech-notes.md @@ -11,12 +11,11 @@ Sample Rate ----------- The number of samples taken since the last HID report -is sent as the second Y axis. -If you `#define DEBUG`, -you can use the +is sent as the second Y axis, +which doesn't appear to be used by anything else. +You can use the [included gamepad tester](gamepad.html), -to see the approximate number of samples as an integer, -on the first X axis. +to see the approximate number of samples as an integer. This is approximate, because the browser encodes the value as a real number between -1 and 1. @@ -24,6 +23,11 @@ We convert it back, but may lose a little precision. It's close enough for me, hopefully it's close enough for you. +This number will not be very useful +unless you are polling the wammy bar, +since without that input, +updates are only sent when a button state changes. + Debouncing ---------- @@ -132,8 +136,31 @@ None of the Wii games I have seem to care what these values are set to. +Clone Hero +========== + +This controller doesn't have a dpad (currently), +so we're using 12 buttons to represent the state of 9 inputs. +Sometimes software is just weird! + +Clone Hero has two undocumented CymExt1 and CymExt2 mappings. +It talks about what they should be set to (on Windows) in the wiki, +but doesn't explain what they're used for. + +It seems that Clone Hero expects the Yellow and Blue cymbals +to send dpad inputs, in addition to the pad color and cymbal modifier. +If the controller doesn't send these, +then every drum pad hit plays that color's drum and cymbal at the same time, +and every cymbal pad hit does the same thing. + +I'm not exactly sure why Clone Hero does this, +but in any case, +Mockband sends the right things now, +so the drum controller should work correctly after you map everything. + + References -========= +========== The most valuable sources of information I found were: