Compare commits
24 Commits
Author | SHA1 | Date |
---|---|---|
Neale Pickett | 6ae198bafc | |
Neale Pickett | 79741211ea | |
Neale Pickett | 188accc5d1 | |
Neale Pickett | eea155e433 | |
Neale Pickett | 8c8549d47b | |
Neale Pickett | 8e8836956d | |
Neale Pickett | 9e129fd56f | |
neale | 665a295247 | |
Neale Pickett | ebfe0a5b29 | |
Neale Pickett | c11a241ffa | |
Neale Pickett | 9ac66d7a7f | |
Neale Pickett | a5776f7888 | |
Neale Pickett | 5118e6beaf | |
Neale Pickett | e0c0fc57d8 | |
Neale Pickett | fb3363fd6a | |
Neale Pickett | 8beb164475 | |
Neale Pickett | cf4537b3bd | |
Neale Pickett | a43acf4604 | |
Neale Pickett | 516d623cb4 | |
Neale Pickett | c7807b0c26 | |
Neale Pickett | cd62fa7eba | |
Neale Pickett | f35e123474 | |
Neale Pickett | edaf38c598 | |
Neale Pickett | c6cf7b91b4 |
|
@ -7,21 +7,23 @@ VERSION=$GITHUB_REF_NAME
|
||||||
|
|
||||||
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
|
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
|
||||||
|
|
||||||
echo "=== Delete $VERSION"
|
|
||||||
curl \
|
curl \
|
||||||
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
|
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
|
||||||
--request DELETE \
|
--request DELETE \
|
||||||
$BASE
|
$BASE
|
||||||
echo
|
|
||||||
|
|
||||||
for path in "$@"; do
|
for path in "$@"; do
|
||||||
fn=$(basename "$path")
|
fn=$(basename "$path")
|
||||||
echo "=== Upload $VERSION/$fn"
|
echo "=== Upload $VERSION/$fn"
|
||||||
|
|
||||||
|
curl \
|
||||||
|
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
|
||||||
|
--request DELETE \
|
||||||
|
$BASE/$fn
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
--fail \
|
--fail \
|
||||||
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
|
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
|
||||||
--upload-file "$path" \
|
--upload-file "$path" \
|
||||||
$BASE/$fn
|
$BASE/$fn
|
||||||
echo
|
|
||||||
done
|
done
|
||||||
|
|
|
@ -16,4 +16,4 @@ jobs:
|
||||||
- name: publish
|
- name: publish
|
||||||
env:
|
env:
|
||||||
PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }}
|
PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }}
|
||||||
run: .gitea/publish.sh build/*.zip build/*.hex
|
run: .gitea/publish.sh *.hex *.zip
|
||||||
|
|
42
Makefile
42
Makefile
|
@ -2,27 +2,29 @@ DEVICE=/dev/ttyACM0
|
||||||
|
|
||||||
all: firmwares
|
all: firmwares
|
||||||
|
|
||||||
firmwares: build/MockBand.guitar-wammy.hex
|
firmwares: MockBand.guitar-wammy.hex
|
||||||
build/MockBand.guitar-wammy.hex: VID=0x1bad
|
MockBand.guitar-wammy.hex: VID=0x1bad
|
||||||
build/MockBand.guitar-wammy.hex: PID=0x0004
|
MockBand.guitar-wammy.hex: PID=0x0004
|
||||||
build/MockBand.guitar-wammy.hex: FLAGS=-DWAMMY
|
MockBand.guitar-wammy.hex: FLAGS=-DWAMMY
|
||||||
|
|
||||||
firmwares: build/MockBand.guitar.hex
|
firmwares: MockBand.guitar.hex
|
||||||
build/MockBand.guitar.hex: VID=0x1bad
|
MockBand.guitar.hex: VID=0x1bad
|
||||||
build/MockBand.guitar.hex: PID=0x0004
|
MockBand.guitar.hex: PID=0x0004
|
||||||
|
|
||||||
firmwares: build/MockBand.drums.hex
|
firmwares: MockBand.drums.hex
|
||||||
build/MockBand.drums.hex: VID=0x1bad
|
MockBand.drums.hex: VID=0x1bad
|
||||||
build/MockBand.drums.hex: PID=0x3110
|
MockBand.drums.hex: PID=0x3110
|
||||||
|
|
||||||
firmwares: build/MockBand.drums1.hex
|
MockBand.drums-xbox.hex: VID=0x1bad
|
||||||
build/MockBand.drums1.hex: VID=0x1bad
|
MockBand.drums-xbox.hex: PID=0x0003
|
||||||
build/MockBand.drums1.hex: PID=00005
|
|
||||||
|
MockBand.drums-rb1.hex: VID=0x1bad
|
||||||
|
MockBand.drums-rb1.hex: PID=00005
|
||||||
|
|
||||||
|
|
||||||
build/MockBand.%.hex: MockBand.ino
|
MockBand.%.hex: MockBand.ino
|
||||||
|
rm -rf build
|
||||||
mkdir -p build/cache
|
mkdir -p build/cache
|
||||||
rm -f build/build.options.json
|
|
||||||
arduino-builder \
|
arduino-builder \
|
||||||
-build-path $(abspath build/) \
|
-build-path $(abspath build/) \
|
||||||
-build-cache $(abspath build/cache/) \
|
-build-cache $(abspath build/cache/) \
|
||||||
|
@ -34,16 +36,16 @@ build/MockBand.%.hex: MockBand.ino
|
||||||
mv build/MockBand.ino.hex $@
|
mv build/MockBand.ino.hex $@
|
||||||
|
|
||||||
|
|
||||||
flash-%: build/MockBand.%.hex
|
flash-%: MockBand.%.hex
|
||||||
echo -n "Waiting for $(DEVICE)..."; while [ ! -e $(DEVICE) ]; do echo -n .; sleep 1; done
|
echo -n "Waiting for $(DEVICE)..."; while [ ! -e $(DEVICE) ]; do echo -n .; sleep 1; done
|
||||||
avrdude -v -patmega32u4 -cavr109 -P$(DEVICE) -b57600 -D -Uflash:w:$<:i
|
avrdude -v -patmega32u4 -cavr109 -P$(DEVICE) -b57600 -D -Uflash:w:$<:i
|
||||||
|
|
||||||
dist: build/MockBand.zip
|
dist: MockBand.zip
|
||||||
|
|
||||||
build/MockBand.zip: firmwares
|
MockBand.zip: firmwares
|
||||||
rm -f $@
|
rm -f $@
|
||||||
zip -r $@ README.md build/*.hex docs/
|
zip -r $@ README.md *.hex docs/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build MockBand.*.hex MockBand.zip
|
||||||
|
|
||||||
|
|
52
MockBand.ino
52
MockBand.ino
|
@ -2,8 +2,6 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <PluggableUSB.h>
|
#include <PluggableUSB.h>
|
||||||
|
|
||||||
//#define DEBUG
|
|
||||||
|
|
||||||
#include "hid.hh" // Modified HID library: doesn't prefix each packet with ID
|
#include "hid.hh" // Modified HID library: doesn't prefix each packet with ID
|
||||||
#include "instrument.hh"
|
#include "instrument.hh"
|
||||||
#include "standard.hh" // Standard pins
|
#include "standard.hh" // Standard pins
|
||||||
|
@ -28,7 +26,9 @@
|
||||||
#error USB_VID must be set to 0x1bad: see INSTALL.md
|
#error USB_VID must be set to 0x1bad: see INSTALL.md
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USB_PID == 0x0004
|
#if USB_PID == 0x0003
|
||||||
|
#define DRUM // XBox
|
||||||
|
#elif USB_PID == 0x0004
|
||||||
#define GUITAR
|
#define GUITAR
|
||||||
#elif USB_PID == 0x0005
|
#elif USB_PID == 0x0005
|
||||||
#define DRUM // Wii RB1
|
#define DRUM // Wii RB1
|
||||||
|
@ -127,42 +127,58 @@ void loop() {
|
||||||
//
|
//
|
||||||
// Calculate and send an HID update
|
// 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
|
#ifdef GUITAR
|
||||||
buttonState.buttons |= (buttons >> 10) & 0b11111; // Solo keys
|
buttonState.buttons |= (vbuttons >> 10) & 0b11111; // Solo keys
|
||||||
bitWrite(buttonState.buttons, 6, buttons & (0b11111 << 10)); // Solo modifier
|
bitWrite(buttonState.buttons, 6, (vbuttons >> 10) & 0b11111); // Solo modifier
|
||||||
|
|
||||||
if (bitRead(buttons, 6)) {
|
if (bitRead(vbuttons, 6)) {
|
||||||
buttonState.hatAndConstant = 0; // up
|
buttonState.hatAndConstant = 0; // up
|
||||||
} else if bitRead(buttons, 7) { //
|
} else if bitRead(vbuttons, 7) {
|
||||||
buttonState.hatAndConstant = 4; // down
|
buttonState.hatAndConstant = 4; // down
|
||||||
} else {
|
} else {
|
||||||
buttonState.hatAndConstant = 8; // nothing
|
buttonState.hatAndConstant = 8; // nothing
|
||||||
}
|
}
|
||||||
#else // DRUMS
|
#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
|
|
||||||
buttonState.axis[3] = bitRead(buttons, 12)?255:0; // High hat
|
|
||||||
|
|
||||||
// rbdrum2midi wants these set
|
// 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[0] = bitRead(buttonState.buttons, 3)?127:0; // Y
|
||||||
buttonState.velocity[1] = bitRead(buttonState.buttons, 2)?127:0; // R
|
buttonState.velocity[1] = bitRead(buttonState.buttons, 2)?127:0; // R
|
||||||
buttonState.velocity[2] = bitRead(buttonState.buttons, 1)?127:0; // G
|
buttonState.velocity[2] = bitRead(buttonState.buttons, 1)?127:0; // G
|
||||||
buttonState.velocity[3] = bitRead(buttonState.buttons, 0)?127:0; // B
|
buttonState.velocity[3] = bitRead(buttonState.buttons, 0)?127:0; // B
|
||||||
|
|
||||||
// Say the D-pad is centered
|
// Clone Hero 1.0.0.4080-final needs blue and yellow cymbals to send up and down on d-pad.
|
||||||
buttonState.hatAndConstant = 8;
|
// 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(vbuttons, 13)) {
|
||||||
|
buttonState.hatAndConstant = 0; // up
|
||||||
|
} else if (bitRead(vbuttons, 10)) {
|
||||||
|
buttonState.hatAndConstant = 4; // down
|
||||||
|
} else {
|
||||||
|
buttonState.hatAndConstant = 8; // nothing
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DPAD
|
#ifdef DPAD
|
||||||
#error DPAD isn't implemented yet
|
#error DPAD isn't implemented yet
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUGY0
|
||||||
// Log sample rate to the first X axis
|
// Log sample rate to the first Y axis
|
||||||
buttonState.axis[0] = samples & 0xff;
|
buttonState.axis[1] = samples & 0xff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Send an update
|
// Send an update
|
||||||
|
|
76
README.md
76
README.md
|
@ -1,4 +1,9 @@
|
||||||
# Mock Band
|
---
|
||||||
|
gitea: none
|
||||||
|
include_toc: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
Microcontroller Firmware to emulate guitar and drum kit controllers from the
|
Microcontroller Firmware to emulate guitar and drum kit controllers from the
|
||||||
Wii version of the Rock Band games.
|
Wii version of the Rock Band games.
|
||||||
|
@ -18,6 +23,23 @@ Thanks, Nicholas!
|
||||||
* A physical controller
|
* A physical controller
|
||||||
|
|
||||||
|
|
||||||
|
# Skills Needed
|
||||||
|
|
||||||
|
This is a research project:
|
||||||
|
it's assumed you already have a skillset that includes:
|
||||||
|
|
||||||
|
* Disassembling consumer electronics
|
||||||
|
* Using a multimeter to perform continuity checks
|
||||||
|
* Building electronics projects using a microcontroller
|
||||||
|
* Soldering
|
||||||
|
* Running the Arduino IDE *or* using `avrdude` to flash a firmware
|
||||||
|
|
||||||
|
If you're not comfortable with the above list,
|
||||||
|
your best option right now (Jan 2024) is to either buy a used kit,
|
||||||
|
or wait for the Polybar project to finish their work
|
||||||
|
producing a beginner-friendly kit with assembly manual.
|
||||||
|
|
||||||
|
|
||||||
# Controllers
|
# Controllers
|
||||||
|
|
||||||
## Guitar
|
## Guitar
|
||||||
|
@ -49,10 +71,30 @@ I'm sorry I didn't photograph or record any of this,
|
||||||
but it was pretty straightforward.
|
but it was pretty straightforward.
|
||||||
|
|
||||||
|
|
||||||
# Compiling
|
# Building
|
||||||
|
|
||||||
This compiles in the Arduino IDE.
|
This will compile in the Arduino IDE,
|
||||||
It doesn't have any library dependencies.
|
or on the commandline using `make`.
|
||||||
|
|
||||||
|
## Command Line
|
||||||
|
|
||||||
|
Just run `make` on a Unix system.
|
||||||
|
I set up paths for my Debian install of Arduino 1.8;
|
||||||
|
you may need to adjust them if your setup has different paths.
|
||||||
|
|
||||||
|
There is a `flash-%` target that will upload the built firmware to a Pro Micro.
|
||||||
|
The following targets exist:
|
||||||
|
|
||||||
|
make flash-guitar # Guitar firmware
|
||||||
|
make flash-guitar-wammy # Guitar firmware with wammy bar
|
||||||
|
make flash-drums # Drums firmware
|
||||||
|
|
||||||
|
## Arduino
|
||||||
|
|
||||||
|
Mockband has no library dependencies,
|
||||||
|
and as far as I can tell,
|
||||||
|
will work with the built-in Leonardo profile,
|
||||||
|
even though you're uploading to a Pro Micro.
|
||||||
|
|
||||||
You need to make two edits to `boards.txt`.
|
You need to make two edits to `boards.txt`.
|
||||||
Instructions for this are all over the place.
|
Instructions for this are all over the place.
|
||||||
|
@ -63,7 +105,7 @@ Don't edit anything that doesn't say `build` on the line! I can't help you if yo
|
||||||
In my examples, I'm editing the lines for the leonardo build. Yours might be different:
|
In my examples, I'm editing the lines for the leonardo build. Yours might be different:
|
||||||
it should match the board you're using.
|
it should match the board you're using.
|
||||||
|
|
||||||
## Build flags
|
### Build flags
|
||||||
|
|
||||||
This disables serial communications on the board.
|
This disables serial communications on the board.
|
||||||
|
|
||||||
|
@ -72,7 +114,7 @@ This disables serial communications on the board.
|
||||||
Hat tip to Nicholas Angle for figuring this out
|
Hat tip to Nicholas Angle for figuring this out
|
||||||
so I didn't have to.
|
so I didn't have to.
|
||||||
|
|
||||||
## VID and PID
|
### VID and PID
|
||||||
|
|
||||||
These set the USB identifiers.
|
These set the USB identifiers.
|
||||||
VID is the Vendor ID,
|
VID is the Vendor ID,
|
||||||
|
@ -81,7 +123,7 @@ and PID is the Product ID.
|
||||||
`0x1bad` means "Harmonix Music",
|
`0x1bad` means "Harmonix Music",
|
||||||
at least, it does to the Linux kernel.
|
at least, it does to the Linux kernel.
|
||||||
|
|
||||||
### For guitar
|
#### For guitar
|
||||||
|
|
||||||
PID `0x004` means "Guitar controller".
|
PID `0x004` means "Guitar controller".
|
||||||
|
|
||||||
|
@ -90,7 +132,7 @@ PID `0x004` means "Guitar controller".
|
||||||
leonardo.build.usb_product="Mockband Guitar"
|
leonardo.build.usb_product="Mockband Guitar"
|
||||||
|
|
||||||
|
|
||||||
### For drums
|
#### For drums
|
||||||
|
|
||||||
PID `0x3110` means "Rock Band 2 drums".
|
PID `0x3110` means "Rock Band 2 drums".
|
||||||
This works better with all versions of Rock Band on my wii,
|
This works better with all versions of Rock Band on my wii,
|
||||||
|
@ -186,6 +228,19 @@ will use both the 2x kick and the hi hat.
|
||||||
Maybe there is some other game that uses this too.
|
Maybe there is some other game that uses this too.
|
||||||
|
|
||||||
|
|
||||||
|
# Related Projects
|
||||||
|
|
||||||
|
Mockband is a research project.
|
||||||
|
You can use it to build a fully working controller,
|
||||||
|
but the main goal of this project is to inform other developers.
|
||||||
|
|
||||||
|
If you're looking for a user-friendly way to get a Rock Band drum controller,
|
||||||
|
consider the following alternatives:
|
||||||
|
|
||||||
|
* Buying a used Harmonix (official Rock Band) drum kit
|
||||||
|
* Mad Catz Rock Band 3 MIDI PRO-Adapter and a MIDI e-drum kit
|
||||||
|
* [Santroller](https://santroller.tangentmc.net/wiring_guides/drum.html)
|
||||||
|
wired to a used Harmonix drum kit
|
||||||
|
|
||||||
|
|
||||||
# Bugs / Not Yet Implemented
|
# Bugs / Not Yet Implemented
|
||||||
|
@ -200,6 +255,11 @@ just
|
||||||
and I'll open an issue.
|
and I'll open an issue.
|
||||||
|
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
You may use this under the terms of the [MIT License](docs/COPYING.md).
|
||||||
|
|
||||||
|
|
||||||
# Need help?
|
# Need help?
|
||||||
|
|
||||||
[Email me](mailto:neale@woozle.org),
|
[Email me](mailto:neale@woozle.org),
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright © 2023 Nicholas Angle
|
||||||
|
Copyright © 2023-2024 Neale Pickett <neale@woozle.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
**The software is provided "as is", without warranty of any kind, express or
|
||||||
|
implied, including but not limited to the warranties of merchantability,
|
||||||
|
fitness for a particular purpose and noninfringement. In no event shall the
|
||||||
|
authors or copyright holders be liable for any claim, damages or other
|
||||||
|
liability, whether in an action of contract, tort or otherwise, arising from,
|
||||||
|
out of or in connection with the software or the use or other dealings in the
|
||||||
|
software.**
|
|
@ -7,16 +7,44 @@ so that when original sources fall off the net,
|
||||||
hopefully at least my notes will still be around.
|
hopefully at least my notes will still be around.
|
||||||
|
|
||||||
|
|
||||||
|
USB data rate
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Unlike the Santroller
|
||||||
|
(which is much easier to install for beginners),
|
||||||
|
this firmware does not send continuous updates over USB,
|
||||||
|
unless it has to.
|
||||||
|
|
||||||
|
Because the only analog input is the wammy bar,
|
||||||
|
if you don't include that input,
|
||||||
|
the controller can stay silent until a button is pressed or released.
|
||||||
|
This allows 4 controllers to connect to a USB hub,
|
||||||
|
with no concern for overwhelming the hub.
|
||||||
|
Since the amount of data is about the same as a keyboard,
|
||||||
|
and a little less than a mouse,
|
||||||
|
I would expect that a 7-port USB 2 hub would also handle 7 instruments,
|
||||||
|
no problem.
|
||||||
|
I just don't know of any games that can use mor than 4 instruments.
|
||||||
|
|
||||||
|
If you do use the wammy bar,
|
||||||
|
an update is sent every 20 milliseconds.
|
||||||
|
The firmware still attempts to reduce lag
|
||||||
|
by sending button change events as soon as possible.
|
||||||
|
I haven't played with this much,
|
||||||
|
so if you have a wammy bar set up,
|
||||||
|
please reach out to me and let me know how it works.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sample Rate
|
Sample Rate
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
The number of samples taken since the last HID report
|
If `DEBUGY0' is defined,
|
||||||
is sent as the second Y axis.
|
the number of samples taken since the last HID report
|
||||||
If you `#define DEBUG`,
|
is sent as Y axis on hat 0.
|
||||||
you can use the
|
You can use the
|
||||||
[included gamepad tester](gamepad.html),
|
[included gamepad tester](gamepad.html),
|
||||||
to see the approximate number of samples as an integer,
|
to see the approximate number of samples as an integer.
|
||||||
on the first X axis.
|
|
||||||
|
|
||||||
This is approximate,
|
This is approximate,
|
||||||
because the browser encodes the value as a real number between -1 and 1.
|
because the browser encodes the value as a real number between -1 and 1.
|
||||||
|
@ -24,6 +52,11 @@ We convert it back, but may lose a little precision.
|
||||||
It's close enough for me,
|
It's close enough for me,
|
||||||
hopefully it's close enough for you.
|
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
|
Debouncing
|
||||||
----------
|
----------
|
||||||
|
@ -66,11 +99,33 @@ Here's what each bit means:
|
||||||
* 0o13: Cymbal modifier
|
* 0o13: Cymbal modifier
|
||||||
* 0o14: Select
|
* 0o14: Select
|
||||||
|
|
||||||
|
Hats
|
||||||
|
----
|
||||||
|
|
||||||
hatAndConstant
|
I guess "hats" are what I would have called "joysticks and dpads".
|
||||||
--------------
|
|
||||||
|
|
||||||
The HAT switch reports its position like a clock.
|
|
||||||
|
### Hat 0: unknown
|
||||||
|
|
||||||
|
This doesn't appear to be sent or used.
|
||||||
|
|
||||||
|
### Hat 1: guitar analog controls
|
||||||
|
|
||||||
|
The X axis is the position of the wammy bar.
|
||||||
|
|
||||||
|
The Y axis is the pickup selector.
|
||||||
|
I believe this was a 5-position switch on some guitars.
|
||||||
|
Only Rock Band 1 seems to use this.
|
||||||
|
|
||||||
|
### Hat 2: navigation
|
||||||
|
|
||||||
|
Sent by the dpad on the controller,
|
||||||
|
as `hatAndConstant`.
|
||||||
|
|
||||||
|
Guitars send up/down for the up/down strum buttons.
|
||||||
|
Drums send up/down on the blue/yellow cymbal pads.
|
||||||
|
|
||||||
|
The position of this digital input is reported in only 3 bits:
|
||||||
|
|
||||||
7 0 1
|
7 0 1
|
||||||
|
|
||||||
|
@ -98,20 +153,19 @@ Sending these values does not seem to cause problems with my Wii games.
|
||||||
Product ID (PID)
|
Product ID (PID)
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Nicholas,
|
The following USB PIDs are recognized by various things:
|
||||||
who did the initial work on the guitar,
|
|
||||||
suggested that PID 0x0005 would get the sketch working as drums.
|
|
||||||
And that was correct:
|
|
||||||
this works great on
|
|
||||||
Wii Rock Band 1 and
|
|
||||||
Wii LEGO Rock Band.
|
|
||||||
|
|
||||||
But it fails in frustrating ways on
|
* 0x0003: XBox Drum
|
||||||
Wii Rock Band 3:
|
* 0x0004: Wii Guitar
|
||||||
the yellow and blue pads don't navigate menus,
|
* 0x0005: Wii Drums - Rock Band 1
|
||||||
and cymbals aren't detected.
|
* 0x3110: Wii Drums - Rock Band 2
|
||||||
|
|
||||||
The fix was setting the USB PID to 0x3110.
|
There are some quirks to note:
|
||||||
|
|
||||||
|
* Rock Band 3 won't recognize cymbal hits on PID=0x0005,
|
||||||
|
but the same program with PID=0x3110 works fine.
|
||||||
|
* Wii games don't appear to recognized PID=0x0003.
|
||||||
|
Maybe Rock Band 3 does: I didn't test that one.
|
||||||
|
|
||||||
|
|
||||||
Drum Velocity
|
Drum Velocity
|
||||||
|
@ -119,7 +173,8 @@ Drum Velocity
|
||||||
|
|
||||||
I split the 12 "reserved" bytes from Nicholas's
|
I split the 12 "reserved" bytes from Nicholas's
|
||||||
`struct InstrumentButtonState`
|
`struct InstrumentButtonState`
|
||||||
into 4 bytes of I-Don't-Know, 4 bytes of velocity,
|
into 4 bytes of I-Don't-Know,
|
||||||
|
4 bytes of velocity,
|
||||||
and 4 more bytes of I-Don't-Know.
|
and 4 more bytes of I-Don't-Know.
|
||||||
Whenever a pad is hit,
|
Whenever a pad is hit,
|
||||||
I send 127 on the corresponding velocity.
|
I send 127 on the corresponding velocity.
|
||||||
|
@ -130,10 +185,21 @@ and looks only at the velocity values.
|
||||||
|
|
||||||
None of the Wii games I have
|
None of the Wii games I have
|
||||||
seem to care what these values are set to.
|
seem to care what these values are set to.
|
||||||
|
Clone Hero also does not care.
|
||||||
|
|
||||||
|
|
||||||
|
Clone Hero
|
||||||
|
==========
|
||||||
|
|
||||||
|
Clone Hero wants Hat 2 up on yellow cymbal hit,
|
||||||
|
and Hat 2 down on blue cymbal hit.
|
||||||
|
|
||||||
|
If it doesn't see these while mapping drum pads,
|
||||||
|
then hitting any color bad will trigger both drum and cymbal for that color.
|
||||||
|
|
||||||
|
|
||||||
References
|
References
|
||||||
=========
|
==========
|
||||||
|
|
||||||
The most valuable sources of information I found were:
|
The most valuable sources of information I found were:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue