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-12 02:11:45
|
Module: performous Branch: master 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-12 00:08:56
|
Module: performous
Branch: master
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-11 23:09:22
|
Module: performous
Branch: master
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-11 22:09:47
|
Module: performous
Branch: master
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-11 21:50:33
|
Module: performous
Branch: master
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-11 21:50:21
|
Module: performous
Branch: master
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: Ville I. <fus...@us...> - 2010-05-11 20:49:20
|
Module: performous Branch: master 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-11 20:42:13
|
Module: performous
Branch: master
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-11 19:56:35
|
Module: performous Branch: master 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-11 19:56:33
|
Module: performous
Branch: master
Commit: 51420a701ab10727adfae93c56a817f0056cfe98
Author: Tapio Vierros <tap...@gm...>
Date: Mon May 10 15:44:02 2010 +0300
Some OpenCV CMake tweaks.
---
cmake/Modules/FindOpenCV.cmake | 25 ++++++++-----------------
game/CMakeLists.txt | 2 +-
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/cmake/Modules/FindOpenCV.cmake b/cmake/Modules/FindOpenCV.cmake
index 70db510..3dec6df 100644
--- a/cmake/Modules/FindOpenCV.cmake
+++ b/cmake/Modules/FindOpenCV.cmake
@@ -39,7 +39,7 @@ 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 )
+SET(OpenCV_FIND_REQUIRED_COMPONENTS CV CXCORE HIGHGUI)
IF (WIN32)
LIST(APPEND OpenCV_FIND_REQUIRED_COMPONENTS CVCAM ) # WIN32 only actually
ENDIF(WIN32)
@@ -62,9 +62,6 @@ SET (OpenCV_POSSIBLE_ROOT_DIRS
# 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)
@@ -183,14 +180,14 @@ 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}" )
+ 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)
+ 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)
@@ -224,14 +221,11 @@ 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})
-
-
# display help message
IF(NOT OpenCV_FOUND)
# make FIND_PACKAGE friendly
@@ -239,9 +233,6 @@ 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)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 06c2b2a..a68b2af 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -113,7 +113,7 @@ if(OpenCV_FOUND)
add_definitions("-DUSE_OPENCV")
message(STATUS "Webcam support: Enabled")
else()
- message(STATUS "Webcam support: Disabled (libcv not found)")
+ message(STATUS "Webcam support: Disabled (libcv/libhighgui not found)")
endif()
|
|
From: Tapio V. <aa...@us...> - 2010-05-11 19:56:18
|
Module: performous
Branch: master
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-11 19:56:15
|
Module: performous Branch: master 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-11 11:03:09
|
Module: performous
Branch: master
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-11 10:31:06
|
Module: performous
Branch: opencv
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-11 10:31:01
|
Module: performous
Branch: master
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-10 19:00:42
|
Module: web Branch: master Commit: 98204d0b46449505be65691ce90dde942c437d20 Author: Tapio Vierros <tap...@gm...> Date: Mon May 10 21:59:08 2010 +0300 Tweaks, mainly for download page. --- htdocs-source/about.txt | 5 +++-- htdocs-source/install.txt | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs-source/about.txt b/htdocs-source/about.txt index b780533..807ce0b 100644 --- a/htdocs-source/about.txt +++ b/htdocs-source/about.txt @@ -39,7 +39,7 @@ Since 0.5.0 you can use dance pad to play dance songs in StepMania format. Again Device autodetection Guitar Hero and Rock Band instruments Generic dance pads - SingStar and Rock Band microphones (Linux only) + SingStar and Rock Band microphones Fallback to other audio devices when no SS/RB mics are detected Top-notch visuals Fully OpenGL-based rendering @@ -68,8 +68,9 @@ Since 0.5.0 you can use dance pad to play dance songs in StepMania format. Again Rock Band microphones Regular microphones (connected via sound card) Webcams (usable but not recommended) - Plenty of instruments + Plenty of controllers Guitar Hero or Rock Band drums and guitars + Dance pads :h2:How to get performing? diff --git a/htdocs-source/install.txt b/htdocs-source/install.txt index 5cba69b..78f8f92 100644 --- a/htdocs-source/install.txt +++ b/htdocs-source/install.txt @@ -2,7 +2,7 @@ How to get performing :~preface:Installing Performous is very easy using the prebuilt packages. Just click the package and have it installed. -Song downloads can be found on the separate <strong>songs page</strong>. +Song downloads can be found on the separate <a href="songs.html">songs page</a>. :h2:Windows @@ -13,10 +13,10 @@ Song downloads can be found on the separate <strong>songs page</strong>. OS X 10.5: <a href="https://sourceforge.net/projects/performous/files/performous/0.5.0/Performous-0.5.0.dmg/download">bundle</a> :h2:Linux - + Ubuntu 10.04 Lucid Lynx: <a href="apt:performous">performous</a> in official repositories Ubuntu 9.10 Karmic Koala: <a href="https://sourceforge.net/projects/performous/files/performous/0.5.0/Performous-0.5.0-Ubuntu9.10-i386.deb/download">i386</a> <a href="https://sourceforge.net/projects/performous/files/performous/0.5.0/Performous-0.5.0-Ubuntu9.10-amd64.deb/download">amd64</a> - Ubuntu 8.04 LTS Hardy Heron: <a href="http://sourceforge.net/projects/performous/files/performous/Performous-0.3.2-Ubuntu8.04-i386.deb">i386</a> <a href="http://sourceforge.net/projects/performous/files/performous/Performous-0.3.2-Ubuntu8.04-amd64.deb">amd64</a> - Debian: <strong>performous</strong> in official repositories + Ubuntu 8.04 LTS Hardy Heron (v0.3.2): <a href="http://sourceforge.net/projects/performous/files/performous/Performous-0.3.2-Ubuntu8.04-i386.deb">i386</a> <a href="http://sourceforge.net/projects/performous/files/performous/Performous-0.3.2-Ubuntu8.04-amd64.deb">amd64</a> + Debian: <a href="apt:performous">performous</a> in official repositories OpenSUSE: <a href="http://packman.links2linux.de/package/Performous/">packages</a> ArchLinux: <a href="http://aur.archlinux.org/packages.php?ID=24623">packages</a> Mandriva 2010.0: <a href="http://ftp.blogdrake.net/mandriva/2010.0/update/i586/Performous-0.5.1-01bdk2010.0.i586.rpm">i586</a> <a href="http://ftp.blogdrake.net/mandriva/2010.0/update/x86_64/Performous-0.5.1-01bdk2010.0.x86_64.rpm">x86_64</a> @@ -26,9 +26,11 @@ If you get an error about unsatisfied dependencies on Ubuntu, you may have to en :h2:Other systems and development version - Source code: <a href="http://sourceforge.net/projects/performous/files/performous/0.5.1/Performous-0.5.1-Source.tar.bz2/download">universal</a> + Source code (v0.5.1): <a href="http://sourceforge.net/projects/performous/files/performous/0.5.1/Performous-0.5.1-Source.tar.bz2/download">universal</a> + + The very latest source code is available in our Git repository. See the <a href="http://wiki.performous.org/index.php/Developing">documentation wiki</a> for more information. - The very latest source code is available in our Git repository. See the documentation wiki for more information. + You can find testing binaries of the development version <a href="http://wiki.performous.org/index.php/Nightly_Builds">here</a>. :h2:Troubleshooting |
|
From: Tapio V. <aa...@us...> - 2010-05-10 16:41:21
|
Module: performous Branch: master 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-10 12:45:20
|
Module: performous
Branch: opencv
Commit: 51420a701ab10727adfae93c56a817f0056cfe98
Author: Tapio Vierros <tap...@gm...>
Date: Mon May 10 15:44:02 2010 +0300
Some OpenCV CMake tweaks.
---
cmake/Modules/FindOpenCV.cmake | 25 ++++++++-----------------
game/CMakeLists.txt | 2 +-
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/cmake/Modules/FindOpenCV.cmake b/cmake/Modules/FindOpenCV.cmake
index 70db510..3dec6df 100644
--- a/cmake/Modules/FindOpenCV.cmake
+++ b/cmake/Modules/FindOpenCV.cmake
@@ -39,7 +39,7 @@ 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 )
+SET(OpenCV_FIND_REQUIRED_COMPONENTS CV CXCORE HIGHGUI)
IF (WIN32)
LIST(APPEND OpenCV_FIND_REQUIRED_COMPONENTS CVCAM ) # WIN32 only actually
ENDIF(WIN32)
@@ -62,9 +62,6 @@ SET (OpenCV_POSSIBLE_ROOT_DIRS
# 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)
@@ -183,14 +180,14 @@ 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}" )
+ 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)
+ 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)
@@ -224,14 +221,11 @@ 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})
-
-
# display help message
IF(NOT OpenCV_FOUND)
# make FIND_PACKAGE friendly
@@ -239,9 +233,6 @@ 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)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 06c2b2a..a68b2af 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -113,7 +113,7 @@ if(OpenCV_FOUND)
add_definitions("-DUSE_OPENCV")
message(STATUS "Webcam support: Enabled")
else()
- message(STATUS "Webcam support: Disabled (libcv not found)")
+ message(STATUS "Webcam support: Disabled (libcv/libhighgui not found)")
endif()
|
|
From: Tapio V. <aa...@us...> - 2010-05-10 12:45:15
|
Module: performous
Branch: opencv
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-09 21:55:17
|
Module: performous
Branch: opencv
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: Stefano A. <xa...@us...> - 2010-05-07 22:14:16
|
Module: performous
Branch: master
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: Felix B. <fbe...@us...> - 2010-05-07 05:09:48
|
Module: performous
Branch: master
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: Felix B. <fbe...@us...> - 2010-05-06 04:40:27
|
Module: performous
Branch: master
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: Ville I. <fus...@us...> - 2010-04-26 17:09:17
|
Module: performous
Branch: master
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: Ville I. <fus...@us...> - 2010-04-26 16:55:16
|
Module: performous
Branch: master
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");
|