|
From: Tapio V. <aa...@us...> - 2010-07-07 17:07:45
|
Module: performous
Branch: joinmenu
Commit: cf96cf8b35d132aeb81f1a6fb4cc7205cdd09076
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jul 5 22:43:36 2010 +0300
Add enabled() to MidiDrums (in style of Webcam and Gettext) + fix some whitespace.
---
game/joystick.cc | 32 ++++++++++++++++----------------
game/joystick.hh | 2 ++
game/main.cc | 6 +-----
3 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 8c1cf66..02d016d 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -22,30 +22,30 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
static const int DRUM3_BLUE = 3; // low tom/ ride cymbal
static const int DRUM4_GREEN = 4; // low floor tom/ crash cymbal
- map[35] = DRUM0_ORANGE; // 35 - Acoustic Bass Drum
+ map[35] = DRUM0_ORANGE; // 35 - Acoustic Bass Drum
map[36] = DRUM0_ORANGE; // 36 - Bass Drum 1 *)
- map[37] = DRUM1_RED; // 37 - Side Stick
- map[38] = DRUM1_RED; // 38 - Acoustic Snare *)
- // 39 - Hand Clap
- map[40] = DRUM1_RED; // 40 - Electric Snare
+ map[37] = DRUM1_RED; // 37 - Side Stick
+ map[38] = DRUM1_RED; // 38 - Acoustic Snare *)
+ // 39 - Hand Clap
+ map[40] = DRUM1_RED; // 40 - Electric Snare
map[41] = DRUM4_GREEN; // 41 - Low Floor Tom *)
- map[42] = DRUM2_YELLOW; // 42 - Closed Hi-Hat
- // 43 - High Floor Tom
+ map[42] = DRUM2_YELLOW; // 42 - Closed Hi-Hat
+ // 43 - High Floor Tom
// map[44] = DRUM2_YELLOW; // 44 - Pedal Hi-Hat *) - ignore this for playability!
map[45] = DRUM3_BLUE; // 45 - Low Tom *)
map[46] = DRUM2_YELLOW; // 46 - Open Hi-Hat *)
- // 47 - Low-Mid Tom
+ // 47 - Low-Mid Tom
map[48] = DRUM2_YELLOW; // 48 - Hi-Mid Tom *)
map[49] = DRUM4_GREEN; // 49 - Crash Cymbal 1 *)
// 50 - High Tom
map[51] = DRUM3_BLUE; // 51 - Ride Cymbal 1 *)
// 52 - Chinese Cymbal
- // 53 - Ride Bell
- // 54 - Tambourine
- // 55 - Splash Cymbal
- // 56 - Cowbell
- map[57] = DRUM4_GREEN; // 57 - Crash Cymbal 2
- // 58 - Vibraslap
+ // 53 - Ride Bell
+ // 54 - Tambourine
+ // 55 - Splash Cymbal
+ // 56 - Cowbell
+ map[57] = DRUM4_GREEN; // 57 - Crash Cymbal 2
+ // 58 - Vibraslap
map[59] = DRUM3_BLUE; // 59 - Ride Cymbal 2
// 60 - Hi Bongo
// 61 - Low Bongo
@@ -56,7 +56,7 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
// 66 - Low Timbale
// 67 - High Agogo
// 68 - Low Agogo
- // 69 - Cabasa
+ // 69 - Cabasa
// 70 - Maracas
// 71 - Short Whistle
// 72 - Long Whistle
@@ -91,7 +91,7 @@ void input::MidiDrums::process() {
unsigned char note = ev.message >> 8;
unsigned char vel = ev.message >> 16;
#if 0
- // it is IMHO not a good idea to filter on the channel.
+ // it is IMHO not a good idea to filter on the channel.
// code snippet left here for visibility
unsigned char chan = ev.message & 0x0F;
if (chan != 0x09) continue; // only accept channel 10 (percussion)
diff --git a/game/joystick.hh b/game/joystick.hh
index ab12136..d8086ae 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -160,6 +160,7 @@ namespace input {
#ifdef USE_PORTMIDI
class MidiDrums {
public:
+ static bool enabled() { return true; }
MidiDrums();
void process();
private:
@@ -172,6 +173,7 @@ namespace input {
#else
class MidiDrums {
public:
+ static bool enabled() { return false; }
MidiDrums() {};
void process() {};
private:
diff --git a/game/main.cc b/game/main.cc
index e577384..0d1f585 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -406,11 +406,7 @@ void outputOptionalFeatureStatus() {
std::cout << " Internationalization: " <<
(Gettext::enabled() ? "Enabled" : "Disabled")
<< std::endl << " MIDI I/O: " <<
- #ifdef USE_PORTMIDI
- "Enabled"
- #else
- "Disabled"
- #endif
+ (input::MidiDrums::enabled() ? "Enabled" : "Disabled")
<< std::endl << " Webcam support: " <<
(Webcam::enabled() ? "Enabled" : "Disabled")
<< std::endl;
|