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-06-21 20:07:10
|
Module: performous Branch: master Commit: 66ed99a828793db65edcf4d13471b5378ad0170d Author: Tapio Vierros <tap...@gm...> Date: Mon Jun 21 23:06:10 2010 +0300 Remove executable bit from a few source files. --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/game/menu.cc b/game/menu.cc old mode 100755 new mode 100644 diff --git a/game/menu.hh b/game/menu.hh old mode 100755 new mode 100644 diff --git a/game/screen_intro.cc b/game/screen_intro.cc old mode 100755 new mode 100644 diff --git a/game/screen_intro.hh b/game/screen_intro.hh old mode 100755 new mode 100644 diff --git a/game/theme.cc b/game/theme.cc old mode 100755 new mode 100644 diff --git a/game/theme.hh b/game/theme.hh old mode 100755 new mode 100644 |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-21 19:59:09
|
Module: performous
Branch: portaudio
Commit: c61af2ba294b143b9bcc25b933740907647f051d
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jun 21 22:58:39 2010 +0300
Change Z buffer to 24 bits instead of 16 bits (glattr was not accepting 16 on my Intel/Linux system).
---
game/video_driver.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 508db0e..084c103 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -97,7 +97,7 @@ void Window::resize() {
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_d(SDL_GL_DEPTH_SIZE, 24);
GLattrSetter attr_s(SDL_GL_STENCIL_SIZE, 8);
GLattrSetter attr_db(SDL_GL_DOUBLEBUFFER, 1);
GLattrSetter attr_ar(SDL_GL_ACCUM_RED_SIZE, 0);
|
|
From: Tapio V. <aa...@us...> - 2010-06-21 19:33:38
|
Module: performous Branch: joinmenu Commit: e27a92d4d2efa8c5943a11fd4392ad6ffb2f0344 Author: Tapio Vierros <tap...@gm...> Date: Mon Jun 21 22:30:36 2010 +0300 Initial implementation of instrument joining menu. * Currently only two options, track and difficulty. * Visual output is very crude placeholder. * Guitars, drums and dancepads supported. * Theming system is not yet used (although some code exists). * input::Event now holds also translated NavButton enum. * Especially keyboard guitar controls need love. * Much clean-up required and room for guitar/dance unification. * Doesn't yet wait for players' choices. New options are added to the menu by giving description and two pointers to InstrumentGraph member functions: 1. void adjust(int dir) - execute for option change 2. string getValue() - returns the display value --- game/dancegraph.cc | 39 +++++++++++++++++++---------------- game/dancegraph.hh | 4 +- game/guitargraph.cc | 52 +++++++++++++++++++++++++++------------------- game/guitargraph.hh | 2 + game/instrumentgraph.cc | 18 ++++++++++++++++ game/instrumentgraph.hh | 7 ++++++ game/joystick.cc | 34 ++++++++++++++++-------------- game/joystick.hh | 1 + game/menu.cc | 37 +++++++++++++++++++++++++++++--- game/menu.hh | 45 +++++++++++++++++++++++++++++++++++++++- game/screen_intro.cc | 8 +++--- game/screen_intro.hh | 4 +- game/screen_sing.cc | 4 +- game/theme.cc | 13 +++++++++++ game/theme.hh | 15 +++++++++++++ 15 files changed, 212 insertions(+), 71 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2010-06-21 13:53:09
|
Module: performous
Branch: master
Commit: d60b32a98361a9265ba7c7592810d58b24e9a06d
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Jun 21 14:30:16 2010 +0200
Updated gentoo ebuild
---
.../games-arcade/performous/performous-9999.ebuild | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/portage-overlay/games-arcade/performous/performous-9999.ebuild b/portage-overlay/games-arcade/performous/performous-9999.ebuild
index 6ac7944..d979e5f 100644
--- a/portage-overlay/games-arcade/performous/performous-9999.ebuild
+++ b/portage-overlay/games-arcade/performous/performous-9999.ebuild
@@ -35,7 +35,7 @@ LICENSE="GPL-2
SLOT="0"
KEYWORDS="~x86 ~amd64 ~ppc ~ppc64"
-IUSE="debug alsa portaudio pulseaudio jack songs gstreamer tools editor"
+IUSE="debug alsa portaudio pulseaudio jack songs gstreamer tools editor midi webcam"
RDEPEND="gnome-base/librsvg
dev-libs/boost
@@ -47,6 +47,7 @@ RDEPEND="gnome-base/librsvg
media-libs/jpeg
tools? ( media-gfx/imagemagick[png] )
editor? ( media-gfx/imagemagick[png] )
+ webcam? ( media-libs/opencv[v4l] )
>=media-video/ffmpeg-0.4.9_p20070616-r20
alsa? ( media-libs/alsa-lib )
jack? ( media-sound/jack-audio-connection-kit )
@@ -55,6 +56,9 @@ RDEPEND="gnome-base/librsvg
pulseaudio? ( media-sound/pulseaudio )
sys-apps/help2man
!games-arcade/ultrastar-ng"
+# Waiting for portmidi to enter portage (#90614)
+#RDEPEND="${RDEPEND}
+# midi? ( media-libs/portmidi )"
DEPEND="${RDEPEND}
>=dev-util/cmake-2.6.0"
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-21 05:28:49
|
Module: performous
Branch: portaudio
Commit: 6d10efce3f07f9867852e53fd73257b419f9e1c8
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jun 21 08:20:05 2010 +0300
More error handling for song loader (avoiding uncaught exceptions)
---
game/songs.cc | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/game/songs.cc b/game/songs.cc
index 1bdb005..19e802d 100644
--- a/game/songs.cc
+++ b/game/songs.cc
@@ -42,12 +42,16 @@ void Songs::reload_internal() {
Profiler prof("Song loading took");
Paths paths = getPathsConfig("system/path_songs");
for (Paths::iterator it = paths.begin(); m_loading && it != paths.end(); ++it) {
- if (!fs::is_directory(*it)) { m_debug << ">>> Not scanning: " << *it << " (no such directory)" << std::endl; continue; }
- m_debug << ">>> Scanning " << *it << std::endl;
- size_t count = m_songs.size();
- reload_internal(*it);
- size_t diff = m_songs.size() - count;
- if (diff > 0 && m_loading) m_debug << diff << " songs loaded" << std::endl;
+ try {
+ if (!fs::is_directory(*it)) { m_debug << ">>> Not scanning: " << *it << " (no such directory)" << std::endl; continue; }
+ m_debug << ">>> Scanning " << *it << std::endl;
+ size_t count = m_songs.size();
+ reload_internal(*it);
+ size_t diff = m_songs.size() - count;
+ if (diff > 0 && m_loading) m_debug << diff << " songs loaded" << std::endl;
+ } catch (std::exception& e) {
+ m_debug << ">>> Error scanning " << *it << ": " << e.what() << std::endl;
+ }
}
prof("total");
if (m_loading) dumpSongs_internal(); // Dump the songlist to file (if requested)
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-21 05:28:46
|
Module: performous
Branch: portaudio
Commit: 4a0b003f9e520b5bf7ec32b618f51d9a7a54e42e
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jun 21 08:19:12 2010 +0300
Do not use the new CMake detection that comes with Boost because it is currently broken.
---
cmake/Modules/FindBoost.cmake | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cmake/Modules/FindBoost.cmake b/cmake/Modules/FindBoost.cmake
index 127393d..4ca8778 100644
--- a/cmake/Modules/FindBoost.cmake
+++ b/cmake/Modules/FindBoost.cmake
@@ -78,7 +78,7 @@
# Force proper redetection (to allow e.g. changed COMPONENTS)
set(Boost_FOUND false)
-find_package(Boost QUIET COMPONENTS ${Boost_FIND_COMPONENTS} NO_MODULE)
+#find_package(Boost QUIET COMPONENTS ${Boost_FIND_COMPONENTS} NO_MODULE)
if (Boost_FOUND)
if (Boost_FIND_COMPONENTS)
|
|
From: Yoda-JM <yo...@us...> - 2010-06-20 20:04:48
|
Module: performous Branch: portaudio Commit: 25d5f464dcc3d47a7af7b31f841652cac5b1fcaf Author: Vincent Le Ligeour <yo...@us...> Date: Sun Jun 20 22:04:19 2010 +0200 Implemented sample playback --- game/audio.cc | 61 +++++++++++++++++----------------------------- game/audio.hh | 9 +------ game/guitargraph.cc | 31 +++++++++++++---------- game/guitargraph.hh | 2 +- game/screen_practice.cc | 24 ++++++++++-------- game/screen_practice.hh | 4 +- 6 files changed, 57 insertions(+), 74 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2010-06-20 19:16:50
|
Module: performous
Branch: portaudio
Commit: da7996816460ccd179e6a3244f76aaa196be7276
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Jun 20 21:16:30 2010 +0200
Added draft of sample playing
---
game/audio.cc | 75 +++++++++++++++++++++++++++++++++++++++++++++-
game/audio.hh | 7 ++++-
game/ffmpeg.hh | 2 +-
game/screen_practice.cc | 3 ++
4 files changed, 83 insertions(+), 4 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index b82be8d..fcdb3bc 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -68,10 +68,46 @@ public:
}
};
+#define MAX_SAMPLE_SIZE 2000000
+
+// rename to Sample once totally implemented
+struct SampleNew {
+ private:
+ std::vector<float> sample_buf;
+ unsigned int srate;
+ double m_pos;
+ public:
+ SampleNew(std::string filename, unsigned sr) : srate(sr), m_pos() {
+ FFmpeg mpeg(false, true, filename, sr);
+ // here transfer all the samples to sample_buf
+ //
+ sample_buf.resize(MAX_SAMPLE_SIZE);
+ }
+ bool operator()(float* begin, float* end) {
+ if( m_pos >= sample_buf.size()) {
+ // No more data to play in this sample
+ return false;
+ }
+ for (size_t i = 0, iend = end - begin; i != iend; ++i) {
+ if(m_pos + i > sample_buf.size()) {
+ // no more data to fill
+ break;
+ }
+ begin[i] += sample_buf[m_pos + i];
+ }
+ m_pos += end - begin;
+ }
+ void seek(double time) {
+ m_pos = time * srate * 2.0;
+ }
+};
+
+
struct Audio::Impl {
boost::mutex mutex;
std::auto_ptr<Music> preloading;
boost::ptr_vector<Music> playing, disposing;
+ boost::ptr_map<std::string, SampleNew> playing_samples, sleeping_samples;
portaudio::Init init;
boost::ptr_vector<portaudio::Stream> streams;
volatile bool paused;
@@ -101,6 +137,12 @@ struct Audio::Impl {
if (!l.owns_lock()) keep = true; // Cannot dispose without lock
if (keep) ++i; else disposing.transfer(disposing.end(), playing.begin() + i, playing);
}
+ for(boost::ptr_map<std::string, SampleNew>::iterator it = playing_samples.begin() ; it != playing_samples.end() ; ++it) {
+ boost::mutex::scoped_try_lock l(mutex);
+ if( (*it->second)(begin, end) == false && l.owns_lock()) {
+ sleeping_samples.transfer(sleeping_samples.end(), it, playing_samples);
+ }
+ }
}
int operator()(void const* input, void* output, unsigned long frames, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags) try {
float const* in = static_cast<float const*>(input);
@@ -123,8 +165,37 @@ bool Audio::isOpen() const {
boost::mutex::scoped_lock l(self->mutex);
return !self->streams.empty();
}
-
-void Audio::play(Sample const& s, std::string const& volumeSetting) {
+
+void Audio::loadSample(std::string streamId, std::string filename) {
+ std::cout << ">>> Loading sample \"" << streamId << "\"" << std::endl;
+ {
+ boost::mutex::scoped_lock l(self->mutex);
+ self->sleeping_samples.insert(streamId, new SampleNew(filename, getSR()));
+ }
+}
+void Audio::playSample(std::string streamId) {
+ boost::mutex::scoped_lock l(self->mutex);
+ boost::ptr_map<std::string, SampleNew>::iterator it = self->sleeping_samples.find(streamId);
+ if( it == self->sleeping_samples.end() ) {
+ boost::ptr_map<std::string, SampleNew>::iterator it = self->playing_samples.find(streamId);
+ if( it == self->playing_samples.end() ) {
+ throw std::runtime_error("Cannot play sample : " + streamId);
+ } else {
+ it->second->seek(0.0);
+ }
+ } else {
+ it->second->seek(0.0);
+ self->playing_samples.transfer(self->playing_samples.end(), it, self->sleeping_samples);
+ }
+}
+
+void Audio::unloadSample(std::string streamId) {
+ std::cout << ">>> Unloading sample \"" << streamId << "\"" << std::endl;
+ {
+ boost::mutex::scoped_lock l(self->mutex);
+ self->sleeping_samples.erase(streamId);
+ self->playing_samples.erase(streamId);
+ }
}
void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool preview, double fadeTime, double startPos) {
diff --git a/game/audio.hh b/game/audio.hh
index ab310a8..8475e3d 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -11,10 +11,12 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
+// TODO: should be removed
struct Sample {
Sample(std::string, unsigned) {}
};
+
/** @short High level audio playback API **/
class Audio {
struct Impl;
@@ -34,7 +36,10 @@ public:
/// plays a list of songs
void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = 0.0);
/// plays a sample
- void play(Sample const& s, std::string const& volumeSetting);
+ void loadSample(std::string streamId, std::string filename);
+ void playSample(std::string streamId);
+ void unloadSample(std::string streamId);
+ void play(Sample const& s, std::string const& volumeSetting) {};// TODO: remove
/// stops music
void stopMusic();
/// fades music out
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index 246f436..877b145 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -32,7 +32,7 @@ struct VideoFrame {
int width, ///< width of frame
height; ///< height of frame
/// data array
- std::vector<uint8_t> data;
+ std::vector<uint8_t> data;
/// constructor
VideoFrame(double ts, int w, int h): timestamp(ts), width(w), height(h) {}
VideoFrame(): timestamp(getInf()) {} // EOF marker
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 3c18e3d..335650d 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -19,6 +19,7 @@ void ScreenPractice::enter() {
b->dimensions.screenBottom().left(-0.4 + i * 0.2).fixedWidth(0.04);
}
unsigned int sr = m_audio.getSR();
+ m_audio.loadSample("drum bass", getPath("sounds/drum_bass.ogg"));
m_samples.push_back(Sample(getPath("sounds/drum_bass.ogg"), sr));
m_samples.push_back(Sample(getPath("sounds/drum_snare.ogg"), sr));
m_samples.push_back(Sample(getPath("sounds/drum_hi-hat.ogg"), sr));
@@ -28,6 +29,7 @@ void ScreenPractice::enter() {
}
void ScreenPractice::exit() {
+ m_audio.unloadSample("drum bass");
m_vumeters.clear();
m_samples.clear();
theme.reset();
@@ -43,6 +45,7 @@ void ScreenPractice::manageEvent(SDL_Event event) {
&& input::detail::devices[event.jbutton.which].type_match(input::DRUMS)) {
int b = input::buttonFromSDL(input::detail::devices[event.jbutton.which].type(), event.jbutton.button);
if (b != -1) m_audio.play(m_samples[unsigned(b) % m_samples.size()], "audio/fail_volume");
+ m_audio.playSample("drum bass");
}
}
|
|
From: Tapio V. <aa...@us...> - 2010-06-20 15:43:29
|
Module: performous
Branch: master
Commit: 25a9da624497f21e57032f086275670647e208d1
Author: Tapio Vierros <tap...@gm...>
Date: Sun Jun 20 18:38:23 2010 +0300
Experimental webcam video recording to file.
* No audio.
* Assumes camera captures 30 FPS (so video has most likely wrong "speed").
* Enabled/disabled via defining SAVE_WEBCAM_VIDEO macro.
* Initially enabled (in webcam.cc) only for testing purposes.
* Output to home directory, new recording overwrites previous.
---
game/webcam.cc | 18 +++++++++++++++++-
game/webcam.hh | 2 ++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
index 0dd11e1..e29ca66 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -2,14 +2,17 @@
#include "webcam.hh"
#include "xtime.hh"
+#include "fs.hh"
#ifdef USE_OPENCV
#include <cv.h>
#include <highgui.h>
+
+#define SAVE_WEBCAM_VIDEO
#endif
Webcam::Webcam(int cam_id):
- m_thread(), m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
+ m_thread(), m_capture(NULL), m_writer(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
{
#ifdef USE_OPENCV
// Initialize the capture device
@@ -18,6 +21,17 @@ Webcam::Webcam(int cam_id):
std::cout << "Could not initialize webcam capturing!" << std::endl;
return;
}
+ // Initialize the video writer
+ #ifdef SAVE_WEBCAM_VIDEO
+ float fps = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FPS);
+ int framew = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FRAME_WIDTH);
+ int frameh = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FRAME_HEIGHT);
+ int codec = CV_FOURCC('P','I','M','1'); // MPEG-1
+ std::string out_file((getHomeDir() / std::string("/performous-webcam_out.mpg")).string());
+ m_writer = cvCreateVideoWriter(out_file.c_str(), codec, fps > 0 ? fps : 30.0f, cvSize(framew,frameh));
+ if (!m_writer) std::cout << "Could not initialize webcam video saving!" << std::endl;
+ #endif
+ // Start thread
m_thread.reset(new boost::thread(boost::ref(*this)));
#else
++cam_id; // dummy
@@ -29,6 +43,7 @@ Webcam::~Webcam() {
#ifdef USE_OPENCV
if (m_thread) m_thread->join();
cvReleaseCapture(&m_capture);
+ cvReleaseVideoWriter(&m_writer);
#endif
}
@@ -40,6 +55,7 @@ void Webcam::operator()() {
// Try to get a new frame
if (m_running) frame = cvQueryFrame(m_capture);
if (frame) {
+ if (m_writer) cvWriteFrame(m_writer, frame);
boost::mutex::scoped_lock l(m_mutex);
// Copy the frame to storage
m_frame.width = frame->width;
diff --git a/game/webcam.hh b/game/webcam.hh
index 1091c91..f63087d 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -8,6 +8,7 @@
#include "surface.hh"
struct CvCapture;
+struct CvVideoWriter;
struct CamFrame {
int width;
@@ -39,6 +40,7 @@ class Webcam {
boost::scoped_ptr<boost::thread> m_thread;
mutable boost::mutex m_mutex;
CvCapture* m_capture;
+ CvVideoWriter* m_writer;
CamFrame m_frame;
Surface m_surface;
bool m_frameAvailable;
|
|
From: Tapio V. <aa...@us...> - 2010-06-19 19:15:40
|
Module: performous
Branch: master
Commit: c436b8fd7766ffcf28bfd1cc423991fd10777753
Author: Tapio Vierros <tap...@gm...>
Date: Sat Jun 19 22:14:56 2010 +0300
Instrument notes are now gray during joining.
---
game/dancegraph.cc | 6 +++---
game/guitargraph.cc | 24 ++++++++++++++----------
game/instrumentgraph.hh | 1 +
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 10b76bf..cf9c556 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -182,7 +182,7 @@ void DanceGraph::engine() {
if (time < it->first + it->second) { time = it->first; break; } // Inside stop
time -= it->second;
}
- if (time < m_jointime) m_dead = 0; // Disable dead counting while joining
+ if (joining(time)) m_dead = 0; // Disable dead counting while joining
bool difficulty_changed = false;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
@@ -192,7 +192,7 @@ void DanceGraph::engine() {
break;
}
// Difficulty / mode selection
- if (time < m_jointime && ev.type == input::Event::PRESS) {
+ if (joining(time) && ev.type == input::Event::PRESS) {
if (ev.pressed[STEP_UP]) difficultyDelta(1);
else if (ev.pressed[STEP_DOWN]) difficultyDelta(-1);
else if (ev.pressed[STEP_LEFT]) gameMode(-1);
@@ -466,7 +466,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
/// Draw popups and other info texts
void DanceGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
// Draw info
- if (time < m_jointime) {
+ if (joining(time)) {
m_text.dimensions.screenBottom(-0.075).middle(-0.09 + offsetX);
m_text.draw("^ " + getDifficultyString() + " v");
m_text.dimensions.screenBottom(-0.050).middle(-0.09 + offsetX);
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5a1e122..0be7a41 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -194,7 +194,7 @@ void GuitarGraph::engine() {
}
if (!m_drumfills.empty()) updateDrumFill(time); // Drum Fills / BREs
if (m_starpower.get() > 0.001) m_correctness.setTarget(1.0, true);
- if (time < m_jointime) m_dead = 0; // Disable dead counting while joining
+ if (joining(time)) m_dead = 0; // Disable dead counting while joining
double whammy = 0;
bool difficulty_changed = false;
// Handle all events
@@ -225,7 +225,7 @@ void GuitarGraph::engine() {
if (ev.type == input::Event::PRESS) m_pressed_anim[!m_drums + ev.button].setValue(1.0);
else if (ev.type == input::Event::PICK) m_pressed_anim[0].setValue(1.0);
// Difficulty and track selection
- if (time < m_jointime) {
+ if (joining(time)) {
if (ev.type == input::Event::PICK || ev.type == input::Event::PRESS) {
if (!m_drums && ev.pressed[4]) nextTrack();
else if (ev.pressed[0 + m_drums]) difficulty(DIFFICULTY_SUPAEASY);
@@ -778,13 +778,17 @@ void GuitarGraph::draw(double time) {
glow = m_events[event - 1].glow.get();
whammy = m_events[event - 1].whammy.get();
}
- // Get a color for the fret and adjust it if GodMode is on
- glutil::Color c = colorize(color(fret), it->begin);
- if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
- // Further adjust the color if the note is hit
- c.r += glow * 0.2f;
- c.g += glow * 0.2f;
- c.b += glow * 0.2f;
+ // Set the default color (disabled state)
+ glutil::Color c(0.5f, 0.5f, 0.5f);
+ if (!joining(time)) {
+ // Get a color for the fret and adjust it if GodMode is on
+ c = colorize(color(fret), it->begin);
+ if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
+ // Further adjust the color if the note is hit
+ c.r += glow * 0.2f;
+ c.g += glow * 0.2f;
+ c.b += glow * 0.2f;
+ }
if (glow > 0.5f && tEnd < 0.1f && it->hitAnim[fret].get() == 0.0)
it->hitAnim[fret].setTarget(1.0);
// Call the actual note drawing function
@@ -983,7 +987,7 @@ void GuitarGraph::drawDrumfill(float tBeg, float tEnd) {
/// Draw popups and other info texts
void GuitarGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
// Draw info
- if (time < m_jointime) {
+ if (joining(time)) {
m_text.dimensions.screenBottom(-0.041).middle(-0.09 + offsetX);
m_text.draw(diffv[m_level].name);
m_text.dimensions.screenBottom(-0.015).middle(-0.09 + offsetX);
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index f1cbf86..6923d53 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -117,6 +117,7 @@ class InstrumentGraph {
// Shared functions for derived classes
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
+ bool joining(double time) const { return time < m_jointime; }
// Media
SvgTxtTheme m_text;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-19 02:47:32
|
Module: performous
Branch: portaudio
Commit: 8a47959c4e54a3c571bd1465a1ae96d763dd6c1a
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jun 19 05:47:03 2010 +0300
A temporary fix for the Alt+F4 segfault problem, caused by screen_sing not being exited before destroying Audio, causing engine thread to sometimes access Audio::getPosition on a dead object...
---
game/main.cc | 3 +--
game/screen.hh | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 9b0b597..fcc41ec 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -107,10 +107,9 @@ static void checkEvents_SDL(ScreenManager& sm) {
void mainLoop(std::string const& songlist) {
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
+ Audio audio;
ScreenManager sm(window);
try {
- sm.flashMessage(_("Audio playback..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
- Audio audio;
sm.flashMessage(_("Miscellaneous..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Backgrounds backgrounds;
Database database(getConfigDir() / "database.xml");
diff --git a/game/screen.hh b/game/screen.hh
index ba7da69..fb853af 100644
--- a/game/screen.hh
+++ b/game/screen.hh
@@ -37,6 +37,7 @@ class ScreenManager: public Singleton <ScreenManager> {
public:
/// constructor
ScreenManager(Window& window);
+ ~ScreenManager() { if (currentScreen) currentScreen->exit(); }
/// adds a screen to the manager
void addScreen(Screen* s) { std::string tmp = s->getName(); screens.insert(tmp, s); };
/// Switches active screen
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-19 02:47:29
|
Module: performous
Branch: portaudio
Commit: e9e9e096e2e2982b881f29cfd8fa7c2ee7b0473a
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jun 19 05:36:08 2010 +0300
More audio cleanup and fixed a bug causing streams with negative starting pos never getting played.
---
game/audio.cc | 15 ++++++++++-----
game/audio.hh | 9 ++++-----
game/ffmpeg.hh | 1 +
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 7fd5b5f..b82be8d 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -119,16 +119,21 @@ struct Audio::Impl {
Audio::Audio(): self(new Impl) {}
Audio::~Audio() {}
+bool Audio::isOpen() const {
+ boost::mutex::scoped_lock l(self->mutex);
+ return !self->streams.empty();
+}
+
void Audio::play(Sample const& s, std::string const& volumeSetting) {
}
void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool preview, double fadeTime, double startPos) {
boost::mutex::scoped_lock l(self->mutex);
- self->disposing.clear();
- self->preloading.reset(new Music(filenames, 48000));
+ self->disposing.clear(); // Delete disposed streams
+ self->preloading.reset(new Music(filenames, getSR()));
Music& m = *self->preloading.get();
m.seek(startPos);
- m.fadeRate = fadeTime / 48000.0f;
+ m.fadeRate = 1.0 / getSR() / fadeTime;
}
void Audio::playMusic(std::string const& filename, bool preview, double fadeTime, double startPos) {
@@ -149,12 +154,12 @@ void Audio::fadeout(double fadeTime) {
double Audio::getPosition() const {
boost::mutex::scoped_lock l(self->mutex);
- return self->playing.empty() ? getNaN() : self->playing[0].pos();
+ return (self->playing.empty() || self->preloading.get()) ? getNaN() : self->playing[0].pos();
}
double Audio::getLength() const {
boost::mutex::scoped_lock l(self->mutex);
- return self->playing.empty() ? getNaN() : self->playing[0].duration();
+ return (self->playing.empty() || self->preloading.get()) ? getNaN() : self->playing[0].duration();
}
bool Audio::isPlaying() const {
diff --git a/game/audio.hh b/game/audio.hh
index 1585d23..ab310a8 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -23,17 +23,16 @@ public:
Audio();
~Audio();
boost::ptr_vector<Analyzer>& analyzers() { static boost::ptr_vector<Analyzer> ana; return ana; }
- /// if audio is currently playing
- bool isOpen() const { return false; }
+ bool isOpen() const;
/** Play a song beginning at startPos (defaults to 0)
* @param filename the track filename
* @param preview if the song preview is to play
* @param fadeTime time to fade
* @param startPos starting position
*/
- void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.5, double startPos = -0.2);
+ void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.5, double startPos = 0.0);
/// plays a list of songs
- void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = -0.2);
+ void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = 0.0);
/// plays a sample
void play(Sample const& s, std::string const& volumeSetting);
/// stops music
@@ -59,6 +58,6 @@ public:
bool isPaused() const;
void toggleSynth(Notes const& notes) { /*m_notes = (m_notes ? NULL : ¬es); */} ///< toggles synth playback
void streamFade(std::string stream_id, double level);
- unsigned int getSR() const { return 48000.0; }
+ double getSR() const { return 48000.0; }
};
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index 8836fde..246f436 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -140,6 +140,7 @@ class AudioBuffer {
bool prepare(int64_t pos) {
boost::mutex::scoped_try_lock l(m_mutex);
if (!l.owns_lock()) return false;
+ if (pos < 0) pos = 0;
m_posReq = pos;
return m_pos > m_posReq + m_data.capacity() / 4 && m_pos - m_data.size() <= m_pos;
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-19 02:47:26
|
Module: performous
Branch: portaudio
Commit: c2f54befed710fc626c5f66d32bc71c440e6f6f2
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jun 19 04:12:13 2010 +0300
Remove unused Audio::open function
---
game/audio.cc | 3 ---
game/audio.hh | 2 --
2 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index bcffa80..7fd5b5f 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -119,9 +119,6 @@ struct Audio::Impl {
Audio::Audio(): self(new Impl) {}
Audio::~Audio() {}
-void Audio::open(std::string const& pdev, std::size_t rate, std::size_t frames) {
-}
-
void Audio::play(Sample const& s, std::string const& volumeSetting) {
}
diff --git a/game/audio.hh b/game/audio.hh
index bbe5045..1585d23 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -23,8 +23,6 @@ public:
Audio();
~Audio();
boost::ptr_vector<Analyzer>& analyzers() { static boost::ptr_vector<Analyzer> ana; return ana; }
- /** Takes libda devstr and sample rate. Throws if the device fails. **/
- void open(std::string const& pdev, std::size_t rate, std::size_t frames);
/// if audio is currently playing
bool isOpen() const { return false; }
/** Play a song beginning at startPos (defaults to 0)
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-19 02:47:24
|
Module: performous
Branch: portaudio
Commit: 65b738ec82f831d249d043f18a9783b4b5f5440e
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jun 19 04:07:46 2010 +0300
Audio cleanup, fix freezing and implement pause.
---
game/audio.cc | 13 ++++++++++---
game/audio.hh | 16 ++++------------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index bc45462..bcffa80 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -74,7 +74,8 @@ struct Audio::Impl {
boost::ptr_vector<Music> playing, disposing;
portaudio::Init init;
boost::ptr_vector<portaudio::Stream> streams;
- Impl() {
+ volatile bool paused;
+ Impl(): paused(false) {
std::string dev;
streams.push_back(new portaudio::Stream(*this, portaudio::Params().channelCount(2).device(dev, true), portaudio::Params().channelCount(2).device(dev, false), 48000));
PaError err = Pa_StartStream(streams[0]);
@@ -92,6 +93,7 @@ struct Audio::Impl {
void callbackInput(float const* begin, float const* end) {}
void callbackOutput(float* begin, float* end) {
std::fill(begin, end, 0.0f);
+ if (paused) return;
for (size_t i = 0; i < playing.size();) {
bool keep = playing[i](begin, end);
// Disposing hack
@@ -139,9 +141,13 @@ void Audio::playMusic(std::string const& filename, bool preview, double fadeTime
}
void Audio::stopMusic() {
+ std::map<std::string,std::string> m;
+ playMusic(m, false, 0.0);
}
void Audio::fadeout(double fadeTime) {
+ std::map<std::string,std::string> m;
+ playMusic(m, false, fadeTime);
}
double Audio::getPosition() const {
@@ -176,10 +182,11 @@ void Audio::seekPos(double pos) {
}
void Audio::pause(bool state) {
- boost::mutex::scoped_lock l(self->mutex);
- pause(state);
+ self->paused = state;
}
+bool Audio::isPaused() const { return self->paused; }
+
void Audio::streamFade(std::string stream_id, double level) {
}
diff --git a/game/audio.hh b/game/audio.hh
index 8455836..bbe5045 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -38,8 +38,6 @@ public:
void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = -0.2);
/// plays a sample
void play(Sample const& s, std::string const& volumeSetting);
- /// get pause status
- bool isPaused() { return m_paused; }
/// stops music
void stopMusic();
/// fades music out
@@ -58,17 +56,11 @@ public:
bool isPlaying() const;
/** Get the current position. If not known or nothing is playing, NaN is returned. **/
double getPosition() const;
- void operator()(); ///< Thread runs here, don't call directly
- /// pauses and unpauses playback
- void togglePause() { pause(!m_paused); }
+ void togglePause() { pause(!isPaused()); }
void pause(bool state = true);
- /// toggles synth playback (F4)
- void toggleSynth(Notes const& notes) { m_notes = (m_notes ? NULL : ¬es); }
+ bool isPaused() const;
+ void toggleSynth(Notes const& notes) { /*m_notes = (m_notes ? NULL : ¬es); */} ///< toggles synth playback
void streamFade(std::string stream_id, double level);
- unsigned int getSR() const { return 0; }
-private:
- bool m_paused;
- Notes const* volatile m_notes;
- std::string m_volumeSetting;
+ unsigned int getSR() const { return 48000.0; }
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-18 01:20:22
|
Module: performous Branch: portaudio Commit: 0d35bcbd489e904ced0216f97fd8e16b646c8f0e Author: Lasse Karkkainen <tro...@tr...> Date: Fri Jun 18 04:20:02 2010 +0300 Merge branch 'master' into portaudio --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-18 01:20:19
|
Module: performous
Branch: portaudio
Commit: 0581ddbf861f91404644984af2e57e95feb5d845
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jun 18 04:19:39 2010 +0300
Avoid unused function warnings from Clang (which appears to be too clever)
---
game/image.hh | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/game/image.hh b/game/image.hh
index 10364ea..a30f3af 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -21,6 +21,21 @@ namespace {
void writePngHelper(png_structp pngPtr, png_bytep data, png_size_t length) {
static_cast<std::ostream*>(png_get_io_ptr(pngPtr))->write((char*)data, length);
}
+ void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
+ if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
+ png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
+ png_read_info(pngPtr, infoPtr);
+ png_set_expand(pngPtr); // Expand everything to RGB(A)
+ png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
+ png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
+ png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
+ w = png_get_image_width(pngPtr, infoPtr);
+ h = png_get_image_height(pngPtr, infoPtr);
+ image.resize(w * h * 4);
+ rows.resize(h);
+ for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
+ png_read_image(pngPtr, &rows[0]);
+ }
}
template <typename T> void loadSVG(T& target, std::string const& filename) {
@@ -51,22 +66,6 @@ template <typename T> void loadSVG(T& target, std::string const& filename) {
gdk_pixbuf_unref(pb);
}
-static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
- if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
- png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
- png_read_info(pngPtr, infoPtr);
- png_set_expand(pngPtr); // Expand everything to RGB(A)
- png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
- png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
- png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
- w = png_get_image_width(pngPtr, infoPtr);
- h = png_get_image_height(pngPtr, infoPtr);
- image.resize(w * h * 4);
- rows.resize(h);
- for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
- png_read_image(pngPtr, &rows[0]);
-}
-
template <typename T> void loadPNG(T& target, std::string const& filename) {
std::vector<unsigned char> image;
std::ifstream file(filename.c_str(), std::ios::binary);
@@ -95,6 +94,7 @@ struct my_jpeg_error_mgr {
typedef struct my_jpeg_error_mgr * my_jpeg_error_mgr_ptr;
static void my_jpeg_error_exit (j_common_ptr cinfo) {
+ (void)my_jpeg_error_exit; // Silence a compile warning about this function being unused (in some source code modules)
my_jpeg_error_mgr_ptr myerr = (my_jpeg_error_mgr_ptr) cinfo->err;
(*cinfo->err->output_message) (cinfo);
longjmp(myerr->setjmp_buffer, 1);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-18 01:20:17
|
Module: performous
Branch: portaudio
Commit: 464f5f411ffbb94cb258f68d5e85c338ce4d06a9
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jun 18 04:10:12 2010 +0300
Fix loading of RGBA paletted PNG images (and simplify the loading code).
---
docs/TODO.txt | 1 -
game/image.hh | 24 +++++++++---------------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/docs/TODO.txt b/docs/TODO.txt
index 640ed6c..7df60f1 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -65,5 +65,4 @@ Bugs:
- sample are not always played when a user fail (for example drums). it could
be nice that playing a sample reset the privious fail sample (test case :
drums rolling)
-- "Electric - Melocy Club" background and cover load incorrectly (strange PNG pixel format?)
diff --git a/game/image.hh b/game/image.hh
index fb2fd2a..10364ea 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -51,25 +51,19 @@ template <typename T> void loadSVG(T& target, std::string const& filename) {
gdk_pixbuf_unref(pb);
}
-static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h, unsigned& channels) {
+static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
png_read_info(pngPtr, infoPtr);
- png_set_expand(pngPtr);
- png_set_strip_16(pngPtr);
- png_set_gray_to_rgb(pngPtr);
+ png_set_expand(pngPtr); // Expand everything to RGB(A)
+ png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
+ png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
+ png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
w = png_get_image_width(pngPtr, infoPtr);
h = png_get_image_height(pngPtr, infoPtr);
- channels = png_get_channels(pngPtr, infoPtr);
- if (channels == 1) channels = 3; // Grayscale gets expanded to RGB
- if (channels == 2) channels = 4; // Grayscale with alpha gets expanded to RGBA
image.resize(w * h * 4);
rows.resize(h);
- unsigned pos = 0;
- for (unsigned y = 0; y < h; ++y) {
- rows[y] = reinterpret_cast<png_bytep>(&image[pos]);
- pos += (w * channels + 3) & ~3; // Rows need to be word aligned
- }
+ for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
png_read_image(pngPtr, &rows[0]);
}
@@ -88,9 +82,9 @@ template <typename T> void loadPNG(T& target, std::string const& filename) {
infoPtr = png_create_info_struct(pngPtr);
if (!infoPtr) throw std::runtime_error("png_create_info_struct failed");
std::vector<png_bytep> rows;
- unsigned w, h, channels;
- loadPNG_internal(pngPtr, infoPtr, file, image, rows, w, h, channels);
- target.load(w, h, channels == 4 ? pix::CHAR_RGBA : pix::RGB, &image[0], float(w)/h);
+ unsigned w, h;
+ loadPNG_internal(pngPtr, infoPtr, file, image, rows, w, h);
+ target.load(w, h, pix::CHAR_RGBA, &image[0], float(w)/h);
}
struct my_jpeg_error_mgr {
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-18 01:19:52
|
Module: performous
Branch: master
Commit: 0581ddbf861f91404644984af2e57e95feb5d845
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jun 18 04:19:39 2010 +0300
Avoid unused function warnings from Clang (which appears to be too clever)
---
game/image.hh | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/game/image.hh b/game/image.hh
index 10364ea..a30f3af 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -21,6 +21,21 @@ namespace {
void writePngHelper(png_structp pngPtr, png_bytep data, png_size_t length) {
static_cast<std::ostream*>(png_get_io_ptr(pngPtr))->write((char*)data, length);
}
+ void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
+ if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
+ png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
+ png_read_info(pngPtr, infoPtr);
+ png_set_expand(pngPtr); // Expand everything to RGB(A)
+ png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
+ png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
+ png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
+ w = png_get_image_width(pngPtr, infoPtr);
+ h = png_get_image_height(pngPtr, infoPtr);
+ image.resize(w * h * 4);
+ rows.resize(h);
+ for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
+ png_read_image(pngPtr, &rows[0]);
+ }
}
template <typename T> void loadSVG(T& target, std::string const& filename) {
@@ -51,22 +66,6 @@ template <typename T> void loadSVG(T& target, std::string const& filename) {
gdk_pixbuf_unref(pb);
}
-static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
- if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
- png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
- png_read_info(pngPtr, infoPtr);
- png_set_expand(pngPtr); // Expand everything to RGB(A)
- png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
- png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
- png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
- w = png_get_image_width(pngPtr, infoPtr);
- h = png_get_image_height(pngPtr, infoPtr);
- image.resize(w * h * 4);
- rows.resize(h);
- for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
- png_read_image(pngPtr, &rows[0]);
-}
-
template <typename T> void loadPNG(T& target, std::string const& filename) {
std::vector<unsigned char> image;
std::ifstream file(filename.c_str(), std::ios::binary);
@@ -95,6 +94,7 @@ struct my_jpeg_error_mgr {
typedef struct my_jpeg_error_mgr * my_jpeg_error_mgr_ptr;
static void my_jpeg_error_exit (j_common_ptr cinfo) {
+ (void)my_jpeg_error_exit; // Silence a compile warning about this function being unused (in some source code modules)
my_jpeg_error_mgr_ptr myerr = (my_jpeg_error_mgr_ptr) cinfo->err;
(*cinfo->err->output_message) (cinfo);
longjmp(myerr->setjmp_buffer, 1);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-18 01:10:42
|
Module: performous
Branch: master
Commit: 464f5f411ffbb94cb258f68d5e85c338ce4d06a9
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jun 18 04:10:12 2010 +0300
Fix loading of RGBA paletted PNG images (and simplify the loading code).
---
docs/TODO.txt | 1 -
game/image.hh | 24 +++++++++---------------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/docs/TODO.txt b/docs/TODO.txt
index 640ed6c..7df60f1 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -65,5 +65,4 @@ Bugs:
- sample are not always played when a user fail (for example drums). it could
be nice that playing a sample reset the privious fail sample (test case :
drums rolling)
-- "Electric - Melocy Club" background and cover load incorrectly (strange PNG pixel format?)
diff --git a/game/image.hh b/game/image.hh
index fb2fd2a..10364ea 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -51,25 +51,19 @@ template <typename T> void loadSVG(T& target, std::string const& filename) {
gdk_pixbuf_unref(pb);
}
-static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h, unsigned& channels) {
+static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h) {
if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
png_read_info(pngPtr, infoPtr);
- png_set_expand(pngPtr);
- png_set_strip_16(pngPtr);
- png_set_gray_to_rgb(pngPtr);
+ png_set_expand(pngPtr); // Expand everything to RGB(A)
+ png_set_strip_16(pngPtr); // Strip everything down to 8 bit/component
+ png_set_gray_to_rgb(pngPtr); // Convert even grayscale to RGB(A)
+ png_set_filler(pngPtr, 0xFF, PNG_FILLER_AFTER); // Add alpha channel if it is missing
w = png_get_image_width(pngPtr, infoPtr);
h = png_get_image_height(pngPtr, infoPtr);
- channels = png_get_channels(pngPtr, infoPtr);
- if (channels == 1) channels = 3; // Grayscale gets expanded to RGB
- if (channels == 2) channels = 4; // Grayscale with alpha gets expanded to RGBA
image.resize(w * h * 4);
rows.resize(h);
- unsigned pos = 0;
- for (unsigned y = 0; y < h; ++y) {
- rows[y] = reinterpret_cast<png_bytep>(&image[pos]);
- pos += (w * channels + 3) & ~3; // Rows need to be word aligned
- }
+ for (unsigned y = 0; y < h; ++y) rows[y] = reinterpret_cast<png_bytep>(&image[y * w * 4]);
png_read_image(pngPtr, &rows[0]);
}
@@ -88,9 +82,9 @@ template <typename T> void loadPNG(T& target, std::string const& filename) {
infoPtr = png_create_info_struct(pngPtr);
if (!infoPtr) throw std::runtime_error("png_create_info_struct failed");
std::vector<png_bytep> rows;
- unsigned w, h, channels;
- loadPNG_internal(pngPtr, infoPtr, file, image, rows, w, h, channels);
- target.load(w, h, channels == 4 ? pix::CHAR_RGBA : pix::RGB, &image[0], float(w)/h);
+ unsigned w, h;
+ loadPNG_internal(pngPtr, infoPtr, file, image, rows, w, h);
+ target.load(w, h, pix::CHAR_RGBA, &image[0], float(w)/h);
}
struct my_jpeg_error_mgr {
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:40:44
|
Module: performous Branch: portaudio Commit: 946c2c09a98dd899e734360d2a71a6269c70fd5e Author: Lasse Karkkainen <tro...@tr...> Date: Fri Jun 18 01:39:52 2010 +0300 Merge branch 'master' into portaudio Conflicts: game/screen_sing.hh libs/libda/plugins/alsa/alsa.hpp --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:40:41
|
Module: performous Branch: portaudio Commit: 77e92c7764be98f665c65312306483f0ce7e4a01 Author: Lasse Karkkainen <tro...@tr...> Date: Fri Jun 18 01:32:29 2010 +0300 Apparently there is no such bug but I identified it incorrectly, removing from TODO. --- docs/TODO.txt | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/docs/TODO.txt b/docs/TODO.txt index b6caa40..640ed6c 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -66,5 +66,4 @@ Bugs: be nice that playing a sample reset the privious fail sample (test case : drums rolling) - "Electric - Melocy Club" background and cover load incorrectly (strange PNG pixel format?) -- filter update on song loading |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:40:36
|
Module: performous
Branch: portaudio
Commit: bf2c4bdf7f07a2edf9551502ec7cdec6ea031335
Author: Felix Bertram <fl...@be...>
Date: Mon Jun 7 21:33:29 2010 -0700
Implementation of practice mode (drums only)
- holds game at failed chord
- resumes audio once chord is completed
- to enable: set m_practmode = true in screen_sing.c
---
game/guitargraph.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++------
game/guitargraph.hh | 4 +++-
game/screen_sing.cc | 12 +++++++++---
game/screen_sing.hh | 3 ++-
4 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index bc6e929..5a1e122 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -57,7 +57,7 @@ namespace {
inline float blend(float a, float b, float f) { return a*f + b*(1.0f-f); }
}
-GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number):
+GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number, bool practmode):
InstrumentGraph(audio, song, drums ? input::DRUMS : input::GUITAR),
m_button(getThemePath("button.svg")),
m_tail(getThemePath("tail.svg")),
@@ -71,6 +71,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number)
m_drums(drums),
m_use3d(config["graphic/3d_notes"].b()),
m_leftymode(false),
+ m_practmode(practmode),
m_level(),
m_track_index(m_instrumentTracks.end()),
m_dfIt(m_drumfills.end()),
@@ -84,7 +85,8 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number)
m_drumfillScore(),
m_soloTotal(),
m_soloScore(),
- m_solo()
+ m_solo(),
+ m_practHold(false)
{
// Copy all tracks of supported types (either drums or non-drums) to m_instrumentTracks
for (InstrumentTracks::const_iterator it = m_song.instrumentTracks.begin(); it != m_song.instrumentTracks.end(); ++it) {
@@ -248,10 +250,32 @@ void GuitarGraph::engine() {
}
// Countdown to start
handleCountdown(time, time < getNotesBeginTime() ? getNotesBeginTime() : m_jointime+1);
+
+ // FIXME: this is a band aid to release m_practHold
+ // this may happen in conjunction with the regular pause feature
+ if (m_practHold && !m_audio.isPaused()) m_practHold = false;
+
// Skip missed notes
- while (m_chordIt != m_chords.end() && m_chordIt->begin + maxTolerance < time) {
+ // we hold the note a litle bit *before* they go out of the tolerance window
+ // this is important in order for the hit-detection to still accept the notes
+ // FIXME: need to confirm that this timing is reliable,
+ // if a note gets marked as 'past' completing the chord does not re-start the song
+ double past = time - maxTolerance + (m_practmode ? 0.05 : 0.0);
+ while (!m_practHold && m_chordIt != m_chords.end() && m_chordIt->begin < past) {
if ( (m_drums && m_chordIt->status != m_chordIt->polyphony)
- || (!m_drums && m_chordIt->status == 0) ) endStreak();
+ || (!m_drums && m_chordIt->status == 0) ) {
+ endStreak();
+ if (m_practmode && !dead()) {
+ // in practice mode hold the chord here
+ // m_chordIt must not change until finishing the chord
+ m_audio.seekPos(m_chordIt->begin);
+ m_audio.pause(true);
+ m_practHold = true;
+ endStreak();
+ std::cout << "practice: hold chord at " << m_chordIt->begin << ", status = "<< m_chordIt->status << std::endl;
+ break;
+ }
+ }
// Calculate solo total score
if (m_solo) { m_soloScore += m_chordIt->score; m_soloTotal += m_chordIt->polyphony * points(0);
// Solo just ended?
@@ -264,6 +288,18 @@ void GuitarGraph::engine() {
++m_dead;
++m_chordIt;
}
+
+ // just finished a chord in practice mode
+ if (m_practHold &&
+ ( (m_drums && m_chordIt->status == m_chordIt->polyphony)
+ || (!m_drums && m_chordIt->status != 0) ) ) {
+ // now we have completed the chord
+ // m_chordIt must not change from holding the chord until we get here
+ if (m_audio.isPaused()) m_audio.togglePause();
+ m_practHold = false;
+ std::cout << "practice: finish chord at " << m_chordIt->begin << std::endl;
+ }
+
if (difficulty_changed) m_dead = 0; // if difficulty is changed, m_dead would get incorrect
// Adjust the correctness value
if (!m_events.empty() && m_events.back().type == 0) m_correctness.setTarget(0.0, true);
@@ -451,16 +487,18 @@ void GuitarGraph::drumHit(double time, int fret) {
// in kiddy mode we don't care about the correct pad
// all that matters is that there is still a missing note in that chord
if (m_chordIt->status == m_chordIt->polyphony) continue;
- } else if (m_notes[it->dur[fret]]) continue; // invalid fret/hit or already played
+ } else if ((!it->dur[fret]) || (m_notes[it->dur[fret]])) continue; // invalid fret/hit or already played
double error = std::abs(it->begin - time);
if (error < tolerance) {
best = it;
tolerance = error;
signed_error = it->begin - time;
+ if (m_practHold) break; // during practice hold the chord will always be m_chordIt
}
}
- if (best == m_chords.end()) fail(time, fret); // None found
+ if ((best == m_chords.end())
+ || (m_practHold && best != m_chordIt)) fail(time, fret); // None found
else {
// Skip all chords earlier than the best fit chord
for (; best != m_chordIt; ++m_chordIt) {
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 37db183..ed8b931 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -52,7 +52,7 @@ static inline bool operator==(Chord const& a, Chord const& b) {
class GuitarGraph: public InstrumentGraph {
public:
/// constructor
- GuitarGraph(Audio& audio, Song const& song, bool drums, int number);
+ GuitarGraph(Audio& audio, Song const& song, bool drums, int number, bool practmode=false);
/** draws GuitarGraph
* @param time at which time to draw
*/
@@ -97,6 +97,7 @@ class GuitarGraph: public InstrumentGraph {
bool m_drums; /// are we using drums?
bool m_use3d; /// are we using 3d?
bool m_leftymode; /// switch guitar notes to right-to-left direction
+ bool m_practmode; /// switch to enable practice mode
// Track stuff
enum Difficulty {
@@ -148,5 +149,6 @@ class GuitarGraph: public InstrumentGraph {
double m_soloTotal; /// maximum solo score
double m_soloScore; /// score during solo
bool m_solo; /// are we currently playing a solo
+ bool m_practHold; /// true if holding a chord during practice
};
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 6f62d8b..dd822f3 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -30,6 +30,7 @@ namespace {
}
void ScreenSing::enter() {
+ //m_practmode = true; // un-comment this line to play with practice mode. temporary, of course!
ScreenManager* sm = ScreenManager::getSingletonPtr();
sm->flashMessage(_("Loading song..."), 0.0, 1.0, 0.5);
sm->drawFlashMessage(); sm->window().swap(); // Make loading message show
@@ -97,7 +98,7 @@ void ScreenSing::enter() {
if (type == 3) break;
}
if (type == 0) m_dancers.push_back(new DanceGraph(m_audio, *m_song));
- else m_instruments.push_back(new GuitarGraph(m_audio, *m_song, type == 2, idx));
+ else m_instruments.push_back(new GuitarGraph(m_audio, *m_song, type == 2, idx, m_practmode));
++idx;
} catch (input::NoDevError&) {
++type;
@@ -401,8 +402,13 @@ void ScreenSing::draw() {
}
if (m_audio.isPaused()) {
- m_pause_icon->dimensions.middle().center().fixedWidth(.32);
- m_pause_icon->draw();
+ if (!m_practmode) {
+ m_pause_icon->dimensions.middle().center().fixedWidth(.32);
+ m_pause_icon->draw();
+ } else {
+ // we get here when the song is on hold during practice
+ // TODO: display some (small) info screen here
+ }
}
}
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index 5ba012d..c743877 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)
+ Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true), m_practmode(false)
{}
void enter();
void exit();
@@ -92,5 +92,6 @@ class ScreenSing: public Screen {
boost::shared_ptr<ThemeSing> theme;
AnimValue m_quitTimer;
bool m_only_singers_alive;
+ bool m_practmode;
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:40:31
|
Module: performous Branch: portaudio Commit: c6feab63884bbbdde338b8059559bffc89921856 Author: Tapio Vierros <tap...@gm...> Date: Sat Jun 5 11:56:52 2010 +0300 Set all theme file permissions to 644 (some had +x). --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/themes/default/intro_configure.svg b/themes/default/intro_configure.svg old mode 100755 new mode 100644 diff --git a/themes/default/menu_comment.svg b/themes/default/menu_comment.svg old mode 100755 new mode 100644 diff --git a/themes/default/menu_option_selected.svg b/themes/default/menu_option_selected.svg old mode 100755 new mode 100644 diff --git a/themes/default/message_text.svg b/themes/default/message_text.svg old mode 100755 new mode 100644 |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:40:28
|
Module: performous
Branch: portaudio
Commit: 1f8f046877aef2e6a148b5afe9578e8d20f1bfc9
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun May 30 20:38:29 2010 +0300
Revert the workaround in engine.hh (no longer needed as the bug in clang++ was fixed).
---
game/engine.hh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/engine.hh b/game/engine.hh
index a164931..f1c7882 100644
--- a/game/engine.hh
+++ b/game/engine.hh
@@ -54,7 +54,7 @@ class Engine {
size_t player = 0;
for (std::list<Player>::iterator it = m_database.cur.begin(); it != m_database.cur.end(); ++it, ++player) it->m_color = playerColors[player % playerColorsSize];
}
- m_thread.reset(new boost::thread(&Engine::operator(), this));
+ m_thread.reset(new boost::thread(boost::ref(*this)));
}
~Engine() { kill(); }
/// Terminates processing
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-06-17 22:32:46
|
Module: performous Branch: master Commit: 77e92c7764be98f665c65312306483f0ce7e4a01 Author: Lasse Karkkainen <tro...@tr...> Date: Fri Jun 18 01:32:29 2010 +0300 Apparently there is no such bug but I identified it incorrectly, removing from TODO. --- docs/TODO.txt | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/docs/TODO.txt b/docs/TODO.txt index b6caa40..640ed6c 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -66,5 +66,4 @@ Bugs: be nice that playing a sample reset the privious fail sample (test case : drums rolling) - "Electric - Melocy Club" background and cover load incorrectly (strange PNG pixel format?) -- filter update on song loading |