You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:45
|
Module: performous
Branch: instrumentgraph
Commit: 085b849f444709fa0c3ccba90b82ec4e9932e689
Author: Tapio Vierros <tap...@gm...>
Date: Wed May 12 21:03:30 2010 +0300
Fix crash when trying to enable pre-disabled webcam.
---
game/screen_sing.cc | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 2252fb1..07b0cb3 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -255,7 +255,10 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_w) dispInFlash(++config["game/pitch"]); // Toggle pitch wave
#ifdef USE_OPENCV
// Toggle webcam
- if (key == SDLK_a) { dispInFlash(++config["graphic/webcam"]); m_cam->pause(!config["graphic/webcam"].b()); }
+ if (key == SDLK_a) {
+ if (!m_cam) m_cam.reset(new Webcam());
+ if (m_cam) { dispInFlash(++config["graphic/webcam"]); m_cam->pause(!config["graphic/webcam"].b()); }
+ }
#endif
// Latency settings
if (key == SDLK_F1) dispInFlash(--config["audio/video_delay"]);
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:43
|
Module: performous
Branch: instrumentgraph
Commit: ae34964527610b8007ad0743244ff43a8599348f
Author: Xaldyz <xa...@us...>
Date: Wed May 12 19:18:46 2010 +0200
Fixed linking problem when library OpenCV not set
---
game/screen_sing.cc | 14 +++++++++++++-
game/screen_sing.hh | 6 ++++++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index dcde072..2252fb1 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -56,9 +56,13 @@ void ScreenSing::enter() {
std::cerr << e.what() << std::endl;
}
}
+
+#ifdef USE_OPENCV
if (config["graphic/webcam"].b()) { // Initialize webcam
m_cam.reset(new Webcam());
}
+#endif
+
if (!m_song->video.empty() && config["graphic/video"].b()) { // Load video
m_video.reset(new Video(m_song->path + m_song->video, m_song->videoGap));
}
@@ -178,7 +182,9 @@ void ScreenSing::exit() {
m_engine.reset();
m_help.reset();
m_pause_icon.reset();
+#ifdef USE_OPENCV
m_cam.reset();
+#endif
m_video.reset();
m_background.reset();
m_song->dropNotes();
@@ -307,9 +313,15 @@ void ScreenSing::draw() {
m_background->draw();
} else fillBG();
// Video
- if (m_video && (!m_cam || !m_cam->is_good())) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ if (m_video
+ #ifdef USE_OPENCV
+ && (!m_cam || !m_cam->is_good())
+ #endif
+ ) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+#ifdef USE_OPENCV
// Webcam
if (m_cam && config["graphic/webcam"].b()) m_cam->render();
+#endif
// Top/bottom borders
ar = clamp(ar, arMin, arMax);
double offset = 0.5 / ar + 0.2;
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index e73eb17..3b56aec 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -15,7 +15,11 @@
#include "opengl_text.hh"
#include "progressbar.hh"
#include "guitargraph.hh"
+
+#ifdef USE_OPENCV
#include "webcam.hh"
+#endif
+
#include "screen_players.hh"
class Players;
@@ -81,7 +85,9 @@ class ScreenSing: public Screen {
boost::scoped_ptr<ProgressBar> m_progress;
boost::scoped_ptr<Surface> m_background;
boost::scoped_ptr<Video> m_video;
+#ifdef USE_OPENCV
boost::scoped_ptr<Webcam> m_cam;
+#endif
boost::scoped_ptr<Surface> m_pause_icon;
boost::scoped_ptr<Surface> m_help;
boost::scoped_ptr<Engine> m_engine;
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:40
|
Module: performous
Branch: instrumentgraph
Commit: 4aaebcb3cd0365fe2308ac96022f4a77e2a52f71
Author: Tapio Vierros <tap...@gm...>
Date: Wed May 12 17:17:16 2010 +0300
Some mingw32 build tweaks.
---
game/CMakeLists.txt | 6 +++++-
libs/libda/CMakeLists.txt | 4 ++--
libs/plugin++/CMakeLists.txt | 5 ++++-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index a68b2af..17a11e7 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -121,7 +121,11 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
# -pedantic cannot be used because ffmpeg headers are b0rked
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++98 -Wall -Wextra -Wno-missing-field-initializers")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers")
+ # -pthread is unrecognized on Windows and ansi standard causes errors
+ if(NOT WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pthread")
+ endif(NOT WIN32)
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
add_definitions("-D__STDC_CONSTANT_MACROS")
endif(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/libs/libda/CMakeLists.txt b/libs/libda/CMakeLists.txt
index e6ea492..04997aa 100644
--- a/libs/libda/CMakeLists.txt
+++ b/libs/libda/CMakeLists.txt
@@ -48,9 +48,9 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -Wall -Wextra")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if(NOT WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pthread")
endif(NOT WIN32)
endif(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/libs/plugin++/CMakeLists.txt b/libs/plugin++/CMakeLists.txt
index 3821706..4dcf031 100644
--- a/libs/plugin++/CMakeLists.txt
+++ b/libs/plugin++/CMakeLists.txt
@@ -25,7 +25,10 @@ set(LIB_SUFFIX "" CACHE STRING "Optional suffix to use on lib folders (e.g. 64 f
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -Wall -Wextra")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
+ if(NOT WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ endif(NOT WIN32)
endif()
add_library(plugin++ STATIC src/dll.cc src/execname.cc src/loader.cc)
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:38
|
Module: performous
Branch: instrumentgraph
Commit: 1c34970719f359b35a3b0acb8cfe9b957cd45a13
Author: Tapio Vierros <tap...@gm...>
Date: Wed May 12 12:44:04 2010 +0300
Dance arrow size is determined by number of arrows.
---
game/dancegraph.cc | 24 ++++++++++++------------
game/dancegraph.hh | 3 ++-
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 52cfe65..d84c13a 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -296,10 +296,10 @@ namespace {
const float one_arrow_tex_w = 1.0 / 8.0; // Width of a single arrow in texture coordinates
/// Create a symmetric vertex pair for arrow drawing
- void vertexPair(int arrow_i, float x, float y, float ty) {
+ void vertexPair(int arrow_i, float x, float y, float ty, float scale = 1.0f) {
if (arrow_i < 0) return;
- glTexCoord2f(arrow_i * one_arrow_tex_w, ty); glVertex2f(x - arrowSize, y);
- glTexCoord2f((arrow_i+1) * one_arrow_tex_w, ty); glVertex2f(x + arrowSize, y);
+ glTexCoord2f(arrow_i * one_arrow_tex_w, ty); glVertex2f(x - arrowSize * scale, y);
+ glTexCoord2f((arrow_i+1) * one_arrow_tex_w, ty); glVertex2f(x + arrowSize * scale, y);
}
glutil::Color& colorGlow(glutil::Color& c, double glow) {
@@ -365,7 +365,7 @@ void DanceGraph::draw(double time) {
float x = panel2x(arrow_i);
float y = time2y(0.0);
float l = m_pressed_anim[arrow_i].get();
- float s = (5.0 - l) / 5.0;
+ float s = getScale() * (5.0 - l) / 5.0;
drawArrow(arrow_i, m_arrows_cursor, x, y, s);
}
@@ -385,7 +385,7 @@ void DanceGraph::drawBeats(double time) {
glutil::Begin block(GL_TRIANGLE_STRIP);
float texCoord = 0.0f;
float tBeg = 0.0f, tEnd;
- float w = 0.5 * m_pads;
+ float w = 0.5 * m_pads * getScale();
for (Song::Beats::const_iterator it = m_song.beats.begin(); it != m_song.beats.end() && tBeg < future; ++it, texCoord += texCoordStep, tBeg = tEnd) {
tEnd = *it - time;
//if (tEnd < past) continue;
@@ -407,7 +407,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
int arrow_i = note.note.note;
bool mine = note.note.type == Note::MINE;
float x = panel2x(arrow_i);
- float s = 1.0;
+ float s = getScale();
float yBeg = time2y(tBeg);
float yEnd = time2y(tEnd);
glutil::Color c(1.0f, 1.0f, 1.0f);
@@ -432,11 +432,11 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
UseTexture tblock(m_arrows_hold);
glutil::Begin block(GL_TRIANGLE_STRIP);
// Draw end
- vertexPair(arrow_i, x, yEnd, 1.0f);
+ vertexPair(arrow_i, x, yEnd, 1.0f, s);
float yMid = std::max(yEnd-arrowSize, yBeg+arrowSize);
- vertexPair(arrow_i, x, yMid, 2.0f/3.0f);
+ vertexPair(arrow_i, x, yMid, 2.0f/3.0f, s);
// Draw middle
- vertexPair(arrow_i, x, yBeg+arrowSize, 1.0f/3.0f);
+ vertexPair(arrow_i, x, yBeg+arrowSize, 1.0f/3.0f, s);
}
// Draw begin
if (note.isHit && tEnd < 0.1) {
@@ -448,7 +448,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
// Draw short note
if (mine) { // Mines need special handling
c.a = 1.0 - glow; glColor4fv(c);
- s = 0.8f + glow * 0.5f;
+ s = getScale() * 0.8f + glow * 0.5f;
float rot = int(time*360 * (note.isHit ? 2.0 : 1.0) ) % 360; // They rotate!
if (note.isHit) yBeg = time2y(0.0);
drawMine(x, yBeg, rot, s);
@@ -469,9 +469,9 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
}
if (!text.empty()) {
glColor3f(1.0f, 1.0f, 1.0f);
- double s = 1.2 * arrowSize * (1.0 + glow);
+ double sc = getScale() * 1.2 * arrowSize * (1.0 + glow);
m_popupText->render(text);
- m_popupText->dimensions().middle(x).center(time2y(0.0)).stretch(s,s/2.0);
+ m_popupText->dimensions().middle(x).center(time2y(0.0)).stretch(sc, sc/2.0);
m_popupText->draw();
}
}
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index 3ba3fbd..4d84772 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -56,7 +56,8 @@ class DanceGraph {
void drawInfo(double time, double offsetX, Dimensions dimensions);
void drawArrow(int arrow_i, Texture& tex, float x, float y, float scale = 1.0, float ty1 = 0.0, float ty2 = 1.0);
void drawMine(float x, float y, float rot = 0.0, float scale = 1.0);
- float panel2x(int i) { return -(m_pads * 0.5f) + m_arrow_map[i] + 0.5f; } /// Get x for an arrow line
+ float panel2x(int i) { return getScale() * (-(m_pads * 0.5f) + m_arrow_map[i] + 0.5f); } /// Get x for an arrow line
+ float getScale() { return 1.0f / m_pads * 8.0f; }
Audio& m_audio;
Song const& m_song;
input::InputDev m_input; /// input device (keyboard/dance pad)
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:36
|
Module: performous
Branch: instrumentgraph
Commit: 86b176060de04577bbfe1d27eaef8c9103c509c3
Author: Felix Bertram <fl...@be...>
Date: Tue May 11 22:17:30 2010 -0700
More MIDI Drum notes
added some more MIDI drum notes to accommodate most real-life mappings
might need some more tweaking and testing with other gear.
---
game/joystick.cc | 85 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 66 insertions(+), 19 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 7792d7b..adcb4a0 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -10,24 +10,67 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
event.type = Event::PRESS;
for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
#if 1
- // this config tested with Alesis DM5 Pro Kit/ RockBand 2 songs from FoFiX
- //--- kick (orange): drum 0
- map[36] = 0; // Bass Drum
- //--- red: drum 1
- map[38] = 1; // Snare
- // 57 // LiveStick
- //--- yellow: drum 2
- map[48] = 2; // Tom high
- map[46] = 2; // Hi-Hat open
- // 44 // Hi-Hat closing
- // 42 // Hi-Hat closed
- //--- blue
- map[45] = 3; // Tom mid
- map[51] = 3; // Ride Cymbal
- //--- green
- map[41] = 4; // Tom low
- map[49] = 4; // Crash Cymbal
+ // these are considered "safe" notes that should work with 95% of all modules
+ // notes below 35 and above 81 are non standardized
+
+ // *) these mappings have been verified with an Alesis DM5 Pro Kit and RockBand 2 songs
+ // the remaining mappings have been guessed...
+
+ static const int DRUM0_ORANGE = 0; // kick drum
+ static const int DRUM1_RED = 1; // snare drum
+ static const int DRUM2_YELLOW = 2; // hi-hat/ hi-mid tom
+ 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[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[41] = DRUM4_GREEN; // 41 - Low Floor Tom *)
+ map[42] = DRUM2_YELLOW; // 42 - Closed Hi-Hat
+ // 43 - High Floor Tom
+ map[44] = DRUM2_YELLOW; // 44 - Pedal Hi-Hat
+ map[45] = DRUM3_BLUE; // 45 - Low Tom *)
+ map[46] = DRUM2_YELLOW; // 46 - Open Hi-Hat *)
+ // 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
+ map[59] = DRUM3_BLUE; // 59 - Ride Cymbal 2
+ // 60 - Hi Bongo
+ // 61 - Low Bongo
+ // 62 - Mute Hi Conga
+ // 63 - Open Hi Conga
+ // 64 - Low Conga
+ // 65 - High Timbale
+ // 66 - Low Timbale
+ // 67 - High Agogo
+ // 68 - Low Agogo
+ // 69 - Cabasa
+ // 70 - Maracas
+ // 71 - Short Whistle
+ // 72 - Long Whistle
+ // 73 - Short Guiro
+ // 74 - Long Guiro
+ // 75 - Claves
+ // 76 - Hi Wood Block
+ // 77 - Low Wood Block
+ // 78 - Mute Cuica
+ // 79 - Open Cuica
+ // 80 - Mute Triangle
+ // 81 - Open Triangle
#else
+ // this is the original mapping from Performous 0.5.1
map[35] = map[36] = 0; // Bass drum 1/2
map[38] = map[40] = 1; // Snare 1/2
map[42] = map[46] = 2; // Hi-hat closed/open
@@ -45,11 +88,15 @@ void input::MidiDrums::process() {
PmEvent ev;
while (Pm_Read(stream, &ev, 1) == 1) {
unsigned char evnt = ev.message & 0xF0;
- unsigned char chan = ev.message & 0x0F;
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.
+ // code snippet left here for visibility
+ unsigned char chan = ev.message & 0x0F;
+ if (chan != 0x09) continue; // only accept channel 10 (percussion)
+#endif
if (evnt != 0x90) continue; // 0x90 = any channel note-on
- //if (chan != 0x09) continue; // only accept channel 10 (percussion)
if (vel == 0x00) continue; // velocity 0 is often used instead of note-off
Map::const_iterator it = map.find(note);
if (it == map.end()) {
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:34
|
Module: performous
Branch: instrumentgraph
Commit: 42828c6feb68201d5222edf79038e9314b8caec8
Author: Felix Bertram <fl...@be...>
Date: Tue May 11 22:16:22 2010 -0700
image type detection
The image type detection from the file extension was broken,
the extension was not properly converted to lower case.
---
game/surface.cc | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index fa4a2b5..e8c1edc 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -24,12 +24,15 @@ float Dimensions::screenY() const {
throw std::logic_error("Dimensions::screenY(): unknown m_screenAnchor value");
}
+
template <typename T> void loader(T& target, fs::path name) {
std::string const filename = name.string();
if (!fs::exists(name)) throw std::runtime_error("File not found: " + filename);
// Get file extension in lower case
std::string ext = name.extension();
- std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
+ // somehow this does not convert the extension to lower case:
+ //std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
+ std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower );
if (ext == ".svg") loadSVG(target, filename);
else if (ext == ".png") {
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:31
|
Module: performous Branch: instrumentgraph Commit: 81486be5fedcde4efe88b973e4d4cfcedc125e00 Author: Ville Immonen <imm...@gm...> Date: Tue May 11 23:48:09 2010 +0300 Missing include added to webcam.hh. --- game/webcam.hh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/game/webcam.hh b/game/webcam.hh index 3fb1cea..8c39c62 100644 --- a/game/webcam.hh +++ b/game/webcam.hh @@ -10,6 +10,7 @@ typedef void CvCapture; #include <boost/scoped_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> +#include <vector> #include "surface.hh" |
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:29
|
Module: performous Branch: instrumentgraph Commit: 1867afe0c66c1a3a9fc4ac250291c8d556af69ea Author: Tapio Vierros <tap...@gm...> Date: Tue May 11 22:46:50 2010 +0300 Merge branch 'opencv' --- |
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:27
|
Module: performous
Branch: instrumentgraph
Commit: c0e27ca4d9869a7e01549231420f8d7b001e641d
Author: Tapio Vierros <tap...@gm...>
Date: Tue May 11 14:02:11 2010 +0300
Add some OpenGL error checking to video_driver and surface.
---
game/glutil.hh | 25 +++++++++++++++++++++++--
game/main.cc | 11 +++--------
game/surface.cc | 4 ++++
game/video_driver.cc | 3 ++-
4 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index ad7f309..fe5441d 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -1,5 +1,8 @@
#pragma once
+#include <string>
+#include <iostream>
+
#include <GL/glew.h>
namespace glutil {
@@ -38,10 +41,10 @@ namespace glutil {
if (doit) {
glClear(GL_DEPTH_BUFFER_BIT);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
-
+
GLfloat light_position[] = { -50.0, 15.0, -5.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
-
+
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
@@ -69,5 +72,23 @@ namespace glutil {
/// overload float const cast
operator float const*() const { return reinterpret_cast<float const*>(this); }
};
+
+ /// Checks for OpenGL error and displays it with given location info
+ struct GLErrorChecker {
+ GLErrorChecker(std::string info = "") {
+ GLenum err;
+ if ((err = glGetError()) != GL_NO_ERROR) {
+ if (!info.empty()) info = " (" + info +")";
+ switch(err) {
+ case GL_INVALID_ENUM: std::cerr << "OpenGL error: invalid enum" << info << std::endl; break;
+ case GL_INVALID_VALUE: std::cerr << "OpenGL error: invalid value" << info << std::endl; break;
+ case GL_INVALID_OPERATION: std::cerr << "OpenGL error: invalid operation" << info << std::endl; break;
+ case GL_STACK_OVERFLOW: std::cerr << "OpenGL error: stack overflow" << info << std::endl; break;
+ case GL_STACK_UNDERFLOW: std::cerr << "OpenGL error: stack underflow" << info << std::endl; break;
+ case GL_OUT_OF_MEMORY: std::cerr << "OpenGL error: out of memory" << info << std::endl; break;
+ }
+ }
+ }
+ };
}
diff --git a/game/main.cc b/game/main.cc
index fea8426..a0f4a91 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -9,6 +9,7 @@
#include "xtime.hh"
#include "video_driver.hh"
#include "i18n.hh"
+#include "glutil.hh"
// Screens
#include "screen_intro.hh"
@@ -99,14 +100,8 @@ static void checkEvents_SDL(ScreenManager& sm) {
// This is needed to allow navigation (quiting the song) to function even then
input::SDL::pushEvent(event);
sm.getCurrentScreen()->manageEvent(event);
- switch(glGetError()) {
- case GL_INVALID_ENUM: std::cerr << "OpenGL error: invalid enum" << std::endl; break;
- case GL_INVALID_VALUE: std::cerr << "OpenGL error: invalid value" << std::endl; break;
- case GL_INVALID_OPERATION: std::cerr << "OpenGL error: invalid operation" << std::endl; break;
- case GL_STACK_OVERFLOW: std::cerr << "OpenGL error: stack overflow" << std::endl; break;
- case GL_STACK_UNDERFLOW: std::cerr << "OpenGL error: stack underflow" << std::endl; break;
- case GL_OUT_OF_MEMORY: std::cerr << "OpenGL error: out of memory" << std::endl; break;
- }
+ // Check for OpenGL errors
+ glutil::GLErrorChecker glerror;
}
if( config["graphic/fullscreen"].b() != sm.window().getFullscreen() )
sm.window().setFullscreen(config["graphic/fullscreen"].b());
diff --git a/game/surface.cc b/game/surface.cc
index be71e13..1de1480 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -101,6 +101,8 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format,
// Just don't do it in Surface class, thanks. -Tronic
glTexImage2D(type(), 0, GL_RGBA, newWidth, newHeight, 0, f.format, f.type, &outBuf[0]);
}
+ // Check for OpenGL errors
+ glutil::GLErrorChecker glerror("Texture::load");
}
void Surface::load(unsigned int width, unsigned int height, pix::Format format, unsigned char const* buffer, float ar) {
@@ -113,6 +115,8 @@ void Surface::load(unsigned int width, unsigned int height, pix::Format format,
PixFmt const& f = getPixFmt(format);
glPixelStorei(GL_UNPACK_SWAP_BYTES, f.swap);
glTexImage2D(m_texture.type(), 0, GL_RGBA, width, height, 0, f.format, f.type, buffer);
+ // Check for OpenGL errors
+ glutil::GLErrorChecker glerror("Surface::load");
}
void Surface::draw() const {
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 56c774a..508db0e 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -138,6 +138,7 @@ void Window::resize() {
const float f = 0.9f; // Avoid texture surface being exactly at the near plane (MacOSX fix)
glFrustum(-0.5f * f, 0.5f * f, 0.5f * h * f, -0.5f * h * f, f * near_, far_);
glTranslatef(0.0f, 0.0f, -near_); // So that z = 0.0f is still on monitor surface
-
+ // Check for OpenGL errors
+ glutil::GLErrorChecker glerror("Window::resize");
}
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:24
|
Module: performous
Branch: instrumentgraph
Commit: 5dccd03d02471c3304c79d9f667db069244515e2
Author: Tapio Vierros <tap...@gm...>
Date: Tue May 11 13:30:06 2010 +0300
Add some SDL_GL_SetAttribute error indication.
---
game/video_driver.cc | 46 ++++++++++++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 16280aa..56c774a 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -13,6 +13,22 @@
namespace {
unsigned s_width;
unsigned s_height;
+ /// Attempt to set attribute and report errors.
+ /// Tests for success when destoryed.
+ struct GLattrSetter {
+ GLattrSetter(SDL_GLattr attr, int value): m_attr(attr), m_value(value) {
+ if (SDL_GL_SetAttribute(attr, value)) std::cerr << "Error setting GLattr " << m_attr << std::endl;
+ }
+ ~GLattrSetter() {
+ int value;
+ SDL_GL_GetAttribute(m_attr, &value);
+ if (value != m_value)
+ std::cerr << "Error setting GLattr " << m_attr
+ << ": requested " << m_value << ", got " << value << std::endl;
+ }
+ SDL_GLattr m_attr;
+ int m_value;
+ };
}
unsigned int screenW() { return s_width; }
@@ -75,20 +91,22 @@ void Window::screenshot() {
void Window::resize() {
unsigned width = m_fullscreen ? m_fsW : m_windowW;
unsigned height = m_fullscreen ? m_fsH : m_windowH;
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 0);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 0);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 0);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);
- screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | SDL_RESIZABLE | (m_fullscreen ? SDL_FULLSCREEN : 0));
- if (!screen) throw std::runtime_error(std::string("SDL_SetVideoMode failed: ") + SDL_GetError());
+ { // Setup GL attributes for context creation
+ GLattrSetter attr_r(SDL_GL_RED_SIZE, 8);
+ GLattrSetter attr_g(SDL_GL_GREEN_SIZE, 8);
+ GLattrSetter attr_b(SDL_GL_BLUE_SIZE, 8);
+ GLattrSetter attr_a(SDL_GL_ALPHA_SIZE, 8);
+ GLattrSetter attr_buf(SDL_GL_BUFFER_SIZE, 32);
+ GLattrSetter attr_d(SDL_GL_DEPTH_SIZE, 16);
+ GLattrSetter attr_s(SDL_GL_STENCIL_SIZE, 8);
+ GLattrSetter attr_db(SDL_GL_DOUBLEBUFFER, 1);
+ GLattrSetter attr_ar(SDL_GL_ACCUM_RED_SIZE, 0);
+ GLattrSetter attr_ag(SDL_GL_ACCUM_GREEN_SIZE, 0);
+ GLattrSetter attr_ab(SDL_GL_ACCUM_BLUE_SIZE, 0);
+ GLattrSetter attr_aa(SDL_GL_ACCUM_ALPHA_SIZE, 0);
+ screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | SDL_RESIZABLE | (m_fullscreen ? SDL_FULLSCREEN : 0));
+ if (!screen) throw std::runtime_error(std::string("SDL_SetVideoMode failed: ") + SDL_GetError());
+ }
s_width = screen->w;
s_height = screen->h;
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:22
|
Module: performous
Branch: instrumentgraph
Commit: c4a4ccf83e08b2a3ff73b2fce3c23dd512cda22e
Author: Tapio Vierros <tap...@gm...>
Date: Tue May 11 12:45:35 2010 +0300
Output compilation status of optional features with version info.
---
game/main.cc | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index fea8426..2e7066f 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -284,6 +284,8 @@ template <typename Container> void confOverride(Container const& c, std::string
std::copy(c.begin(), c.end(), std::back_inserter(sl));
}
+void outputOptionalFeatureStatus();
+
int main(int argc, char** argv) try {
#ifdef USE_GETTEXT
// initialize gettext
@@ -299,6 +301,7 @@ int main(int argc, char** argv) try {
std::cout << PACKAGE " " VERSION << std::endl;
signalSetup();
+ outputOptionalFeatureStatus();
std::ios::sync_with_stdio(false); // We do not use C stdio
std::srand(std::time(NULL));
// Parse commandline options
@@ -410,3 +413,24 @@ int main(int argc, char** argv) try {
std::cerr << "FATAL ERROR: " << e.what() << std::endl;
}
+void outputOptionalFeatureStatus() {
+ std::cout << " Internationalization: " <<
+ #ifdef USE_GETTEXT
+ "Enabled"
+ #else
+ "Disabled"
+ #endif
+ << std::endl << " MIDI I/O: " <<
+ #ifdef USE_PORTMIDI
+ "Enabled"
+ #else
+ "Disabled"
+ #endif
+ << std::endl << " Webcam support: " <<
+ #ifdef USE_OPENCV
+ "Enabled"
+ #else
+ "Disabled"
+ #endif
+ << std::endl;
+}
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:20
|
Module: performous Branch: instrumentgraph Commit: 60e11471abb9b0732299134590de9315a69e7312 Author: Tapio Vierros <tap...@gm...> Date: Mon May 10 19:40:43 2010 +0300 Fix a texture wrapping bug in instrument icons. --- themes/default/instruments.svg | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:15
|
Module: performous
Branch: instrumentgraph
Commit: 7c43188229e352f1d57f5c31a4e89c7a2c2ca5b9
Author: Tapio Vierros <tap...@gm...>
Date: Mon May 10 15:03:27 2010 +0300
Webcam tweaks.
* Fix colors.
* Higher framerate limit.
* Allow regular video to display if webcam is disabled during gameplay.
---
game/screen_sing.cc | 2 +-
game/surface.cc | 2 +-
game/webcam.cc | 13 ++++++++++---
game/webcam.hh | 2 +-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 20d5549..dcde072 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -307,7 +307,7 @@ void ScreenSing::draw() {
m_background->draw();
} else fillBG();
// Video
- if (m_video && !m_cam && !m_cam->is_good()) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ if (m_video && (!m_cam || !m_cam->is_good())) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
// Webcam
if (m_cam && config["graphic/webcam"].b()) m_cam->render();
// Top/bottom borders
diff --git a/game/surface.cc b/game/surface.cc
index be71e13..72b89bd 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -59,7 +59,7 @@ namespace {
PixFormats() {
using namespace pix;
m[RGB] = PixFmt(GL_RGB, GL_UNSIGNED_BYTE, false);
- m[BGR] = PixFmt(GL_RGB, GL_UNSIGNED_BYTE, true);
+ m[BGR] = PixFmt(GL_BGR, GL_UNSIGNED_BYTE, true);
m[CHAR_RGBA] = PixFmt(GL_RGBA, GL_UNSIGNED_BYTE, false);
m[INT_ARGB] = PixFmt(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, true);
}
diff --git a/game/webcam.cc b/game/webcam.cc
index 8409225..31bc263 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -7,6 +7,7 @@ Webcam::Webcam(int cam_id):
m_thread(), m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
{
#ifdef USE_OPENCV
+ // Initialize the capture device
m_capture = cvCaptureFromCAM(cam_id);
if (!m_capture) {
std::cout << "Could not initialize webcam capturing!" << std::endl;
@@ -31,15 +32,19 @@ void Webcam::operator()() {
m_running = true;
while (!m_quit) {
IplImage* frame = 0;
+ // Try to get a new frame
if (m_running) frame = cvQueryFrame(m_capture);
if (frame) {
boost::mutex::scoped_lock l(m_mutex);
+ // Copy the frame to storage
m_frame.width = frame->width;
m_frame.height = frame->height;
m_frame.data.assign(frame->imageData, frame->imageData + (m_frame.width * m_frame.height * 3));
+ // Notify renderer
m_frameAvailable = true;
}
- boost::thread::sleep(now() + (m_running ? 0.05 : 0.5));
+ // Sleep a little, much if the cam isn't active
+ boost::thread::sleep(now() + (m_running ? 0.015 : 0.5));
}
#endif
}
@@ -53,11 +58,13 @@ void Webcam::pause(bool do_pause) {
void Webcam::render() {
#ifdef USE_OPENCV
if (!m_capture || !m_running) return;
+ // Do we have a new frame available?
if (m_frameAvailable && !m_frame.data.empty()) {
boost::mutex::scoped_lock l(m_mutex);
- m_surface.load(m_frame.width, m_frame.height, pix::RGB, &m_frame.data[0]);
+ // Load the image
+ m_surface.load(m_frame.width, m_frame.height, pix::BGR, &m_frame.data[0]);
m_frameAvailable = false;
}
- m_surface.draw();
+ m_surface.draw(); // Draw
#endif
}
diff --git a/game/webcam.hh b/game/webcam.hh
index a5c17b5..3fb1cea 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -30,7 +30,7 @@ class Webcam {
void operator()();
/// Is good?
- bool is_good() { return m_capture != 0; }
+ bool is_good() { return m_capture != 0 && m_running; }
/// When paused, does not get or render frames
void pause(bool do_pause = true);
/// Display frame
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:13
|
Module: performous
Branch: instrumentgraph
Commit: 20d97b7c8222752ea8128258c2efad19d54d0779
Author: Tapio Vierros <tap...@gm...>
Date: Sun May 9 23:33:06 2010 +0300
Fix crash when trying to join NULL thread in ~Webcam.
---
game/webcam.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
index e9877df..8409225 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -4,7 +4,7 @@
#include "xtime.hh"
Webcam::Webcam(int cam_id):
- m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
+ m_thread(), m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
{
#ifdef USE_OPENCV
m_capture = cvCaptureFromCAM(cam_id);
@@ -21,7 +21,7 @@ Webcam::Webcam(int cam_id):
Webcam::~Webcam() {
m_quit = true;
#ifdef USE_OPENCV
- m_thread->join();
+ if (m_thread) m_thread->join();
cvReleaseCapture(&m_capture);
#endif
}
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:11
|
Module: performous
Branch: instrumentgraph
Commit: ca00c323c43e578cd5553f5ca0bc1545494a6907
Author: Tapio Vierros <tap...@gm...>
Date: Sun May 9 23:24:47 2010 +0300
Threaded webcam - much better framerate.
---
game/screen_sing.cc | 7 +++--
game/webcam.cc | 52 +++++++++++++++++++++++++++++++++++++++-----------
game/webcam.hh | 28 +++++++++++++++++++++++---
3 files changed, 68 insertions(+), 19 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index fec2a0c..20d5549 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -248,7 +248,8 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_k) dispInFlash(++config["game/karaoke_mode"]); // Toggle karaoke mode
if (key == SDLK_w) dispInFlash(++config["game/pitch"]); // Toggle pitch wave
#ifdef USE_OPENCV
- if (key == SDLK_a) dispInFlash(++config["graphic/webcam"]); // Toggle webcam
+ // Toggle webcam
+ if (key == SDLK_a) { dispInFlash(++config["graphic/webcam"]); m_cam->pause(!config["graphic/webcam"].b()); }
#endif
// Latency settings
if (key == SDLK_F1) dispInFlash(--config["audio/video_delay"]);
@@ -306,9 +307,9 @@ void ScreenSing::draw() {
m_background->draw();
} else fillBG();
// Video
- if (m_video && !m_cam && !(*m_cam)()) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ if (m_video && !m_cam && !m_cam->is_good()) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
// Webcam
- if (m_cam && config["graphic/webcam"].b()) m_cam->render(time);
+ if (m_cam && config["graphic/webcam"].b()) m_cam->render();
// Top/bottom borders
ar = clamp(ar, arMin, arMax);
double offset = 0.5 / ar + 0.2;
diff --git a/game/webcam.cc b/game/webcam.cc
index aa35dd0..e9877df 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -1,35 +1,63 @@
#include <iostream>
#include "webcam.hh"
+#include "xtime.hh"
-Webcam::Webcam(int cam_id): m_capture(NULL), m_timestamp(0) {
+Webcam::Webcam(int cam_id):
+ m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
+ {
#ifdef USE_OPENCV
m_capture = cvCaptureFromCAM(cam_id);
- if (!m_capture)
+ if (!m_capture) {
std::cout << "Could not initialize webcam capturing!" << std::endl;
+ return;
+ }
+ m_thread.reset(new boost::thread(boost::ref(*this)));
#else
++cam_id; // dummy
#endif
}
Webcam::~Webcam() {
+ m_quit = true;
#ifdef USE_OPENCV
+ m_thread->join();
cvReleaseCapture(&m_capture);
#endif
}
-void Webcam::render(double time) {
+void Webcam::operator()() {
#ifdef USE_OPENCV
- if (!m_capture) return;
- IplImage* frame = 0;
- if (time > m_timestamp + 0.5) {
- frame = cvQueryFrame(m_capture);
- if (!frame) return;
- m_surface.load(frame->width, frame->height, pix::RGB, (const unsigned char*)frame->imageData);
- m_timestamp = time;
+ m_running = true;
+ while (!m_quit) {
+ IplImage* frame = 0;
+ if (m_running) frame = cvQueryFrame(m_capture);
+ if (frame) {
+ boost::mutex::scoped_lock l(m_mutex);
+ m_frame.width = frame->width;
+ m_frame.height = frame->height;
+ m_frame.data.assign(frame->imageData, frame->imageData + (m_frame.width * m_frame.height * 3));
+ m_frameAvailable = true;
+ }
+ boost::thread::sleep(now() + (m_running ? 0.05 : 0.5));
+ }
+ #endif
+}
+
+void Webcam::pause(bool do_pause) {
+ boost::mutex::scoped_lock l(m_mutex);
+ m_running = !do_pause;
+ m_frameAvailable = false;
+}
+
+void Webcam::render() {
+ #ifdef USE_OPENCV
+ if (!m_capture || !m_running) return;
+ if (m_frameAvailable && !m_frame.data.empty()) {
+ boost::mutex::scoped_lock l(m_mutex);
+ m_surface.load(m_frame.width, m_frame.height, pix::RGB, &m_frame.data[0]);
+ m_frameAvailable = false;
}
m_surface.draw();
- #else
- ++time; // dummy
#endif
}
diff --git a/game/webcam.hh b/game/webcam.hh
index b64bece..a5c17b5 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -7,8 +7,18 @@
typedef void CvCapture;
#endif
+#include <boost/scoped_ptr.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
+
#include "surface.hh"
+struct CamFrame {
+ int width;
+ int height;
+ std::vector<uint8_t> data;
+};
+
class Webcam {
public:
/// cam_id -1 means pick any device
@@ -16,16 +26,26 @@ class Webcam {
~Webcam();
- /// Is good?
- bool operator()() { return m_capture != 0; }
+ /// Thread runs here, don't call directly
+ void operator()();
- void render(double time);
+ /// Is good?
+ bool is_good() { return m_capture != 0; }
+ /// When paused, does not get or render frames
+ void pause(bool do_pause = true);
+ /// Display frame
+ void render();
Dimensions& dimensions() { return m_surface.dimensions; }
Dimensions const& dimensions() const { return m_surface.dimensions; }
private:
+ boost::scoped_ptr<boost::thread> m_thread;
+ mutable boost::mutex m_mutex;
CvCapture* m_capture;
+ CamFrame m_frame;
Surface m_surface;
- double m_timestamp;
+ bool m_frameAvailable;
+ volatile bool m_running;
+ volatile bool m_quit;
};
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:09
|
Module: performous
Branch: instrumentgraph
Commit: 3d4d8058f480f6813bcafbdb28ec115fa52425ba
Author: Tapio Vierros <tap...@gm...>
Date: Sun May 9 21:48:42 2010 +0300
Make OpenCV (and thus webcam support) optional (in style of MIDI drum support).
---
game/CMakeLists.txt | 16 ++++++++++++----
game/screen_sing.cc | 2 ++
game/webcam.cc | 17 ++++++++++++++---
game/webcam.hh | 7 ++++++-
4 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index ee87468..06c2b2a 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -79,16 +79,13 @@ else()
endif()
# Find all the libs that don't require extra parameters
-foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png OpenCV)
+foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png)
find_package(${lib} REQUIRED)
include_directories(${${lib}_INCLUDE_DIRS})
list(APPEND LIBS ${${lib}_LIBRARIES})
add_definitions(${${lib}_DEFINITIONS})
endforeach(lib)
- include_directories(${OpenCV_INCLUDE_DIR})
- list(APPEND LIBS ${OpenCV_cv_LIBRARY} ${OpenCV_cvcore_LIBRARY} ${OpenCV_highgui_LIBRARY})
-
find_package(Gettext)
if(Gettext_FOUND)
include_directories(${Gettext_INCLUDE_DIRS})
@@ -109,6 +106,17 @@ else()
message(STATUS "MIDI I/O: Disabled (libportmidi not found)")
endif()
+find_package(OpenCV)
+if(OpenCV_FOUND)
+ include_directories(${OpenCV_INCLUDE_DIRS})
+ list(APPEND LIBS ${OpenCV_LIBRARIES})
+ add_definitions("-DUSE_OPENCV")
+ message(STATUS "Webcam support: Enabled")
+else()
+ message(STATUS "Webcam support: Disabled (libcv not found)")
+endif()
+
+
# Set default compile flags for GCC
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index d7e18e2..fec2a0c 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -247,7 +247,9 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_v) m_audio.streamFade("vocals", event.key.keysym.mod & KMOD_SHIFT ? 1.0 : 0.0);
if (key == SDLK_k) dispInFlash(++config["game/karaoke_mode"]); // Toggle karaoke mode
if (key == SDLK_w) dispInFlash(++config["game/pitch"]); // Toggle pitch wave
+ #ifdef USE_OPENCV
if (key == SDLK_a) dispInFlash(++config["graphic/webcam"]); // Toggle webcam
+ #endif
// Latency settings
if (key == SDLK_F1) dispInFlash(--config["audio/video_delay"]);
if (key == SDLK_F2) dispInFlash(++config["audio/video_delay"]);
diff --git a/game/webcam.cc b/game/webcam.cc
index 5595309..aa35dd0 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -3,15 +3,23 @@
#include "webcam.hh"
Webcam::Webcam(int cam_id): m_capture(NULL), m_timestamp(0) {
+ #ifdef USE_OPENCV
m_capture = cvCaptureFromCAM(cam_id);
- if (!m_capture) {
+ if (!m_capture)
std::cout << "Could not initialize webcam capturing!" << std::endl;
- return;
- }
+ #else
+ ++cam_id; // dummy
+ #endif
}
+Webcam::~Webcam() {
+ #ifdef USE_OPENCV
+ cvReleaseCapture(&m_capture);
+ #endif
+}
void Webcam::render(double time) {
+ #ifdef USE_OPENCV
if (!m_capture) return;
IplImage* frame = 0;
if (time > m_timestamp + 0.5) {
@@ -21,4 +29,7 @@ void Webcam::render(double time) {
m_timestamp = time;
}
m_surface.draw();
+ #else
+ ++time; // dummy
+ #endif
}
diff --git a/game/webcam.hh b/game/webcam.hh
index e1b7ce4..b64bece 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -1,6 +1,11 @@
+#pragma once
+#ifdef USE_OPENCV
#include <cv.h>
#include <highgui.h>
+#else
+typedef void CvCapture;
+#endif
#include "surface.hh"
@@ -9,7 +14,7 @@ class Webcam {
/// cam_id -1 means pick any device
Webcam(int cam_id = -1);
- ~Webcam() { cvReleaseCapture(&m_capture); }
+ ~Webcam();
/// Is good?
bool operator()() { return m_capture != 0; }
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:06
|
Module: performous
Branch: instrumentgraph
Commit: 9866cca05a8ec52bc1e85c0850122700e923cf1b
Author: Tapio Vierros <tap...@gm...>
Date: Sun May 9 21:24:56 2010 +0300
Webcam can be disabled from config or toggled during gameplay.
---
data/schema.xml | 6 ++++++
game/screen_sing.cc | 14 ++++++++++----
game/screen_sing.hh | 4 ++--
game/webcam.cc | 2 +-
game/webcam.hh | 1 +
5 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 42a49f3..1eea68e 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -118,6 +118,12 @@ to save the current settings to XML.
<long>Allows completely disabling background videos. It is recommended to leave this enabled as Performous will still smoothly fade out the video if your computer is not fast enough.</long>
</locale>
</entry>
+ <entry name="graphic/webcam" type="bool" value="true">
+ <locale name="C">
+ <short>Webcam background</short>
+ <long>Performous can try to use webcam as a background video. You can disable it if it annoys you.</long>
+ </locale>
+ </entry>
<entry name="graphic/3d_notes" type="bool" value="true">
<locale name="C">
<short>3D notes</short>
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 8b0f914..d7e18e2 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -56,6 +56,9 @@ void ScreenSing::enter() {
std::cerr << e.what() << std::endl;
}
}
+ if (config["graphic/webcam"].b()) { // Initialize webcam
+ m_cam.reset(new Webcam());
+ }
if (!m_song->video.empty() && config["graphic/video"].b()) { // Load video
m_video.reset(new Video(m_song->path + m_song->video, m_song->videoGap));
}
@@ -175,6 +178,7 @@ void ScreenSing::exit() {
m_engine.reset();
m_help.reset();
m_pause_icon.reset();
+ m_cam.reset();
m_video.reset();
m_background.reset();
m_song->dropNotes();
@@ -243,6 +247,7 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_v) m_audio.streamFade("vocals", event.key.keysym.mod & KMOD_SHIFT ? 1.0 : 0.0);
if (key == SDLK_k) dispInFlash(++config["game/karaoke_mode"]); // Toggle karaoke mode
if (key == SDLK_w) dispInFlash(++config["game/pitch"]); // Toggle pitch wave
+ if (key == SDLK_a) dispInFlash(++config["graphic/webcam"]); // Toggle webcam
// Latency settings
if (key == SDLK_F1) dispInFlash(--config["audio/video_delay"]);
if (key == SDLK_F2) dispInFlash(++config["audio/video_delay"]);
@@ -298,7 +303,11 @@ void ScreenSing::draw() {
if (ar > arMax || (m_video && ar > arMin)) fillBG(); // Fill white background to avoid black borders
m_background->draw();
} else fillBG();
- if (m_video) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ // Video
+ if (m_video && !m_cam && !(*m_cam)()) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ // Webcam
+ if (m_cam && config["graphic/webcam"].b()) m_cam->render(time);
+ // Top/bottom borders
ar = clamp(ar, arMin, arMax);
double offset = 0.5 / ar + 0.2;
theme->bg_bottom.dimensions.fixedWidth(1.0).bottom(offset);
@@ -307,9 +316,6 @@ void ScreenSing::draw() {
theme->bg_top.draw();
}
- // Webcam image
- m_cam.render(time);
-
if( !m_dancers.empty() ) {
danceLayout(time);
//m_layout_singer->draw(time, LayoutSinger::LEFT);
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index b7e4f68..e73eb17 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -50,7 +50,7 @@ class ScreenSing: public Screen {
public:
/// constructor
ScreenSing(std::string const& name, Audio& audio, Capture& capture, Database& database, Backgrounds& bgs):
- Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true), m_cam()
+ Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true)
{}
void enter();
void exit();
@@ -81,6 +81,7 @@ class ScreenSing: public Screen {
boost::scoped_ptr<ProgressBar> m_progress;
boost::scoped_ptr<Surface> m_background;
boost::scoped_ptr<Video> m_video;
+ boost::scoped_ptr<Webcam> m_cam;
boost::scoped_ptr<Surface> m_pause_icon;
boost::scoped_ptr<Surface> m_help;
boost::scoped_ptr<Engine> m_engine;
@@ -91,6 +92,5 @@ class ScreenSing: public Screen {
boost::shared_ptr<ThemeSing> theme;
AnimValue m_quitTimer;
bool m_only_singers_alive;
- Webcam m_cam;
};
diff --git a/game/webcam.cc b/game/webcam.cc
index 51cbb00..5595309 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -14,7 +14,7 @@ Webcam::Webcam(int cam_id): m_capture(NULL), m_timestamp(0) {
void Webcam::render(double time) {
if (!m_capture) return;
IplImage* frame = 0;
- if (time > m_timestamp + 0.333) {
+ if (time > m_timestamp + 0.5) {
frame = cvQueryFrame(m_capture);
if (!frame) return;
m_surface.load(frame->width, frame->height, pix::RGB, (const unsigned char*)frame->imageData);
diff --git a/game/webcam.hh b/game/webcam.hh
index 33caad1..e1b7ce4 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -6,6 +6,7 @@
class Webcam {
public:
+ /// cam_id -1 means pick any device
Webcam(int cam_id = -1);
~Webcam() { cvReleaseCapture(&m_capture); }
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:02
|
Module: performous
Branch: instrumentgraph
Commit: e1a820aafc163ffebd132e6b0e0d2aee48ea6870
Author: Tapio Vierros <tap...@gm...>
Date: Sun May 9 20:53:37 2010 +0300
Refactor webcam class.
---
game/webcam.cc | 24 ++++++++++++++++++++++++
game/webcam.hh | 24 +++++-------------------
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
new file mode 100644
index 0000000..51cbb00
--- /dev/null
+++ b/game/webcam.cc
@@ -0,0 +1,24 @@
+#include <iostream>
+
+#include "webcam.hh"
+
+Webcam::Webcam(int cam_id): m_capture(NULL), m_timestamp(0) {
+ m_capture = cvCaptureFromCAM(cam_id);
+ if (!m_capture) {
+ std::cout << "Could not initialize webcam capturing!" << std::endl;
+ return;
+ }
+}
+
+
+void Webcam::render(double time) {
+ if (!m_capture) return;
+ IplImage* frame = 0;
+ if (time > m_timestamp + 0.333) {
+ frame = cvQueryFrame(m_capture);
+ if (!frame) return;
+ m_surface.load(frame->width, frame->height, pix::RGB, (const unsigned char*)frame->imageData);
+ m_timestamp = time;
+ }
+ m_surface.draw();
+}
diff --git a/game/webcam.hh b/game/webcam.hh
index d90e31a..33caad1 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -2,32 +2,18 @@
#include <cv.h>
#include <highgui.h>
-#include "glutil.hh"
#include "surface.hh"
class Webcam {
public:
- Webcam(int cam_id = -1): m_capture(NULL), m_timestamp(0) {
- m_capture = cvCaptureFromCAM(cam_id);
- if (!m_capture) {
- std::cout << "Could not initialize capturing!" << std::endl;
- return;
- }
- }
+ Webcam(int cam_id = -1);
~Webcam() { cvReleaseCapture(&m_capture); }
- void render(double time) {
- if (!m_capture) return;
- IplImage* frame = 0;
- if (time > m_timestamp + 0.5) {
- frame = cvQueryFrame(m_capture);
- if (!frame) return;
- m_surface.load(frame->width, frame->height, pix::RGB, (const unsigned char*)frame->imageData);
- m_timestamp = time;
- }
- m_surface.draw();
- }
+ /// Is good?
+ bool operator()() { return m_capture != 0; }
+
+ void render(double time);
Dimensions& dimensions() { return m_surface.dimensions; }
Dimensions const& dimensions() const { return m_surface.dimensions; }
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:59
|
Module: performous Branch: instrumentgraph Commit: 2d8f567cf8546e28b14b287b79bc14e5d863fd97 Author: Tapio Vierros <tap...@gm...> Date: Sun May 9 20:24:40 2010 +0300 Better FindOpenCV.cmake --- cmake/Modules/FindOpenCV.cmake | 255 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 237 insertions(+), 18 deletions(-) diff --git a/cmake/Modules/FindOpenCV.cmake b/cmake/Modules/FindOpenCV.cmake index 5f71597..70db510 100644 --- a/cmake/Modules/FindOpenCV.cmake +++ b/cmake/Modules/FindOpenCV.cmake @@ -1,28 +1,247 @@ -# - Try to find OpenCV -# Once done, this will define +# - Try to find OpenCV library installation +# See http://sourceforge.net/projects/opencvlibrary/ # -# OpenCV_FOUND - system has OpenCV -# OpenCV_INCLUDE_DIRS - the OpenCV include directories -# OpenCV_LIBRARIES - link these to use OpenCV +# The follwoing variables are optionally searched for defaults +# OpenCV_ROOT_DIR: Base directory of OpenCv tree to use. +# OpenCV_FIND_REQUIRED_COMPONENTS : FIND_PACKAGE(OpenCV COMPONENTS ..) +# compatible interface. typically CV CXCORE CVAUX HIGHGUI CVCAM .. etc. # -# See documentation on how to write CMake scripts at -# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries +# The following are set after configuration is done: +# OpenCV_FOUND +# OpenCV_INCLUDE_DIR +# OpenCV_LIBRARIES +# OpenCV_LINK_DIRECTORIES +# +# deprecated: +# OPENCV_* uppercase replaced by case sensitive OpenCV_* +# OPENCV_EXE_LINKER_FLAGS +# OPENCV_INCLUDE_DIR : replaced by plural *_DIRS +# +# 2004/05 Jan Woetzel, Friso, Daniel Grest +# 2006/01 complete rewrite by Jan Woetzel +# 1006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES +# to handle multiple installed versions gracefully by Jan Woetzel +# +# tested with: +# -OpenCV 0.97 (beta5a): MSVS 7.1, gcc 3.3, gcc 4.1 +# -OpenCV 0.99 (1.0rc1): MSVS 7.1 +# +# www.mip.informatik.uni-kiel.de/~jw +# -------------------------------- + + +MACRO(DBG_MSG _MSG) +# MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}):\n${_MSG}") +ENDMACRO(DBG_MSG) + + + +# required cv components with header and library if COMPONENTS unspecified +IF (NOT OpenCV_FIND_COMPONENTS) +# default +SET(OpenCV_FIND_REQUIRED_COMPONENTS CV CXCORE CVAUX HIGHGUI ) +IF (WIN32) +LIST(APPEND OpenCV_FIND_REQUIRED_COMPONENTS CVCAM ) # WIN32 only actually +ENDIF(WIN32) +ENDIF (NOT OpenCV_FIND_COMPONENTS) + -include(LibFindMacros) +# typical root dirs of installations, exactly one of them is used +SET (OpenCV_POSSIBLE_ROOT_DIRS +"${OpenCV_ROOT_DIR}" +"$ENV{OpenCV_ROOT_DIR}" +"$ENV{OPENCV_DIR}" # only for backward compatibility deprecated by ROOT_DIR +"$ENV{OPENCV_HOME}" # only for backward compatibility +"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Intel(R) Open Source Computer Vision Library_is1;Inno Setup: App Path]" +"$ENV{ProgramFiles}/OpenCV" +/usr/local +/usr +) + + +# MIP Uni Kiel /opt/net network installation +# get correct prefix for current gcc compiler version for gcc 3.x 4.x +IF (${CMAKE_COMPILER_IS_GNUCXX}) +IF (NOT OpenCV_FIND_QUIETLY) +MESSAGE(STATUS "Checking GNUCXX version 3/4 to determine OpenCV /opt/net/ path") +ENDIF (NOT OpenCV_FIND_QUIETLY) +EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE CXX_COMPILER_VERSION) +IF (CXX_COMPILER_VERSION MATCHES ".*3\\.[0-9].*") +SET(IS_GNUCXX3 TRUE) +LIST(APPEND OpenCV_POSSIBLE_ROOT_DIRS /opt/net/gcc33/OpenCV ) +ENDIF(CXX_COMPILER_VERSION MATCHES ".*3\\.[0-9].*") +IF (CXX_COMPILER_VERSION MATCHES ".*4\\.[0-9].*") +SET(IS_GNUCXX4 TRUE) +LIST(APPEND OpenCV_POSSIBLE_ROOT_DIRS /opt/net/gcc41/OpenCV ) +ENDIF(CXX_COMPILER_VERSION MATCHES ".*4\\.[0-9].*") +ENDIF (${CMAKE_COMPILER_IS_GNUCXX}) + +#DBG_MSG("DBG (OpenCV_POSSIBLE_ROOT_DIRS=${OpenCV_POSSIBLE_ROOT_DIRS}") + +# +# select exactly ONE OpenCV base directory/tree +# to avoid mixing different version headers and libs +# +FIND_PATH(OpenCV_ROOT_DIR +NAMES +cv/include/cv.h # windows +include/opencv/cv.h # linux /opt/net +include/cv/cv.h +include/cv.h +PATHS ${OpenCV_POSSIBLE_ROOT_DIRS}) +DBG_MSG("OpenCV_ROOT_DIR=${OpenCV_ROOT_DIR}") -find_path(OpenCV_INCLUDE_DIR - NAMES cv.h cv.hpp - PATHS ${OpenCV_INCLUDE_DIRS} - PATH_SUFFIXES opencv +# header include dir suffixes appended to OpenCV_ROOT_DIR +SET(OpenCV_INCDIR_SUFFIXES +include +include/cv +include/opencv +cv/include +cxcore/include +cvaux/include +otherlibs/cvcam/include +otherlibs/highgui +otherlibs/highgui/include +otherlibs/_graphics/include ) -find_library(OpenCV_LIBRARY - NAMES cv highgui highgui4 libcv.a OpenCV opencv CV - PATHS ${OpenCV_PKGCONF_LIBRARY_DIRS} +# library linkdir suffixes appended to OpenCV_ROOT_DIR +SET(OpenCV_LIBDIR_SUFFIXES +lib +OpenCV/lib +otherlibs/_graphics/lib ) +#DBG_MSG("OpenCV_LIBDIR_SUFFIXES=${OpenCV_LIBDIR_SUFFIXES}") + + +# +# find incdir for each lib +# +FIND_PATH(OpenCV_CV_INCLUDE_DIR +NAMES cv.h +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} ) +FIND_PATH(OpenCV_CXCORE_INCLUDE_DIR +NAMES cxcore.h +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} ) +FIND_PATH(OpenCV_CVAUX_INCLUDE_DIR +NAMES cvaux.h +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} ) +FIND_PATH(OpenCV_HIGHGUI_INCLUDE_DIR +NAMES highgui.h +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} ) +FIND_PATH(OpenCV_CVCAM_INCLUDE_DIR +NAMES cvcam.h +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} ) + +# +# find sbsolute path to all libraries +# some are optionally, some may not exist on Linux +# +FIND_LIBRARY(OpenCV_CV_LIBRARY +NAMES cv opencv +PATHS ${OpenCV_ROOT_DIR} +PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_CVAUX_LIBRARY +NAMES cvaux +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_CVCAM_LIBRARY +NAMES cvcam +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_CVHAARTRAINING_LIBRARY +NAMES cvhaartraining +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_CXCORE_LIBRARY +NAMES cxcore +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_CXTS_LIBRARY +NAMES cxts +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_HIGHGUI_LIBRARY +NAMES highgui +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_ML_LIBRARY +NAMES ml +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) +FIND_LIBRARY(OpenCV_TRS_LIBRARY +NAMES trs +PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} ) + + + +# +# Logic selecting required libs and headers +# +SET(OpenCV_FOUND ON) +DBG_MSG("OpenCV_FIND_REQUIRED_COMPONENTS=${OpenCV_FIND_REQUIRED_COMPONENTS}") +FOREACH(NAME ${OpenCV_FIND_REQUIRED_COMPONENTS} ) + +# only good if header and library both found +IF (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY) +LIST(APPEND OpenCV_INCLUDE_DIRS ${OpenCV_${NAME}_INCLUDE_DIR} ) +LIST(APPEND OpenCV_LIBRARIES ${OpenCV_${NAME}_LIBRARY} ) +#DBG_MSG("appending for NAME=${NAME} ${OpenCV_${NAME}_INCLUDE_DIR} and ${OpenCV_${NAME}_LIBRARY}" ) +ELSE (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY) +DBG_MSG("OpenCV component NAME=${NAME} not found! " +"\nOpenCV_${NAME}_INCLUDE_DIR=${OpenCV_${NAME}_INCLUDE_DIR} " +"\nOpenCV_${NAME}_LIBRARY=${OpenCV_${NAME}_LIBRARY} ") +SET(OpenCV_FOUND OFF) +ENDIF (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY) + +ENDFOREACH(NAME) + +DBG_MSG("OpenCV_INCLUDE_DIRS=${OpenCV_INCLUDE_DIRS}") +DBG_MSG("OpenCV_LIBRARIES=${OpenCV_LIBRARIES}") + +# get the link directory for rpath to be used with LINK_DIRECTORIES: +IF (OpenCV_CV_LIBRARY) +GET_FILENAME_COMPONENT(OpenCV_LINK_DIRECTORIES ${OpenCV_CV_LIBRARY} PATH) +ENDIF (OpenCV_CV_LIBRARY) + + +MARK_AS_ADVANCED( +OpenCV_ROOT_DIR +OpenCV_INCLUDE_DIRS +OpenCV_CV_INCLUDE_DIR +OpenCV_CXCORE_INCLUDE_DIR +OpenCV_CVAUX_INCLUDE_DIR +OpenCV_CVCAM_INCLUDE_DIR +OpenCV_HIGHGUI_INCLUDE_DIR +OpenCV_LIBRARIES +OpenCV_CV_LIBRARY +OpenCV_CXCORE_LIBRARY +OpenCV_CVAUX_LIBRARY +OpenCV_CVCAM_LIBRARY +OpenCV_CVHAARTRAINING_LIBRARY +OpenCV_CXTS_LIBRARY +OpenCV_HIGHGUI_LIBRARY +OpenCV_ML_LIBRARY +OpenCV_TRS_LIBRARY +) + + +# be backward compatible: +SET(OPENCV_LIBRARIES ${OpenCV_LIBRARIES} ) +SET(OPENCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS} ) +SET(OPENCV_FOUND ${OpenCV_FOUND}) + -set(OpenCV_PROCESS_INCLUDES OpenCV_INCLUDE_DIR) -set(OpenCV_PROCESS_LIBS OpenCV_LIBRARY) -libfind_process(OpenCV) +# display help message +IF(NOT OpenCV_FOUND) +# make FIND_PACKAGE friendly +IF(NOT OpenCV_FIND_QUIETLY) +IF(OpenCV_FIND_REQUIRED) +MESSAGE(FATAL_ERROR +"OpenCV required but some headers or libs not found. Please specify it's location with OpenCV_ROOT_DIR env. variable.") +ELSE(OpenCV_FIND_REQUIRED) +MESSAGE(STATUS +"ERROR: OpenCV was not found.") +ENDIF(OpenCV_FIND_REQUIRED) +ENDIF(NOT OpenCV_FIND_QUIETLY) +ENDIF(NOT OpenCV_FOUND) |
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:57
|
Module: performous Branch: instrumentgraph Commit: 9552dbc7a104e7110cce99f4ff8757180fbe28f8 Author: Tapio Vierros <tap...@gm...> Date: Sun May 9 18:06:07 2010 +0300 Crude webcam background through OpenCV. * OpenCV CMake script is very much broken. * Colors are b0rked (probably wrong component order). * Webcam video framerate is very slow to keep overall fps playable. --- cmake/Modules/FindOpenCV.cmake | 28 ++++++++++++++++++++++++++++ game/CMakeLists.txt | 5 ++++- game/screen_sing.cc | 3 +++ game/screen_sing.hh | 5 +++-- game/webcam.hh | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/FindOpenCV.cmake b/cmake/Modules/FindOpenCV.cmake new file mode 100644 index 0000000..5f71597 --- /dev/null +++ b/cmake/Modules/FindOpenCV.cmake @@ -0,0 +1,28 @@ +# - Try to find OpenCV +# Once done, this will define +# +# OpenCV_FOUND - system has OpenCV +# OpenCV_INCLUDE_DIRS - the OpenCV include directories +# OpenCV_LIBRARIES - link these to use OpenCV +# +# See documentation on how to write CMake scripts at +# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries + +include(LibFindMacros) + + +find_path(OpenCV_INCLUDE_DIR + NAMES cv.h cv.hpp + PATHS ${OpenCV_INCLUDE_DIRS} + PATH_SUFFIXES opencv +) + +find_library(OpenCV_LIBRARY + NAMES cv highgui highgui4 libcv.a OpenCV opencv CV + PATHS ${OpenCV_PKGCONF_LIBRARY_DIRS} +) + +set(OpenCV_PROCESS_INCLUDES OpenCV_INCLUDE_DIR) +set(OpenCV_PROCESS_LIBS OpenCV_LIBRARY) +libfind_process(OpenCV) + diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index abb6532..ee87468 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -79,13 +79,16 @@ else() endif() # Find all the libs that don't require extra parameters -foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png) +foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png OpenCV) find_package(${lib} REQUIRED) include_directories(${${lib}_INCLUDE_DIRS}) list(APPEND LIBS ${${lib}_LIBRARIES}) add_definitions(${${lib}_DEFINITIONS}) endforeach(lib) + include_directories(${OpenCV_INCLUDE_DIR}) + list(APPEND LIBS ${OpenCV_cv_LIBRARY} ${OpenCV_cvcore_LIBRARY} ${OpenCV_highgui_LIBRARY}) + find_package(Gettext) if(Gettext_FOUND) include_directories(${Gettext_INCLUDE_DIRS}) diff --git a/game/screen_sing.cc b/game/screen_sing.cc index f74677a..8b0f914 100644 --- a/game/screen_sing.cc +++ b/game/screen_sing.cc @@ -307,6 +307,9 @@ void ScreenSing::draw() { theme->bg_top.draw(); } + // Webcam image + m_cam.render(time); + if( !m_dancers.empty() ) { danceLayout(time); //m_layout_singer->draw(time, LayoutSinger::LEFT); diff --git a/game/screen_sing.hh b/game/screen_sing.hh index 87cc33c..b7e4f68 100644 --- a/game/screen_sing.hh +++ b/game/screen_sing.hh @@ -15,7 +15,7 @@ #include "opengl_text.hh" #include "progressbar.hh" #include "guitargraph.hh" - +#include "webcam.hh" #include "screen_players.hh" class Players; @@ -50,7 +50,7 @@ class ScreenSing: public Screen { public: /// constructor ScreenSing(std::string const& name, Audio& audio, Capture& capture, Database& database, Backgrounds& bgs): - Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true) + Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true), m_cam() {} void enter(); void exit(); @@ -91,5 +91,6 @@ class ScreenSing: public Screen { boost::shared_ptr<ThemeSing> theme; AnimValue m_quitTimer; bool m_only_singers_alive; + Webcam m_cam; }; diff --git a/game/webcam.hh b/game/webcam.hh new file mode 100644 index 0000000..d90e31a --- /dev/null +++ b/game/webcam.hh @@ -0,0 +1,39 @@ + +#include <cv.h> +#include <highgui.h> + +#include "glutil.hh" +#include "surface.hh" + +class Webcam { + public: + Webcam(int cam_id = -1): m_capture(NULL), m_timestamp(0) { + m_capture = cvCaptureFromCAM(cam_id); + if (!m_capture) { + std::cout << "Could not initialize capturing!" << std::endl; + return; + } + } + + ~Webcam() { cvReleaseCapture(&m_capture); } + + void render(double time) { + if (!m_capture) return; + IplImage* frame = 0; + if (time > m_timestamp + 0.5) { + frame = cvQueryFrame(m_capture); + if (!frame) return; + m_surface.load(frame->width, frame->height, pix::RGB, (const unsigned char*)frame->imageData); + m_timestamp = time; + } + m_surface.draw(); + } + + Dimensions& dimensions() { return m_surface.dimensions; } + Dimensions const& dimensions() const { return m_surface.dimensions; } + + private: + CvCapture* m_capture; + Surface m_surface; + double m_timestamp; +}; |
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:54
|
Module: performous
Branch: instrumentgraph
Commit: 96105ecf1e013efc974617fab3dd146584ecff63
Author: Xaldyz <xa...@us...>
Date: Sat May 8 00:14:02 2010 +0200
Fixed Gettext recognition under Windows
---
CMakeLists.txt | 3 +--
lang/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9014ff4..710509a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,8 +37,7 @@ find_package(Gettext)
if(Gettext_FOUND)
if(NOT LOCALE_DIR)
if(WIN32)
- SET(LOCALE_DIR "locale")
- SET(LOCALE_DIR_WIN32_PREFIX "bin/")
+ SET(LOCALE_DIR "bin/locale")
elseif(APPLE)
SET(LOCALE_DIR "share/locale")
else()#other os
diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt
index c7c42ff..3eb42e5 100644
--- a/lang/CMakeLists.txt
+++ b/lang/CMakeLists.txt
@@ -7,5 +7,5 @@ foreach(language ${LANGUAGES})
set(mofile ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo)
add_custom_command(OUTPUT ${mofile} COMMAND ${Msgfmt_BIN} -v "${pofile}" -o ${mofile} MAIN_DEPENDENCY ${pofile} COMMENT "Building ${language} locale" VERBATIM)
add_custom_target(locale_${language} ALL DEPENDS ${mofile}) # Make sure the mofiles are always built
- install(FILES ${mofile} DESTINATION ${LOCALE_DIR_WIN32_PREFIX}${LOCALE_DIR}/${language}/LC_MESSAGES RENAME ${CMAKE_PROJECT_NAME}.mo)
+ install(FILES ${mofile} DESTINATION ${LOCALE_DIR}/${language}/LC_MESSAGES RENAME ${CMAKE_PROJECT_NAME}.mo)
endforeach(language)
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:52
|
Module: performous
Branch: instrumentgraph
Commit: 4eb77bb33e33ff4138aef10b6668caeeab0f6a1b
Author: Felix Bertram <fl...@be...>
Date: Thu May 6 22:06:43 2010 -0700
FoFiX songs often come with album art that has a PNG extension
but is actually in JPEG format. This fix catches the exception
thrown by the PNG loader and then tries to reload the picture
as JPEG. This is not pretty - but recoding the artwork is also
not an option.
---
game/surface.cc | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index dd23d7e..be71e13 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -32,7 +32,12 @@ template <typename T> void loader(T& target, fs::path name) {
std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
if (ext == ".svg") loadSVG(target, filename);
- else if (ext == ".png") loadPNG(target, filename);
+ else if (ext == ".png") {
+ try {loadPNG(target, filename);}
+ // FIXME: there is probably a cleaner way to do this
+ // FoFiX songs often come with album art that is JPEG with a PNG extension
+ catch (...) {loadJPEG(target, filename);}
+ }
else loadJPEG(target, filename);
}
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:50
|
Module: performous
Branch: instrumentgraph
Commit: af4abf0bd98da5d3c3f49bfce4e912879d656192
Author: Felix Bertram <fl...@be...>
Date: Wed May 5 21:35:25 2010 -0700
Fixes to MIDI drums
* modified drum mapping (Alesis DM5, RockBand 2 songs)
* accept note-on events on all channels
* interpret note-on with velocity 0 as note-off
* set event::pressed
---
game/joystick.cc | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index af25ae8..7792d7b 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -9,6 +9,25 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
detail::devices[devnum] = detail::InputDevPrivate(detail::DRUMS_MIDI);
event.type = Event::PRESS;
for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
+#if 1
+ // this config tested with Alesis DM5 Pro Kit/ RockBand 2 songs from FoFiX
+ //--- kick (orange): drum 0
+ map[36] = 0; // Bass Drum
+ //--- red: drum 1
+ map[38] = 1; // Snare
+ // 57 // LiveStick
+ //--- yellow: drum 2
+ map[48] = 2; // Tom high
+ map[46] = 2; // Hi-Hat open
+ // 44 // Hi-Hat closing
+ // 42 // Hi-Hat closed
+ //--- blue
+ map[45] = 3; // Tom mid
+ map[51] = 3; // Ride Cymbal
+ //--- green
+ map[41] = 4; // Tom low
+ map[49] = 4; // Crash Cymbal
+#else
map[35] = map[36] = 0; // Bass drum 1/2
map[38] = map[40] = 1; // Snare 1/2
map[42] = map[46] = 2; // Hi-hat closed/open
@@ -17,6 +36,7 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
map[45] = map[47] = 3; // Tom mid 1/2
map[48] = map[50] = 3; // Tom high 1/2
map[49] = map[51] = 4; // Cymbal crash/ride
+#endif
}
#include <iomanip>
@@ -24,9 +44,13 @@ input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_i
void input::MidiDrums::process() {
PmEvent ev;
while (Pm_Read(stream, &ev, 1) == 1) {
- if ((ev.message & 0xFF) != 0x99) continue; // 0x99 = channel 10 (percussion) note ON
+ unsigned char evnt = ev.message & 0xF0;
+ unsigned char chan = ev.message & 0x0F;
unsigned char note = ev.message >> 8;
- //unsigned char vel = ev.message >> 16;
+ unsigned char vel = ev.message >> 16;
+ if (evnt != 0x90) continue; // 0x90 = any channel note-on
+ //if (chan != 0x09) continue; // only accept channel 10 (percussion)
+ if (vel == 0x00) continue; // velocity 0 is often used instead of note-off
Map::const_iterator it = map.find(note);
if (it == map.end()) {
std::cout << "Unassigned MIDI drum event: note " << note << std::endl;
@@ -34,6 +58,8 @@ void input::MidiDrums::process() {
}
event.button = it->second;
event.time = now();
+ for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
+ event.pressed[it->second] = true;
detail::devices[devnum].addEvent(event);
}
}
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:47
|
Module: performous
Branch: instrumentgraph
Commit: 1c0db79304738b221a99958e3bb1120a7ddee5f4
Author: Ville Immonen <imm...@gm...>
Date: Mon Apr 26 20:06:34 2010 +0300
Added new controller mapping to comments of game/instruments in schema.xml
---
data/schema.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index f3e1ec1..42a49f3 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -79,7 +79,7 @@ to save the current settings to XML.
</locale>
</entry>
<entry name="game/instruments" type="string_list">
- <!-- Should be SDL_ID:{GUITAR_GUITARHERO|GUITAR_GUITARHERO_XPLORER|GUITAR_ROCKBAND_PS3|GUITAR_ROCKBAND_XB360|DRUMS_GUITARHERO|DRUMS_ROCKBAND_PS3|DRUMS_ROCKBAND_XB360|DRUMS_MIDI|DANCEPAD_GENERIC|DANCEPAD_TIGERGAME}
+ <!-- Should be SDL_ID:{GUITAR_GUITARHERO|GUITAR_GUITARHERO_XPLORER|GUITAR_ROCKBAND_PS3|GUITAR_ROCKBAND_XB360|DRUMS_GUITARHERO|DRUMS_ROCKBAND_PS3|DRUMS_ROCKBAND_XB360|DRUMS_MIDI|DANCEPAD_GENERIC|DANCEPAD_TIGERGAME|DANCEPAD_2TECH}
example:
<stringvalue>0:GUITAR_GUITARHERO</stringvalue>
-->
|
|
From: Tapio V. <aa...@us...> - 2010-05-16 16:30:45
|
Module: performous
Branch: instrumentgraph
Commit: 10cc3e27459959e6098e7568386dde4305d6c1ac
Author: Ville Immonen <imm...@gm...>
Date: Mon Apr 26 13:15:54 2010 +0300
A mapping for 2-TECH usb dance pad
---
game/joystick.cc | 16 +++++++++++++---
game/joystick.hh | 3 ++-
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 9d3a75a..af25ae8 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -42,7 +42,7 @@ void input::MidiDrums::process() {
static const unsigned SDL_BUTTONS = 16;
int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
- static const int inputmap[11][SDL_BUTTONS] = {
+ static const int inputmap[12][SDL_BUTTONS] = {
//G R Y B O S // for guitars (S=starpower)
{ 2, 0, 1, 3, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero guitar
{ 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Guitar Hero X-plorer guitar
@@ -56,7 +56,8 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
// Left Down Up Right DownL DownR UpL UpR Start Select
{ 0, 1, 2, 3, 6, 7, 4, 5, 9, 8, -1, -1, -1, -1, -1, -1 }, // generic dance pad
{ 9, 8, -1, -1, -1, -1, -1, -1, 0, 3, 1, 2, -1, -1, -1, -1 }, // TigerGame dance pad
- { 4, 7, 6, 5, -1, -1, -1, -1, 9, 8, -1, -1, 2, 3, 1, 0 } // dance pad with ems ps2/pc adapter
+ { 4, 7, 6, 5, -1, -1, -1, -1, 9, 8, -1, -1, 2, 3, 1, 0 }, // dance pad with ems ps2/pc adapter
+ { 0, 1, 2, 3, 6, 7, 4, 5, 8, 9, -1, -1, -1, -1, -1, -1 } // 2-tech usb dance pad
};
if( _sdl_button >= SDL_BUTTONS ) return -1;
using namespace detail;
@@ -73,6 +74,7 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
case DANCEPAD_GENERIC: return inputmap[8][_sdl_button];
case DANCEPAD_TIGERGAME: return inputmap[9][_sdl_button];
case DANCEPAD_EMS2: return inputmap[10][_sdl_button];
+ case DANCEPAD_2TECH: return inputmap[11][_sdl_button];
}
throw std::logic_error("Unknown instrument type in buttonFromSDL");
}
@@ -190,7 +192,7 @@ void input::SDL::init() {
using namespace boost::spirit::classic;
rule<> type = str_p("GUITAR_GUITARHERO_XPLORER") | "GUITAR_HAMA_PS2" | "GUITAR_ROCKBAND_PS3"
| "GUITAR_ROCKBAND_XB360" | "GUITAR_GUITARHERO" | "DRUMS_GUITARHERO" | "DRUMS_ROCKBAND_PS3"
- | "DRUMS_ROCKBAND_XB360" | "DRUMS_MIDI" | "DANCEPAD_EMS2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
+ | "DRUMS_ROCKBAND_XB360" | "DRUMS_MIDI" | "DANCEPAD_EMS2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME" | "DANCEPAD_2TECH";
rule<> entry = uint_p[assign_a(sdl_id)] >> ":" >> (type)[assign_a(instrument_type)];
ConfigItem::StringList const& instruments = config["game/instruments"].sl();
@@ -223,6 +225,8 @@ void input::SDL::init() {
forced_type[sdl_id] = input::detail::DANCEPAD_TIGERGAME;
} else if (instrument_type == "DANCEPAD_EMS2") {
forced_type[sdl_id] = input::detail::DANCEPAD_EMS2;
+ } else if (instrument_type == "DANCEPAD_2TECH") {
+ forced_type[sdl_id] = input::detail::DANCEPAD_2TECH;
}
}
}
@@ -281,6 +285,9 @@ void input::SDL::init() {
case input::detail::DANCEPAD_EMS2:
std::cout << " Detected as: EMS2 dance pad controller converter (forced)" << std::endl;
break;
+ case input::detail::DANCEPAD_2TECH:
+ std::cout << " Detected as: 2-TECH USB Dance Pad (forced)" << std::endl;
+ break;
}
input::detail::devices[i] = input::detail::InputDevPrivate(forced_type[i]);
} else if( name.find("Guitar Hero3") != std::string::npos ) {
@@ -340,6 +347,9 @@ void input::SDL::init() {
} else if( name.find("0b43:0003") != std::string::npos ) {
std::cout << " Detected as: EMS2 Dance Pad controller converter (guessed)" << std::endl;
input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_EMS2);
+ } else if( name.find("USB Gamepad") != std::string::npos ) {
+ std::cout << " Detected as: 2-TECH USB Dance Pad (guessed)" << std::endl;
+ input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_2TECH);
} else {
std::cout << " Detected as: Unknown (please report the name; use config to force detection)" << std::endl;
SDL_JoystickClose(joy);
diff --git a/game/joystick.hh b/game/joystick.hh
index ef3cf20..c58b55c 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -33,7 +33,7 @@ namespace input {
namespace detail {
enum Type { GUITAR_RB_PS3, DRUMS_RB_PS3, GUITAR_RB_XB360, DRUMS_RB_XB360,
- GUITAR_GH, GUITAR_GH_XPLORER, GUITAR_HAMA_PS2, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_EMS2 };
+ GUITAR_GH, GUITAR_GH_XPLORER, GUITAR_HAMA_PS2, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_EMS2, DANCEPAD_2TECH };
static unsigned int KEYBOARD_ID = UINT_MAX;
static unsigned int KEYBOARD_ID2 = KEYBOARD_ID-1;
static unsigned int KEYBOARD_ID3 = KEYBOARD_ID-2; // Three ids needed for keyboard guitar/drumkit/dancepad
@@ -94,6 +94,7 @@ namespace input {
case DANCEPAD_GENERIC:
case DANCEPAD_EMS2:
case DANCEPAD_TIGERGAME:
+ case DANCEPAD_2TECH:
return _type == DANCEPAD;
}
throw std::logic_error("Unhandled DevType");
|