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: Arto Seppä <za...@us...> - 2010-08-19 15:59:43
|
Module: performous Branch: master Commit: 585f32044b561b4e35acf22eee9abeabe2a5e801 Author: Arto Seppä <za...@us...> Date: Thu Aug 19 09:29:25 2010 +0300 Fixed the bundling script to check for dylibbundler and to create a disk image. --- osx-utils/performous-app-build.sh | 45 ++++++++++++++++++++++++------------ 1 files changed, 30 insertions(+), 15 deletions(-) diff --git a/osx-utils/performous-app-build.sh b/osx-utils/performous-app-build.sh index f775964..6f66224 100755 --- a/osx-utils/performous-app-build.sh +++ b/osx-utils/performous-app-build.sh @@ -1,24 +1,39 @@ +# the very first step is to check that dylibbundler exists, +# without it the bundle would be broken +if which dylibbundler &> /dev/null; then + echo "dylibbundler found!" +else + echo "dylibbundler not found! you need to install it before creating the bundle." + exit +fi + +# first compile performous, build dir shouldn't exist at this stage mkdir build cd build -cmake ../../ -DCMAKE_INSTALL_PREFIX=./Performous.app/Contents +cmake ../../ -DCMAKE_INSTALL_PREFIX=./out/Performous.app/Contents make install -mkdir Performous.app/Contents/MacOS -mkdir Performous.app/Contents/Resources -mkdir Performous.app/Contents/Frameworks +# then create the rest of the app bundle + +mkdir out/Performous.app/Contents/MacOS +mkdir out/Performous.app/Contents/Resources +mkdir out/Performous.app/Contents/Frameworks + +mv out/Performous.app/Contents/bin/* out/Performous.app/Contents/MacOS/ -mv Performous.app/Contents/bin/* Performous.app/Contents/MacOS/ +cp ../resources/performous-launcher out/Performous.app/Contents/MacOS/ +cp ../resources/performous.icns out/Performous.app/Contents/Resources +cp ../resources/Info.plist out/Performous.app/Contents/ +cp -R ../resources/etc out/Performous.app/Contents/Resources -cp ../resources/performous-launcher Performous.app/Contents/MacOS/ -cp ../resources/performous.icns Performous.app/Contents/Resources -cp ../resources/Info.plist Performous.app/Contents/ -cp -R ../resources/etc Performous.app/Contents/Resources +cp -R /Library/Frameworks/SDL.framework out/Performous.app/Contents/Frameworks/SDL.framework -cp -R /Library/Frameworks/SDL.framework Performous.app/Contents/Frameworks/SDL.framework +dylibbundler -od -b -x ./out/Performous.app/Contents/MacOS/performous -d ./out/Performous.app/Contents/libs/ -dylibbundler -od -b -x ./Performous.app/Contents/MacOS/performous -d ./Performous.app/Contents/libs/ -dylibbundler -of -b -x ./Performous.app/Contents/lib/performous/libda-1/libda_audio_dev_jack.so -d ./Performous.app/Contents/libs -dylibbundler -of -b -x ./Performous.app/Contents/lib/performous/libda-1/libda_audio_dev_pa19.so -d ./Performous.app/Contents/libs -dylibbundler -of -b -x ./Performous.app/Contents/lib/performous/libda-1/libda_audio_dev_tone.so -d ./Performous.app/Contents/libs +# then build the disk image +ln -sf /Applications out/Applications +/usr/bin/hdiutil create -srcfolder out -volname Performous -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW RWPerformous.dmg +/usr/bin/hdiutil convert RWPerformous.dmg -format UDZO -imagekey zlib-level=9 -o Performous.dmg +rm -f RWPerformous.dmg -cd .. +cd .. \ No newline at end of file |
|
From: Arto Seppä <za...@us...> - 2010-08-19 15:59:40
|
Module: performous Branch: master Commit: 84be6b91c9f4a19ca47f0ca4f947e1cb2ed19aea Author: Arto Seppä <za...@us...> Date: Wed Aug 18 20:35:03 2010 +0300 Removed some paths from fontconfig. --- osx-utils/resources/etc/fonts/fonts.conf | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/osx-utils/resources/etc/fonts/fonts.conf b/osx-utils/resources/etc/fonts/fonts.conf index 377f3e8..ce5d6fe 100644 --- a/osx-utils/resources/etc/fonts/fonts.conf +++ b/osx-utils/resources/etc/fonts/fonts.conf @@ -24,7 +24,7 @@ <!-- Font directory list --> <dir>/usr/share/fonts</dir> - <dir>/usr/X11R6/lib/X11/fonts</dir> <dir>/Library/Fonts</dir> <dir>/Network/Library/Fonts</dir> <dir>/System/Library/Fonts</dir> <dir>/opt/local/padpadpadpad/share/fonts</dir> + <dir>/usr/X11R6/lib/X11/fonts</dir> <dir>/Library/Fonts</dir> <dir>/Network/Library/Fonts</dir> <dir>/System/Library/Fonts</dir> <dir>~/.fonts</dir> <!-- @@ -70,7 +70,6 @@ <!-- Font cache directory list --> - <cachedir>/opt/local/padpadpadpad/var/cache/fontconfig</cachedir> <cachedir>~/.fontconfig</cachedir> <config> |
|
From: Yoda-JM <yo...@us...> - 2010-08-19 15:33:43
|
Module: performous Branch: master Commit: d69e773b065219125eb19580243b320f35109db5 Author: Vincent Le Ligeour <yo...@us...> Date: Thu Aug 19 17:26:41 2010 +0200 Modified documentation according to new stuffs --- docs/Compiling.txt | 11 +++-------- docs/DeveloperReadme.txt | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/Compiling.txt b/docs/Compiling.txt index ef02a4b..62237c9 100644 --- a/docs/Compiling.txt +++ b/docs/Compiling.txt @@ -29,17 +29,12 @@ Dependencies: - libxml++ : XML parser, used for themes etc. - - Magick++ : loading images (some internal graphics and song cover/bg) - - - One or more of the following for audio capture and playback - * ALSA - * GStreamer - * JACK - * PortAudio v18 or v19 - * Pulseaudio + - PortAudio v19 : audio capture and playback - PortMidi (optional) for MIDI drum support + - OpenCV (optional) for webcam support + Please refer to http://performous.org/develop.html for packages to install. diff --git a/docs/DeveloperReadme.txt b/docs/DeveloperReadme.txt index f061f32..6ebe040 100644 --- a/docs/DeveloperReadme.txt +++ b/docs/DeveloperReadme.txt @@ -3,7 +3,6 @@ Where to find the files you are looking for: share/ icons and other such binary files themes/ all graphics, menu music, etc game/ the source code of the game -libda/ the source code of libda (the audio I/O library) When adding new data files, you may need to edit the CMakeLists.txt file in that folder to have CMake actually install it. When adding new source code files, @@ -26,7 +25,7 @@ You may currently access ScreenManager by a singleton, but this is discouraged and the singleton is to be removed because singletons are evil (but it is not buggy at the moment, so we are not rushing that). -Notes of the song and TXT file parsing are in song.cc/hh. +Notes of the song and music file parsing are in songparser*.cc/hh. Most other files either implement little helpers for loading and displaying images (surface), playing sound (audio), decoding video/audio (ffmpeg), |
|
From: Tapio V. <aa...@us...> - 2010-08-19 14:30:52
|
Module: performous
Branch: master
Commit: 9cd1bf961dac4b8ec59dd8445eebb05a73655ec3
Author: Tapio Vierros <tap...@gm...>
Date: Thu Aug 19 17:29:07 2010 +0300
Make suggestedLatency configurable.
---
data/schema.xml | 8 ++++++++
game/audio.cc | 3 ++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 6f7650f..bd0152a 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -161,6 +161,14 @@ to save the current settings to XML.
</entry>
<!-- Audio preferences -->
+ <entry name="audio/latency" type="float" value="0.05">
+ <ui unit=" ms" multiplier="1000" />
+ <limits min="0.0" max="0.25" step="0.005" />
+ <locale name="C">
+ <short>Suggested latency</short>
+ <long>This is a hint for the audio engine about the desired latency. Set this as low as possible while retaining clear audio playback. Requires restart.</long>
+ </locale>
+ </entry>
<entry name="audio/video_delay" type="float" value="0.06">
<ui unit=" ms" multiplier="1000" />
<limits min="-0.5" max="0.5" step="0.01" />
diff --git a/game/audio.cc b/game/audio.cc
index f86e728..9bae54f 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -325,7 +325,8 @@ struct Device {
Device(unsigned int in, unsigned int out, double rate, unsigned int dev):
in(in), out(out), rate(rate), dev(dev),
- stream(*this, in ? portaudio::Params().channelCount(in).device(dev) : (const PaStreamParameters*)NULL, (out ? portaudio::Params().channelCount(out).device(dev) : (const PaStreamParameters*)NULL), rate),
+ stream(*this, in ? portaudio::Params().channelCount(in).device(dev).suggestedLatency(config["audio/latency"].f()): (const PaStreamParameters*)NULL,
+ (out ? portaudio::Params().channelCount(out).device(dev).suggestedLatency(config["audio/latency"].f()) : (const PaStreamParameters*)NULL), rate),
outptr()
{
mics.resize(in);
|
|
From: Tapio V. <aa...@us...> - 2010-08-19 14:11:27
|
Module: performous
Branch: pass-through
Commit: 36e8ba88cdb79b06903656990bb29a1155d980ff
Author: Tapio Vierros <tap...@gm...>
Date: Thu Aug 19 17:08:07 2010 +0300
Implement microphone pass-through in audio engine.
* No way to disable it, it even invades menus.
* Requires very low suggestedLatency (so some platforms are probably b0rked).
---
game/audio.cc | 13 +++++++++++++
game/libda/portaudio.hpp | 2 +-
game/pitch.cc | 18 ++++++++++++++++++
game/pitch.hh | 15 ++++++++++++++-
4 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index f86e728..a9ae880 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -246,6 +246,7 @@ struct Output {
std::auto_ptr<Synth> synth;
std::auto_ptr<Music> preloading;
boost::ptr_vector<Music> playing, disposing;
+ std::vector<Analyzer*> mics;
boost::ptr_map<std::string, Sample> samples;
std::vector<Command> commands;
volatile bool paused;
@@ -294,6 +295,15 @@ struct Output {
}
++i;
}
+ // Mix in microphones (if pass-through is enabled)
+ // TODO: Create a config var for enable/disable
+ if (mics.size() > 0) {
+ for (float *i = begin; i < end; ++i) *i *= 0.3; // Decrease music volume
+ for (size_t i = 0; i < mics.size(); ++i) {
+ if (mics[i])
+ mics[i]->output(begin, end); // Do the actual mixing
+ }
+ }
// Mix in the samples currently playing
{
// samples should not be created/destroyed on the fly
@@ -454,6 +464,9 @@ struct Audio::Impl {
std::cerr << "Audio device '" << *it << "': " << e.what() << std::endl;
}
}
+ // Assign mic buffers to the output for pass-through
+ for (size_t i = 0; i < analyzers.size(); ++i)
+ output.mics.push_back(&analyzers[i]);
}
};
diff --git a/game/libda/portaudio.hpp b/game/libda/portaudio.hpp
index 4211545..91aa525 100644
--- a/game/libda/portaudio.hpp
+++ b/game/libda/portaudio.hpp
@@ -44,7 +44,7 @@ namespace portaudio {
PaStreamParameters params;
Params(PaStreamParameters const& init = PaStreamParameters()): params(init) {
// Some useful defaults so that things just work
- channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.05);
+ channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.01);
}
Params& channelCount(int val) { params.channelCount = val; return *this; }
Params& device(PaDeviceIndex val) { params.device = val; return *this; }
diff --git a/game/pitch.cc b/game/pitch.cc
index 773183a..0428bcf 100644
--- a/game/pitch.cc
+++ b/game/pitch.cc
@@ -47,6 +47,24 @@ Analyzer::Analyzer(double rate, std::size_t step):
}
}
+void Analyzer::output(float* begin, float* end) {
+ size_t frames = end - begin;
+ if (frames > outbuf.size() * 2) return;
+ size_t i = 0;
+ boost::mutex::scoped_lock l(m_mutex);
+ while (begin != end) {
+ float value = outbuf[i] * 15.0; // Amplify
+ *begin++ += value; // L channel
+ *begin++ += value; // R channel
+ ++i;
+ }
+ // Remove used data from the buffer
+ outbuf.erase(outbuf.begin(), outbuf.begin() + frames/2);
+ // If the ouput buffer grows very big, reset it
+ if (outbuf.size() > 5000) outbuf.clear();
+}
+
+
namespace {
bool sqrLT(float a, float b) { return a * a < b * b; }
diff --git a/game/pitch.hh b/game/pitch.hh
index 0fa159d..8b50021 100644
--- a/game/pitch.hh
+++ b/game/pitch.hh
@@ -3,8 +3,10 @@
#include <complex>
#include <vector>
#include <list>
+#include <deque>
#include <algorithm>
#include <cmath>
+#include <boost/thread.hpp>
/// struct to represent tones
struct Tone {
@@ -15,7 +17,7 @@ struct Tone {
double stabledb; ///< stable decibels
double harmonics[MAXHARM]; ///< harmonics array
std::size_t age; ///< age
- Tone();
+ Tone();
void print() const; ///< prints Tone
bool operator==(double f) const; ///< equality operator
void update(Tone const& t); ///< update Tone
@@ -47,8 +49,11 @@ class Analyzer {
Analyzer(double rate, std::size_t step = 200);
/** Add input data to buffer. This is thread-safe (against other functions). **/
template <typename InIt> void input(InIt begin, InIt end) {
+ std::vector<float> tempbuf; // Values to be inserted to the pass-through buffer
+ tempbuf.reserve(1024); // Let's reserve some space already in advance
while (begin != end) {
float s = *begin;
+ tempbuf.push_back(s); // Add to pass-through buffer
++begin;
m_peak *= 0.999;
float p = s * s;
@@ -60,6 +65,10 @@ class Analyzer {
m_buf[w] = s;
m_bufWrite = w2;
}
+ // No need to lock the mutex before this
+ boost::mutex::scoped_lock l(m_mutex);
+ // Insert the new values to the pass-through buffer
+ outbuf.insert(outbuf.end(), tempbuf.begin(), tempbuf.end());
}
/** Call this to process all data input so far. **/
void process();
@@ -87,8 +96,12 @@ class Analyzer {
m_oldfreq = (best ? best->freq : 0.0);
return best;
}
+ /** Give data away for mic pass-through */
+ void output(float* begin, float* end);
private:
+ boost::mutex m_mutex;
+ std::deque<float> outbuf;
std::size_t m_step;
double m_rate;
std::vector<float> m_window;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-19 06:37:29
|
Module: performous Branch: master Commit: 9be568cc22e8fe09d4b6bcb7635aa0885d4b19d6 Author: Lasse Karkkainen <tro...@tr...> Date: Thu Aug 19 09:37:10 2010 +0300 Merge branch 'master' of ssh://git.performous.org/gitroot/performous/performous --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-19 06:37:24
|
Module: performous
Branch: master
Commit: ee8ce1a3eb50a62438480265549d8299a28c28f0
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Aug 19 09:10:04 2010 +0300
Fix missing virtual destructor warning in InstrumentGraph.
---
game/instrumentgraph.hh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 7bc6ab8..b1e8bbb 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -76,7 +76,8 @@ class InstrumentGraph {
{
m_popupText.reset(new SvgTxtThemeSimple(getThemePath("sing_popup_text.svg"), config["graphic/text_lod"].f()));
};
-
+ virtual ~InstrumentGraph() {}
+
// Interface functions
virtual void draw(double time) = 0;
virtual void engine() = 0;
|
|
From: Tapio V. <aa...@us...> - 2010-08-18 17:46:51
|
Module: performous
Branch: master
Commit: cc83a0a46e68dcbede89d7cad00e50ab85ab42c6
Author: Tapio Vierros <tap...@gm...>
Date: Wed Aug 18 20:45:03 2010 +0300
Framework for pitch shifter guitar whammy bar audio effect.
Actual algorithm is missing, and the whammy value computation needs some tuning / AnimValue.
---
game/audio.cc | 58 +++++++++++++++++++++++++++++++++++++++++-----
game/audio.hh | 3 ++
game/guitargraph.cc | 11 +++++----
game/guitargraph.hh | 2 +
game/instrumentgraph.hh | 1 +
game/screen_sing.cc | 20 +++++++++++++---
6 files changed, 79 insertions(+), 16 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 84fdc7c..f86e728 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -15,6 +15,9 @@
using namespace boost::posix_time;
namespace {
+ /**
+ * A function to parse key=value pairs with quoting capabilites.
+ */
std::map<std::string, std::string> parseKeyValuePairs(const std::string& st) {
std::map<std::string, std::string> ret;
bool inside_quotes = false;
@@ -49,13 +52,26 @@ namespace {
if (!key.empty()) ret[key] = value;
return ret;
}
+
+ /**
+ * Pitch shifter.
+ * @param begin start of the buffer
+ * @param end end of the buffer
+ * @param factor shift factor from 0 (no shift) to 1 (maximum)
+ */
+ template <typename It> void PitchShift(It begin, It end, double factor) {
+ //FIXME: Dummy volume bender
+ for (It i = begin; i != end; ++i)
+ *i *= factor * factor; // Decrease music volume
+ }
}
class Music {
struct Track {
FFmpeg mpeg;
float fadeLevel;
- Track(std::string const& filename, unsigned int sr): mpeg(false, true, filename, sr), fadeLevel(1.0f) {}
+ float pitchFactor;
+ Track(std::string const& filename, unsigned int sr): mpeg(false, true, filename, sr), fadeLevel(1.0f), pitchFactor(0.0f) {}
};
typedef boost::ptr_map<std::string, Track> Tracks;
Tracks tracks; ///< Audio decoders
@@ -82,6 +98,7 @@ public:
double fadeLevel;
double fadeRate;
typedef std::map<std::string,std::string> Files;
+ typedef std::vector<float> Buffer;
Music(Files const& filenames, unsigned int sr, bool preview):
srate(sr), m_pos(), m_baseTime(getTime()),
m_preview(preview), fadeLevel(), fadeRate() {
@@ -95,10 +112,23 @@ public:
size_t samples = end - begin;
timeSync(samples); // Keep audio synced
bool eof = true;
- std::vector<float> mixbuf(end - begin);
+ Buffer mixbuf(end - begin);
for (Tracks::iterator it = tracks.begin(), itend = tracks.end(); it != itend; ++it) {
Track& t = *it->second;
- if (t.mpeg.audioQueue(&*mixbuf.begin(), &*mixbuf.end(), m_pos, t.fadeLevel)) eof = false;
+// if (it->first == "guitar") std::cout << t.pitchFactor << std::endl;
+ if (t.pitchFactor != 0) { // Pitch shift
+ Buffer tempbuf(end - begin);
+ // Get audio to temp buffer
+ if (t.mpeg.audioQueue(&*tempbuf.begin(), &*tempbuf.end(), m_pos, t.fadeLevel)) eof = false;
+ // Do the magic
+ PitchShift(&*tempbuf.begin(), &*tempbuf.end(), t.pitchFactor);
+ // Mix with other tracks
+ Buffer::iterator m = mixbuf.begin();
+ Buffer::iterator b = tempbuf.begin();
+ while (b != tempbuf.end())
+ *m++ += (*b++);
+ // Otherwise just get the audio and mix it straight away
+ } else if (t.mpeg.audioQueue(&*mixbuf.begin(), &*mixbuf.end(), m_pos, t.fadeLevel)) eof = false;
}
m_pos += samples;
for (size_t i = 0, iend = mixbuf.size(); i != iend; ++i) {
@@ -138,6 +168,11 @@ public:
if (it == tracks.end()) return;
it->second->fadeLevel = fadeLevel;
}
+ void trackPitchBend(std::string const& name, double pitchFactor) {
+ Tracks::iterator it = tracks.find(name);
+ if (it == tracks.end()) return;
+ it->second->pitchFactor = pitchFactor;
+ }
};
struct Sample {
@@ -198,11 +233,10 @@ struct Synth {
}
};
-
struct Command {
- enum { TRACK_FADE, SAMPLE_RESET } type;
+ enum { TRACK_FADE, TRACK_PITCHBEND, SAMPLE_RESET } type;
std::string track;
- double fadeLevel;
+ double factor;
};
struct Output {
@@ -230,7 +264,10 @@ struct Output {
Command const& cmd = commands[i];
switch (cmd.type) {
case Command::TRACK_FADE:
- if (!playing.empty()) playing[0].trackFade(cmd.track, cmd.fadeLevel);
+ if (!playing.empty()) playing[0].trackFade(cmd.track, cmd.factor);
+ break;
+ case Command::TRACK_PITCHBEND:
+ if (!playing.empty()) playing[0].trackPitchBend(cmd.track, cmd.factor);
break;
case Command::SAMPLE_RESET:
boost::ptr_map<std::string, Sample>::iterator it = samples.find(cmd.track);
@@ -529,6 +566,13 @@ void Audio::streamFade(std::string track, double fadeLevel) {
o.commands.push_back(cmd);
}
+void Audio::streamBend(std::string track, double pitchFactor) {
+ Output& o = self->output;
+ boost::mutex::scoped_lock l(o.mutex);
+ Command cmd = { Command::TRACK_PITCHBEND, track, pitchFactor };
+ o.commands.push_back(cmd);
+}
+
void Audio::toggleSynth(Notes const& notes) {
Output& o = self->output;
boost::mutex::scoped_lock l(o.synth_mutex);
diff --git a/game/audio.hh b/game/audio.hh
index 09c1657..15b9ba4 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -59,6 +59,9 @@ public:
void toggleSynth(Notes const&);
/** Adjust volume level of a single track (used for muting incorrectly played instruments). Range 0.0 to 1.0. **/
void streamFade(std::string track, double volume);
+ /** Do a pitch shift - used for guitar whammy bar */
+ void streamBend(std::string track, double pitchFactor);
+ /** Get sample rate */
double getSR() const { return 48000.0; }
};
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index e167176..7815d55 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -85,7 +85,8 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number,
m_soloTotal(),
m_soloScore(),
m_solo(),
- m_practHold(false)
+ m_practHold(false),
+ m_whammy(0)
{
// 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) {
@@ -192,7 +193,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 (joining(time)) m_dead = 0; // Disable dead counting while joining
- double whammy = 0;
+ m_whammy = 0;
bool difficulty_changed = false;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
@@ -213,7 +214,7 @@ void GuitarGraph::engine() {
continue;
}
if (ev.type == input::Event::RELEASE) endHold(ev.button, time);
- if (ev.type == input::Event::WHAMMY) whammy = (1.0 + ev.button + 2.0*(rand()/double(RAND_MAX))) / 4.0;
+ if (ev.type == input::Event::WHAMMY) m_whammy = (1.0 + ev.button + 2.0*(rand()/double(RAND_MAX))) / 4.0;
} else {
// Handle drum lefty-mode
if (m_leftymode && ev.button > 0) ev.button = m_pads - ev.button;
@@ -314,8 +315,8 @@ void GuitarGraph::engine() {
Event& ev = m_events[m_holds[fret] - 1];
ev.glow.setTarget(1.0, true);
// Whammy animvalue mangling
- ev.whammy.setTarget(whammy);
- if (whammy > 0) {
+ ev.whammy.setTarget(m_whammy);
+ if (m_whammy > 0) {
ev.whammy.move(0.5);
if (ev.whammy.get() > 1.0) ev.whammy.setValue(1.0);
}
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 1067746..2ac6ab7 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -54,6 +54,7 @@ class GuitarGraph: public InstrumentGraph {
bool dead() const;
std::string getTrack() const { return m_track_index->first; }
std::string getDifficultyString() const;
+ double getWhammy() const { return m_whammy; }
private:
// Engine / scoring utils
@@ -142,5 +143,6 @@ class GuitarGraph: public InstrumentGraph {
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
+ double m_whammy; /// whammy value for pitch shift
};
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 7bc6ab8..0627cf2 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -89,6 +89,7 @@ class InstrumentGraph {
unsigned stream() const { return m_stream; }
double correctness() const { return m_correctness.get(); }
int getScore() const { return (m_score > 0 ? m_score : 0) * m_scoreFactor; }
+ virtual double getWhammy() const { return 0; }
protected:
// Core stuff
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 3543c3e..c24919b 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -122,13 +122,20 @@ bool ScreenSing::instrumentLayout(double time) {
double iw = 1.0 / count;
typedef std::pair<unsigned, double> CountSum;
std::map<std::string, CountSum> volume; // Stream id to (count, sum)
+ std::map<std::string, CountSum> pitchbend; // Stream id to (count, sum)
for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) {
it->engine(); // Run engine even when dead so that joining is possible
if (!it->dead()) {
it->position((0.5 + i - 0.5 * count) * iw, iw); // Do layout stuff
- CountSum& cs = volume[it->getTrack()];
- cs.first++;
- cs.second += it->correctness();
+ {
+ CountSum& cs = volume[it->getTrack()];
+ cs.first++;
+ cs.second += it->correctness();
+ }{
+ CountSum& cs = pitchbend[it->getTrack()];
+ cs.first++;
+ cs.second += it->getWhammy();
+ }
it->draw(time);
++i;
}
@@ -141,7 +148,7 @@ bool ScreenSing::instrumentLayout(double time) {
// Set volume levels (averages of all instruments playing that track)
for( std::map<std::string,std::string>::iterator it = m_song->music.begin() ; it != m_song->music.end() ; ++it ) {
double level = 1.0;
- if( volume.find(it->first) == volume.end() ) {
+ if (volume.find(it->first) == volume.end()) {
m_audio.streamFade(it->first, level);
} else {
CountSum cs = volume[it->first];
@@ -149,6 +156,11 @@ bool ScreenSing::instrumentLayout(double time) {
if (m_song->music.size() <= 1) level = std::max(0.333, level);
m_audio.streamFade(it->first, level);
}
+ if (pitchbend.find(it->first) != pitchbend.end()) {
+ CountSum cs = pitchbend[it->first];
+ level = cs.second;
+ m_audio.streamBend(it->first, level);
+ }
}
return (count > 0);
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-18 16:55:15
|
Module: performous
Branch: master
Commit: a4bb2770370587465c39261ae8a55aff8fe6e192
Author: Tapio Vierros <tap...@gm...>
Date: Wed Aug 18 19:54:17 2010 +0300
Fix audio sync on 32bit machines.
---
game/audio.cc | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index ab2679f..84fdc7c 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -66,7 +66,7 @@ class Music {
bool m_preview;
static ptime getTime() { return microsec_clock::universal_time(); }
- time_duration durationOf(size_t samples) const { return microseconds(1e6 * samples / srate / 2.0); }
+ time_duration durationOf(int64_t samples) const { return microseconds(1e6 * samples / srate / 2.0); }
/**
* Timing code for precise monotonic time. Very simple, far from perfect.
* This function is called at a beginning of the audio callback, before modifying m_pos
@@ -78,7 +78,6 @@ class Music {
m_baseTime = getTime() - begin; // Recalibrate base time to beginning of the song
}
-
public:
double fadeLevel;
double fadeRate;
|
|
From: Yoda-JM <yo...@us...> - 2010-08-18 11:41:17
|
Module: performous
Branch: master
Commit: ba751bf290d925868e2be0358acc962bef20425f
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Aug 18 13:41:28 2010 +0200
Fixed gentoo ebuild using patch
---
.../performous/files/performous-gentoopaths.patch | 51 ++++++++++++++++++++
.../games-arcade/performous/performous-9999.ebuild | 6 ++-
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/portage-overlay/games-arcade/performous/files/performous-gentoopaths.patch b/portage-overlay/games-arcade/performous/files/performous-gentoopaths.patch
new file mode 100644
index 0000000..a62bef8
--- /dev/null
+++ b/portage-overlay/games-arcade/performous/files/performous-gentoopaths.patch
@@ -0,0 +1,51 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c887394..941369e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,6 +24,9 @@ else(WIN32)
+ if(NOT SHARE_INSTALL)
+ set(SHARE_INSTALL "share/games/performous" CACHE STRING "Data file install path. Must be a relative path (from CMAKE_INSTALL_PREFIX), with no trailing slash.")
+ endif(NOT SHARE_INSTALL)
++ if(NOT GENTOO_DATA_DIR)
++ SET (GENTOO_DATA_DIR "/usr/share/games/performous" CACHE PATH "data directory prefix")
++ endif(NOT GENTOO_DATA_DIR)
+ endif(WIN32)
+
+ mark_as_advanced(SHARE_INSTALL)
+diff --git a/game/config.cmake.hh b/game/config.cmake.hh
+index 300ba05..83b38d2 100644
+--- a/game/config.cmake.hh
++++ b/game/config.cmake.hh
+@@ -10,6 +10,7 @@
+ #define VERSION "@PROJECT_VERSION@"
+
+ #define SHARED_DATA_DIR "@SHARE_INSTALL@"
++#define GENTOO_DATA_DIR "@GENTOO_DATA_DIR@"
+
+ // FFMPEG libraries use changing include file names... Get them from CMake.
+ #define AVCODEC_INCLUDE <@AVCodec_INCLUDE@>
+diff --git a/game/fs.cc b/game/fs.cc
+index 5e74c77..faa96f9 100644
+--- a/game/fs.cc
++++ b/game/fs.cc
+@@ -165,6 +165,9 @@ Paths const& getPaths(bool refresh) {
+ // Adding users data dir
+ dirs.push_back(getDataDir());
+
++ // Adding gentoo path
++ dirs.push_back(std::string(GENTOO_DATA_DIR));
++
+ // Adding relative path from executable
+ dirs.push_back(plugin::execname().parent_path().parent_path() / shareDir);
+ #ifndef _WIN32
+@@ -192,7 +195,9 @@ fs::path getDefaultConfig(fs::path const &configFile) {
+ typedef std::vector<std::string> ConfigList;
+ ConfigList config_list;
+ char const* root = getenv("PERFORMOUS_ROOT");
+- if (root) config_list.push_back(std::string(root) + "/" SHARED_DATA_DIR + configFile.string());
++ if (root) config_list.push_back(std::string(root) + "/" + configFile.string());
++ // Adding gentoo specific directory (keeping PERFORMOUS_ROOT first)
++ config_list.push_back(std::string(GENTOO_DATA_DIR) + configFile.string());
+ fs::path exec = plugin::execname();
+ if (!exec.empty()) config_list.push_back(exec.parent_path().string() + "/../" SHARED_DATA_DIR + configFile.string());
+ ConfigList::const_iterator it = std::find_if(config_list.begin(), config_list.end(), static_cast<bool(&)(fs::path const&)>(fs::exists));
diff --git a/portage-overlay/games-arcade/performous/performous-9999.ebuild b/portage-overlay/games-arcade/performous/performous-9999.ebuild
index 5532ccd..ac3a68c 100644
--- a/portage-overlay/games-arcade/performous/performous-9999.ebuild
+++ b/portage-overlay/games-arcade/performous/performous-9999.ebuild
@@ -77,7 +77,7 @@ src_configure() {
$(cmake-utils_use_enable editor EDITOR)
$(cmake-utils_use_no webcam WEBCAM)
-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}
- -DSHARE_INSTALL=share/performous
+ -DGENTOO_DATA_DIR=${GAMES_DATADIR}/${PN}
-DLOCALE_DIR=/usr/share
-DCMAKE_BUILD_TYPE=Release"
# local mycmakeargs="
@@ -94,9 +94,11 @@ src_compile() {
src_install() {
DOCS="docs/*.txt" cmake-utils_src_install
mv -f "${D}/${GAMES_PREFIX}/share/man" "${D}/usr/share/"
+ mkdir -p "${D}/${GAMES_DATADIR}/${PN}"
+ mv -f "${D}/${GAMES_PREFIX}/share" "${D}/${GAMES_DATADIR}/${PN}"
if use songs; then
- insinto "${GAMES_PREFIX}/share/performous"
+ insinto "${GAMES_DATADIR}/${PN}"
doins -r "${S}/songs" || die "doins songs failed"
fi
doicon "${S}/data/${PN}.xpm"
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-17 22:35:44
|
Module: performous
Branch: master
Commit: 02cd2ab5bc3e7e0b419a670078408d209d7dd0ea
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Aug 17 23:29:57 2010 +0300
Monotonic precise audio sync (not tested because sound card is reserved by Babylon 5 S/PDIF pass-through, but it compiles on my machine).
---
game/audio.cc | 57 ++++++++++++++++++++++-----------------------------------
1 files changed, 22 insertions(+), 35 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index b17ae02..ab2679f 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -12,6 +12,8 @@
#include <iostream>
#include <map>
+using namespace boost::posix_time;
+
namespace {
std::map<std::string, std::string> parseKeyValuePairs(const std::string& st) {
std::map<std::string, std::string> ret;
@@ -49,7 +51,6 @@ namespace {
}
}
-
class Music {
struct Track {
FFmpeg mpeg;
@@ -60,34 +61,21 @@ class Music {
Tracks tracks; ///< Audio decoders
double srate; ///< Sample rate
int64_t m_pos; ///< Current sample position
- boost::posix_time::ptime m_syncTime; ///< Time of the previous audio timeSync
- boost::posix_time::ptime m_baseTime; ///< A reference time
- double m_basePosition; ///< Position at the base time
+ ptime m_baseTime; ///< A reference time (the beginning of the song)
+ time_duration m_nextTime; ///< Start of the next audio block (needed for time monotonicity)
bool m_preview;
- static boost::posix_time::ptime getTime() { return boost::posix_time::microsec_clock::universal_time(); }
- double pos_internal() const { return double(m_pos) / srate / 2.0; }
- double seconds(boost::posix_time::time_duration const& d) const { return 1e-6 * d.total_microseconds(); }
+ static ptime getTime() { return microsec_clock::universal_time(); }
+ time_duration durationOf(size_t samples) const { return microseconds(1e6 * samples / srate / 2.0); }
/**
- * Adjust sync, duration of the audio.
- * This works by using mostly system time and
- * syncing it with the audio time every few seconds
- * (or when something out-of-the-ordinary happens).
+ * Timing code for precise monotonic time. Very simple, far from perfect.
+ * This function is called at a beginning of the audio callback, before modifying m_pos
+ * @param samples the number of samples in the current block (used for calculating block end time)
*/
- void timeSync() {
- const boost::posix_time::ptime now = getTime();
- // Time to create a new reference time?
- // 1. We haven't recieved any audio frames for a while (maybe audio was paused)
- // 2. Time has been running free for several seconds (so let's sync every once in a while)
- // 3. Prediction is radically different from last buffer time (due to e.g. seeking)
- if ( seconds(now - m_syncTime) > 0.2 // Time since last audio buffer
- || seconds(now - m_baseTime) > 10.0 // Time since last time base
- || std::abs(pos() - pos_internal()) > 1.0 ) // Prediction difference
- {
- m_baseTime = now;
- m_basePosition = pos_internal();
- }
- m_syncTime = now;
+ void timeSync(size_t samples) {
+ time_duration begin = durationOf(m_pos); // Current block begin position in song
+ m_nextTime = begin + durationOf(samples); // Current block end position in song
+ m_baseTime = getTime() - begin; // Recalibrate base time to beginning of the song
}
@@ -96,7 +84,7 @@ public:
double fadeRate;
typedef std::map<std::string,std::string> Files;
Music(Files const& filenames, unsigned int sr, bool preview):
- srate(sr), m_pos(), m_syncTime(getTime()), m_baseTime(m_syncTime), m_basePosition(0),
+ srate(sr), m_pos(), m_baseTime(getTime()),
m_preview(preview), fadeLevel(), fadeRate() {
for (Files::const_iterator it = filenames.begin(), end = filenames.end(); it != end; ++it) {
if (it->second.empty()) continue; // Skip tracks with no filenames; FIXME: Why do we even have those here, shouldn't they be eliminated earlier?
@@ -105,14 +93,15 @@ public:
}
/// Sums the stream to output sample range, returns true if the stream still has audio left afterwards.
bool operator()(float* begin, float* end) {
+ size_t samples = end - begin;
+ timeSync(samples); // Keep audio synced
bool eof = true;
std::vector<float> mixbuf(end - begin);
for (Tracks::iterator it = tracks.begin(), itend = tracks.end(); it != itend; ++it) {
Track& t = *it->second;
if (t.mpeg.audioQueue(&*mixbuf.begin(), &*mixbuf.end(), m_pos, t.fadeLevel)) eof = false;
}
- m_pos += end - begin;
- timeSync(); // Keep audio synced
+ m_pos += samples;
for (size_t i = 0, iend = mixbuf.size(); i != iend; ++i) {
if (i % 2 == 0) {
fadeLevel += fadeRate;
@@ -124,13 +113,11 @@ public:
return !eof;
}
void seek(double time) { m_pos = time * srate * 2.0; }
- /// Get current position in seconds
- double pos() {
- const boost::posix_time::ptime now = getTime();
- // If more than 200 ms since last sync, freeze time (audio is paused)
- return (seconds(now - m_syncTime) > 0.2 // Time since last audio buffer
- ? pos_internal() // Time calculated from sample position
- : m_basePosition + seconds(now - m_baseTime)); // Time calculated from reference point
+ /// Get the current position in seconds
+ double pos() const {
+ time_duration p = getTime() - m_baseTime; // Simple precise position
+ if (p > m_nextTime) p = m_nextTime; // Cap for monotonicity
+ return p.total_microseconds() * 1e-6;
}
double duration() const {
double dur = 0.0;
|
|
From: Tapio V. <aa...@us...> - 2010-08-17 18:15:32
|
Module: performous
Branch: master
Commit: 5054aefd4bc3dc84321ff6d542383172885a698b
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 17 21:14:45 2010 +0300
Smoother audio time sync.
---
game/audio.cc | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index d4b22e0..b17ae02 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -61,19 +61,43 @@ class Music {
double srate; ///< Sample rate
int64_t m_pos; ///< Current sample position
boost::posix_time::ptime m_syncTime; ///< Time of the previous audio timeSync
+ boost::posix_time::ptime m_baseTime; ///< A reference time
+ double m_basePosition; ///< Position at the base time
bool m_preview;
static boost::posix_time::ptime getTime() { return boost::posix_time::microsec_clock::universal_time(); }
double pos_internal() const { return double(m_pos) / srate / 2.0; }
double seconds(boost::posix_time::time_duration const& d) const { return 1e-6 * d.total_microseconds(); }
- /// Do stuff for correcting time codes
- void timeSync() { m_syncTime = getTime(); }
+ /**
+ * Adjust sync, duration of the audio.
+ * This works by using mostly system time and
+ * syncing it with the audio time every few seconds
+ * (or when something out-of-the-ordinary happens).
+ */
+ void timeSync() {
+ const boost::posix_time::ptime now = getTime();
+ // Time to create a new reference time?
+ // 1. We haven't recieved any audio frames for a while (maybe audio was paused)
+ // 2. Time has been running free for several seconds (so let's sync every once in a while)
+ // 3. Prediction is radically different from last buffer time (due to e.g. seeking)
+ if ( seconds(now - m_syncTime) > 0.2 // Time since last audio buffer
+ || seconds(now - m_baseTime) > 10.0 // Time since last time base
+ || std::abs(pos() - pos_internal()) > 1.0 ) // Prediction difference
+ {
+ m_baseTime = now;
+ m_basePosition = pos_internal();
+ }
+ m_syncTime = now;
+ }
+
public:
double fadeLevel;
double fadeRate;
typedef std::map<std::string,std::string> Files;
- Music(Files const& filenames, unsigned int sr, bool preview): srate(sr), m_pos(), m_syncTime(getTime()), m_preview(preview), fadeLevel(), fadeRate() {
+ Music(Files const& filenames, unsigned int sr, bool preview):
+ srate(sr), m_pos(), m_syncTime(getTime()), m_baseTime(m_syncTime), m_basePosition(0),
+ m_preview(preview), fadeLevel(), fadeRate() {
for (Files::const_iterator it = filenames.begin(), end = filenames.end(); it != end; ++it) {
if (it->second.empty()) continue; // Skip tracks with no filenames; FIXME: Why do we even have those here, shouldn't they be eliminated earlier?
tracks.insert(it->first, std::auto_ptr<Track>(new Track(it->second, sr)));
@@ -102,9 +126,11 @@ public:
void seek(double time) { m_pos = time * srate * 2.0; }
/// Get current position in seconds
double pos() {
- double delay = seconds(getTime() - m_syncTime); // Delay since last sync
- if (delay > 0.150) delay = 0; // If delay gets long, something is fishy (or pause is on)
- return pos_internal() + delay; // Adjust internal time
+ const boost::posix_time::ptime now = getTime();
+ // If more than 200 ms since last sync, freeze time (audio is paused)
+ return (seconds(now - m_syncTime) > 0.2 // Time since last audio buffer
+ ? pos_internal() // Time calculated from sample position
+ : m_basePosition + seconds(now - m_baseTime)); // Time calculated from reference point
}
double duration() const {
double dur = 0.0;
|
|
From: Tapio V. <aa...@us...> - 2010-08-17 17:12:13
|
Module: performous Branch: joinmenu Commit: 5e34cf994d3e2222c8281ce6c5cc66b41677b78a Author: Tapio Vierros <tap...@gm...> Date: Tue Aug 17 20:10:58 2010 +0300 Various fixes & tweaks to joinmenu, incl. removing submenus from dance menu. --- game/configuration.cc | 2 + game/configuration.hh | 1 + game/dancegraph.cc | 64 ++++++++++++++++++++++++++++++------------------ game/guitargraph.cc | 65 ++++++++++++++++++++++++++++++------------------- 4 files changed, 83 insertions(+), 49 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-08-17 17:12:11
|
Module: performous
Branch: joinmenu
Commit: 9b7d0b0910edb18a897393da04a464ad7786855f
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 17 18:09:00 2010 +0300
Select is now GodMode and Start opens menu. Keyboard drum menu also work now.
---
game/guitargraph.cc | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index ba883b1..893ddcf 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -266,12 +266,8 @@ void GuitarGraph::engine() {
break;
}
// Handle Start/Select keypresses
- if (ev.nav == input::CANCEL) m_menu.toggle();
- if (ev.nav == input::START && !menuOpen()) ev.button = input::STARPOWER_BUTTON;
- //if (ev.type == input::Event::PRESS && ev.button > input::STARPOWER_BUTTON) {
- //if (ev.button == 9) ev.button = input::STARPOWER_BUTTON; // Start works for GodMode
- //else continue;
- //}
+ if (ev.nav == input::CANCEL && !menuOpen()) ev.button = input::STARPOWER_BUTTON; // Select = GodMode
+ if (ev.nav == input::START && !menuOpen()) { m_menu.open(); continue; }
// Guitar specific actions
if (!m_drums) {
if ((ev.type == input::Event::PRESS || ev.type == input::Event::RELEASE) && ev.button == input::STARPOWER_BUTTON) {
@@ -292,20 +288,15 @@ void GuitarGraph::engine() {
// Check first regular keys
if (ev.type == input::Event::PRESS && ev.button >= 0 && ev.button < m_pads) {
if (m_drums && ev.button == 0) m_menu.action(); // Kick substitutes for strum
- else {
+ else { // Hilight item
int sel = m_drums ? ((ev.button + m_pads - 1) % m_pads) : ev.button;
- std::cout << sel << " " << ev.button << std::endl;
m_menu.select(sel);
}
}
- // Strum (strum of keyboard as guitar doesn't generate nav-events)
+ // Strum (strum of keyboard-as-guitar doesn't generate nav-events)
else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.action(1);
else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.action(-1);
- //else { // Try nav keys (arrows)
- // if (ev.nav == input::START) m_menu.action();
- // else if (ev.nav == input::DOWN || ev.nav == input::RIGHT) m_menu.move(1);
- // else if (ev.nav == input::UP || ev.nav == input::LEFT) m_menu.move(-1);
- //}
+ else if (ev.nav == input::START) m_menu.action();
// See if anything changed
if (!m_drums && m_selectedTrack.so() != getTrack()) setTrack(m_selectedTrack.so());
else if (boost::lexical_cast<int>(m_selectedDifficulty.so()) != m_level)
|
|
From: Yoda-JM <yo...@us...> - 2010-08-17 13:53:11
|
Module: performous Branch: master Commit: fb2b7d377fff0628c49ba3cdf8f84c46eb75e878 Author: Vincent Le Ligeour <yo...@us...> Date: Tue Aug 17 15:53:21 2010 +0200 Moved EOF editor ebuild inside games-util category --- .../eof/eof-1.65.ebuild | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/portage-overlay/games-arcade/eof/eof-1.65.ebuild b/portage-overlay/games-util/eof/eof-1.65.ebuild similarity index 100% rename from portage-overlay/games-arcade/eof/eof-1.65.ebuild rename to portage-overlay/games-util/eof/eof-1.65.ebuild |
|
From: Tapio V. <aa...@us...> - 2010-08-16 22:15:57
|
Module: performous
Branch: master
Commit: c47a01c387e2b0e3c1dbd972a7219a3034de6a22
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 17 01:10:17 2010 +0300
Use bigger default suggestedLatency for Windows compatibility.
---
game/libda/portaudio.hpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/libda/portaudio.hpp b/game/libda/portaudio.hpp
index fb2a575..4211545 100644
--- a/game/libda/portaudio.hpp
+++ b/game/libda/portaudio.hpp
@@ -44,7 +44,7 @@ namespace portaudio {
PaStreamParameters params;
Params(PaStreamParameters const& init = PaStreamParameters()): params(init) {
// Some useful defaults so that things just work
- channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.02);
+ channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.05);
}
Params& channelCount(int val) { params.channelCount = val; return *this; }
Params& device(PaDeviceIndex val) { params.device = val; return *this; }
|
|
From: Tapio V. <aa...@us...> - 2010-08-16 22:15:54
|
Module: performous
Branch: master
Commit: 02d03d8faf08a8a8c83c48ff76b4b234132af040
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Aug 16 22:12:00 2010 +0200
Moved/removed libs/* into game/
---
CMakeLists.txt | 7 -
game/CMakeLists.txt | 4 -
game/audio.cc | 4 +-
game/configuration.cc | 2 +-
{libs/plugin++/src => game}/execname.cc | 2 +-
.../include/plugin++ => game}/execname.hpp | 0
game/ffmpeg.hh | 2 +-
game/fs.cc | 2 +-
{libs/libda/include => game}/libda/fft.hpp | 0
{libs/libda/include => game}/libda/mixer.hpp | 0
{libs/libda/include => game}/libda/portaudio.hpp | 0
{libs/libda/include => game}/libda/sample.hpp | 0
game/pitch.cc | 2 +-
libs/CMakeLists.txt | 7 -
libs/plugin++/CMakeLists.txt | 70 ----
libs/plugin++/cmake/CMakeLists.txt | 11 -
libs/plugin++/cmake/Modules/FindBoost.cmake | 413 --------------------
libs/plugin++/cmake/Modules/FindDL.cmake | 23 --
libs/plugin++/cmake/Modules/LibFindMacros.cmake | 76 ----
libs/plugin++/cmake/Plugin++Config.cmake.in | 10 -
libs/plugin++/cmake/Plugin++ConfigVersion.cmake.in | 13 -
libs/plugin++/cmake/config.h.in | 9 -
libs/plugin++/cmake/plugin++-packaging.cmake | 61 ---
libs/plugin++/include/plugin++/dll.hpp | 40 --
libs/plugin++/include/plugin++/loader.hpp | 24 --
libs/plugin++/include/plugin++/plugin.hpp | 157 --------
libs/plugin++/src/dll.cc | 40 --
libs/plugin++/src/loader.cc | 74 ----
28 files changed, 7 insertions(+), 1046 deletions(-)
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-16 22:00:52
|
Module: performous
Branch: master
Commit: b1e1ce75226efc39966c30ce01747642c9b1934c
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Aug 17 01:00:39 2010 +0300
Avoid spawning Ffmpeg objects for empty filenames
---
game/audio.cc | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index bfba389..7cd15f7 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -75,6 +75,7 @@ public:
typedef std::map<std::string,std::string> Files;
Music(Files const& filenames, unsigned int sr, bool preview): srate(sr), m_pos(), m_syncTime(getTime()), m_preview(preview), fadeLevel(), fadeRate() {
for (Files::const_iterator it = filenames.begin(), end = filenames.end(); it != end; ++it) {
+ if (it->second.empty()) continue; // Skip tracks with no filenames; FIXME: Why do we even have those here, shouldn't they be eliminated earlier?
tracks.insert(it->first, std::auto_ptr<Track>(new Track(it->second, sr)));
}
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-16 21:58:26
|
Module: performous
Branch: master
Commit: 1b0da1dc3e26db845c41583c51e50e2a6eabeb46
Author: Tapio Vierros <tap...@gm...>
Date: Mon Aug 16 23:08:35 2010 +0300
Use OpenCV C++ API for Webcam, also use and catch exceptions.
---
game/screen_sing.cc | 8 ++++--
game/webcam.cc | 57 ++++++++++++++++++++++++++++----------------------
game/webcam.hh | 11 ++++++---
3 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index a32966d..3543c3e 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -58,7 +58,9 @@ void ScreenSing::enter() {
}
// Initialize webcam
if (config["graphic/webcam"].b() && Webcam::enabled()) {
- m_cam.reset(new Webcam(config["graphic/webcamid"].i()));
+ try {
+ m_cam.reset(new Webcam(config["graphic/webcamid"].i()));
+ } catch (std::exception& e) { std::cout << e.what() << std::endl; };
}
// Load video
if (!m_song->video.empty() && config["graphic/video"].b()) {
@@ -76,7 +78,6 @@ void ScreenSing::enter() {
}
}
}
- //FIXME: this line crashes under windows. Have to fix. At moment, just don't use it on Windows
m_pause_icon.reset(new Surface(getThemePath("sing_pause.svg")));
m_help.reset(new Surface(getThemePath("instrumenthelp.svg")));
m_progress.reset(new ProgressBar(getThemePath("sing_progressbg.svg"), getThemePath("sing_progressfg.svg"), ProgressBar::HORIZONTAL, 0.01f, 0.01f, true));
@@ -252,7 +253,8 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_w) dispInFlash(++config["game/pitch"]); // Toggle pitch wave
// Toggle webcam
if (key == SDLK_a && Webcam::enabled()) {
- if (!m_cam) m_cam.reset(new Webcam(config["graphic/webcamid"].i())); // Initialize if we haven't done that already
+ // Initialize if we haven't done that already
+ if (!m_cam) { try { m_cam.reset(new Webcam(config["graphic/webcamid"].i())); } catch (...) { }; }
if (m_cam) { dispInFlash(++config["graphic/webcam"]); m_cam->pause(!config["graphic/webcam"].b()); }
}
// Latency settings
diff --git a/game/webcam.cc b/game/webcam.cc
index aff3c8a..1e5baa3 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -1,4 +1,5 @@
#include <iostream>
+#include <stdexcept>
#include "webcam.hh"
#include "xtime.hh"
@@ -9,38 +10,46 @@
#include <highgui.h>
#define SAVE_WEBCAM_VIDEO
+
+#else
+// Dummy classes
+namespace cv {
+ class VideoCapture {};
+ class VideoWriter {};
+}
#endif
Webcam::Webcam(int cam_id):
- m_thread(), m_capture(NULL), m_writer(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
+ m_thread(), m_capture(), m_writer(), m_frameAvailable(false), m_running(false), m_quit(false)
{
#ifdef USE_OPENCV
// Initialize the capture device
- m_capture = cvCaptureFromCAM(cam_id);
- if (!m_capture) {
+ m_capture.reset(new cv::VideoCapture(cam_id));
+ if (!m_capture->isOpened()) {
if (cam_id != -1) {
- std::cout << "Webcam id " << cam_id << " failed, trying autodetecting...";
- m_capture = cvCaptureFromCAM(-1);
- }
- if (!m_capture) {
- std::cout << "Could not initialize webcam capturing!" << std::endl;
- return;
+ std::clog << "Webcam id " << cam_id << " failed, trying autodetecting...";
+ m_capture.reset(new cv::VideoCapture(-1));
}
+ if (!m_capture->isOpened())
+ throw std::runtime_error("Could not initialize webcam capturing!");
}
// 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);
+ float fps = m_capture->get(CV_CAP_PROP_FPS);
+ int framew = m_capture->get(CV_CAP_PROP_FRAME_WIDTH);
+ int frameh = m_capture->get(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;
+ m_writer.reset(new cv::VideoWriter(out_file.c_str(), codec, fps > 0 ? fps : 30.0f, cvSize(framew,frameh)));
+ if (!m_writer->isOpened()) {
+ std::cout << "Could not initialize webcam video saving!" << std::endl;
+ m_writer.reset();
+ }
#endif
// Start thread
m_thread.reset(new boost::thread(boost::ref(*this)));
#else
- ++cam_id; // dummy
+ (void)cam_id; // Avoid unused warning
#endif
}
@@ -48,8 +57,6 @@ Webcam::~Webcam() {
m_quit = true;
#ifdef USE_OPENCV
if (m_thread) m_thread->join();
- cvReleaseCapture(&m_capture);
- cvReleaseVideoWriter(&m_writer);
#endif
}
@@ -57,16 +64,16 @@ void Webcam::operator()() {
#ifdef USE_OPENCV
m_running = true;
while (!m_quit) {
- IplImage* frame = 0;
- // Try to get a new frame
- if (m_running) frame = cvQueryFrame(m_capture);
- if (frame) {
- if (m_writer) cvWriteFrame(m_writer, frame);
+ if (m_running) {
+ // Get a new frame
+ cv::Mat frame;
+ *m_capture >> frame;
+ if (m_writer) *m_writer << 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));
+ m_frame.width = frame.cols;
+ m_frame.height = frame.rows;
+ m_frame.data.assign(frame.data, frame.data + (m_frame.width * m_frame.height * 3));
// Notify renderer
m_frameAvailable = true;
}
diff --git a/game/webcam.hh b/game/webcam.hh
index f63087d..9566f2e 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -7,8 +7,11 @@
#include "surface.hh"
-struct CvCapture;
-struct CvVideoWriter;
+namespace cv {
+ // Forward declarations
+ class VideoCapture;
+ class VideoWriter;
+}
struct CamFrame {
int width;
@@ -39,8 +42,8 @@ class Webcam {
private:
boost::scoped_ptr<boost::thread> m_thread;
mutable boost::mutex m_mutex;
- CvCapture* m_capture;
- CvVideoWriter* m_writer;
+ boost::scoped_ptr<cv::VideoCapture> m_capture;
+ boost::scoped_ptr<cv::VideoWriter> m_writer;
CamFrame m_frame;
Surface m_surface;
bool m_frameAvailable;
|
|
From: Tapio V. <aa...@us...> - 2010-08-16 21:58:23
|
Module: performous
Branch: joinmenu
Commit: 82275f4baa9c25a48b54bcdeeccfe63806d95125
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 17 00:52:37 2010 +0300
Guitar/drum joinmenu now uses "2d menu" instead of submenus.
Need to squash some bugs still.
---
game/dancegraph.cc | 8 +++---
game/guitargraph.cc | 70 +++++++++++++++++++++++++----------------------
game/instrumentgraph.hh | 6 ++--
3 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index a85aaeb..f0a12a0 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -119,16 +119,16 @@ void DanceGraph::setupJoinMenu() {
// Populate root menu
m_menu.add(MenuOption(_("Ready!"), _("Start performing!")));
m_menu.add(MenuOption(_("Track"), "", trackmenu));
- m_menu.back().setDynamicComment(m_trackComment);
+ m_menu.back().setDynamicComment(m_trackOpt);
m_menu.add(MenuOption(_("Difficulty"), "", diffmenu));
- m_menu.back().setDynamicComment(m_difficultyComment);
+ m_menu.back().setDynamicComment(m_difficultyOpt);
m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
}
void DanceGraph::updateJoinMenu() {
std::string s("\n (");
- m_trackComment = _("Select track") + s + getTrack() + ")";
- m_difficultyComment = _("Select difficulty") + s + getDifficultyString() + ")";
+ m_trackOpt = _("Select track") + s + getTrack() + ")";
+ m_difficultyOpt = _("Select difficulty") + s + getDifficultyString() + ")";
m_selectedTrack = ConfigItem(getTrack());
m_selectedDifficulty = ConfigItem(m_level);
}
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index b206ac4..ba883b1 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -128,36 +128,41 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number,
void GuitarGraph::setupJoinMenu() {
m_menu.clear();
updateJoinMenu();
- // Create track menu
- MenuOptions trackmenu;
- for (InstrumentTracksConstPtr::const_iterator it = m_instrumentTracks.begin(); it != m_instrumentTracks.end(); ++it) {
- trackmenu.push_back(MenuOption(it->first, _("Select track to play"), &m_selectedTrack, ConfigItem(it->first)));
- }
- // Create difficulty menu
- MenuOptions diffmenu;
- for (int level = 0; level < DIFFICULTYCOUNT; ++level) {
- if (difficulty(Difficulty(level), true))
- diffmenu.push_back(MenuOption(diffv[level].name, _("Select difficulty level"), &m_selectedDifficulty, ConfigItem(level)));
- }
// Populate root menu
m_menu.add(MenuOption(_("Ready!"), _("Start performing!")));
- m_menu.add(MenuOption(_("Track"), "", trackmenu));
- m_menu.back().setDynamicComment(m_trackComment);
- m_menu.add(MenuOption(_("Difficulty"), "", diffmenu));
- m_menu.back().setDynamicComment(m_difficultyComment);
+ // Create track option only for guitars
+ if (!m_drums) {
+ ConfigItem::OptionList ol;
+ // Add tracks to option list
+ for (InstrumentTracksConstPtr::const_iterator it = m_instrumentTracks.begin(); it != m_instrumentTracks.end(); ++it) {
+ ol.push_back(it->first);
+ }
+ m_selectedTrack = ConfigItem(ol); // Create a ConfigItem from the option list
+ m_menu.add(MenuOption("", _("Track"), &m_selectedTrack)); // MenuOption that cycles the options
+ m_menu.back().setDynamicName(m_trackOpt); // Set the title to be dynamic
+ }
+ { // Create difficulty opt
+ ConfigItem::OptionList ol;
+ // Add difficulties to the option list
+ for (int level = 0; level < DIFFICULTYCOUNT; ++level) {
+ if (difficulty(Difficulty(level), true))
+ ol.push_back(boost::lexical_cast<std::string>(level));
+ }
+ m_selectedDifficulty = ConfigItem(ol); // Create a ConfigItem from the option list
+ m_menu.add(MenuOption("", _("Difficulty"), &m_selectedDifficulty)); // MenuOption that cycles the options
+ m_menu.back().setDynamicName(m_difficultyOpt); // Set the title to be dynamic
+ }
m_menu.add(MenuOption(_("Lefty-mode"), "", &m_leftymode));
- m_menu.back().setDynamicComment(m_leftyComment);
+ m_menu.back().setDynamicComment(m_leftyOpt);
m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
}
void GuitarGraph::updateJoinMenu() {
std::string s("\n (");
std::string le = m_leftymode.b() ? _("ON") : _("OFF");
- m_trackComment = _("Select track") + s + getTrack() + ")";
- m_difficultyComment = _("Select difficulty") + s + getDifficultyString() + ")";
- m_leftyComment = _("Toggle lefty-mode") + s + le + ")";
- m_selectedTrack = ConfigItem(getTrack());
- m_selectedDifficulty = ConfigItem(m_level);
+ m_trackOpt = getTrack();
+ m_difficultyOpt = getDifficultyString();
+ m_leftyOpt = _("Toggle lefty-mode") + s + le + ")";
}
/// Load the appropriate neck texture
@@ -176,8 +181,6 @@ void GuitarGraph::changeTrack(int dir) {
else if (m_track_index == (--m_instrumentTracks.end())) m_track_index = (--m_instrumentTracks.end());
difficultyAuto(true);
updateNeck();
- setupJoinMenu();
- m_menu.select(1); // Restore selection to the track menu item
}
/// Set specific track
@@ -186,8 +189,6 @@ void GuitarGraph::setTrack(const std::string& track) {
if (it != m_instrumentTracks.end()) m_track_index = it;
difficultyAuto(true);
updateNeck();
- setupJoinMenu();
- m_menu.select(1); // Restore selection to the track menu item
}
/// Get the difficulty as displayable string
@@ -233,7 +234,6 @@ bool GuitarGraph::difficulty(Difficulty level, bool check_only) {
updateChords();
return false;
}
- updateJoinMenu();
return true;
}
@@ -291,21 +291,25 @@ void GuitarGraph::engine() {
if (menuOpen()) {
// Check first regular keys
if (ev.type == input::Event::PRESS && ev.button >= 0 && ev.button < m_pads) {
- int sel = m_drums ? ((ev.button + m_pads - 1) % m_pads) : ev.button;
- m_menu.select(sel);
- m_menu.action();
+ if (m_drums && ev.button == 0) m_menu.action(); // Kick substitutes for strum
+ else {
+ int sel = m_drums ? ((ev.button + m_pads - 1) % m_pads) : ev.button;
+ std::cout << sel << " " << ev.button << std::endl;
+ m_menu.select(sel);
+ }
}
// Strum (strum of keyboard as guitar doesn't generate nav-events)
- //else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.move(1);
- //else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.move(-1);
+ else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.action(1);
+ else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.action(-1);
//else { // Try nav keys (arrows)
// if (ev.nav == input::START) m_menu.action();
// else if (ev.nav == input::DOWN || ev.nav == input::RIGHT) m_menu.move(1);
// else if (ev.nav == input::UP || ev.nav == input::LEFT) m_menu.move(-1);
//}
// See if anything changed
- if (m_selectedTrack.s() != getTrack()) setTrack(m_selectedTrack.s());
- else if (m_selectedDifficulty.i() != m_level) difficulty(Difficulty(m_selectedDifficulty.i()));
+ if (!m_drums && m_selectedTrack.so() != getTrack()) setTrack(m_selectedTrack.so());
+ else if (boost::lexical_cast<int>(m_selectedDifficulty.so()) != m_level)
+ difficulty(Difficulty(boost::lexical_cast<int>(m_selectedDifficulty.so())));
// Sync menu items & captions
updateJoinMenu();
// Playing
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index e4f5dfb..84ca6a4 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -131,9 +131,9 @@ class InstrumentGraph {
// Dynamic stuff for join menu
ConfigItem m_selectedTrack; /// menu modifies this to select track
ConfigItem m_selectedDifficulty; /// menu modifies this to select difficulty
- std::string m_trackComment;
- std::string m_difficultyComment;
- std::string m_leftyComment;
+ std::string m_trackOpt;
+ std::string m_difficultyOpt;
+ std::string m_leftyOpt;
// Misc counters etc.
int m_pads; /// how many panels the current gaming mode uses
|
|
From: Tapio V. <aa...@us...> - 2010-08-16 21:58:20
|
Module: performous
Branch: joinmenu
Commit: 1a00a40e755e22b1f8c394957089aff3b7451388
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 17 00:50:29 2010 +0300
Implement new "option_list" ConfigItem type.
Does not yet support selection saving/loading to/from xml.
Also, typedef collides with StringList, so both cannot have constructors ATM.
---
game/configuration.cc | 19 ++++++++++++++++++-
game/configuration.hh | 5 +++++
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/game/configuration.cc b/game/configuration.cc
index 9d91a53..d6fa8af 100644
--- a/game/configuration.cc
+++ b/game/configuration.cc
@@ -26,6 +26,8 @@ ConfigItem::ConfigItem(float fval): m_type("float"), m_value(fval) { }
ConfigItem::ConfigItem(std::string sval): m_type("string"), m_value(sval) { }
+ConfigItem::ConfigItem(OptionList opts): m_type("option_list"), m_value(opts), m_sel(0) { }
+
ConfigItem& ConfigItem::incdec(int dir) {
if (m_type == "int") {
@@ -39,6 +41,8 @@ ConfigItem& ConfigItem::incdec(int dir) {
} else if (m_type == "bool") {
bool& val = boost::get<bool>(m_value);
val = !val;
+ } else if (m_type == "option_list") {
+ m_sel = clamp<int>(m_sel + dir, 0, boost::get<OptionList>(m_value).size()-1);
}
return *this;
}
@@ -49,6 +53,7 @@ bool ConfigItem::isDefaultImpl(ConfigItem::Value const& defaultValue) const {
if (m_type == "float") return boost::get<double>(m_value) == boost::get<double>(defaultValue);
if (m_type == "string") return boost::get<std::string>(m_value) == boost::get<std::string>(defaultValue);
if (m_type == "string_list") return boost::get<StringList>(m_value) == boost::get<StringList>(defaultValue);
+ if (m_type == "option_list") return boost::get<OptionList>(m_value) == boost::get<OptionList>(defaultValue);
throw std::logic_error("ConfigItem::is_default doesn't know type '" + m_type + "'");
}
@@ -68,6 +73,8 @@ bool& ConfigItem::b() { verifyType("bool"); return boost::get<bool>(m_value); }
double& ConfigItem::f() { verifyType("float"); return boost::get<double>(m_value); }
std::string& ConfigItem::s() { verifyType("string"); return boost::get<std::string>(m_value); }
ConfigItem::StringList& ConfigItem::sl() { verifyType("string_list"); return boost::get<StringList>(m_value); }
+ConfigItem::OptionList& ConfigItem::ol() { verifyType("option_list"); return boost::get<OptionList>(m_value); }
+std::string& ConfigItem::so() { verifyType("option_list"); return boost::get<OptionList>(m_value).at(m_sel); }
namespace {
template <typename T, typename VariantAll, typename VariantNum> std::string numericFormat(VariantAll const& value, VariantNum const& multiplier, VariantNum const& step) {
@@ -94,6 +101,7 @@ std::string ConfigItem::getValue() const {
StringList const& sl = boost::get<StringList>(m_value);
return sl.size() == 1 ? "{" + sl[0] + "}" : (boost::format("%d items") % sl.size()).str();
}
+ if (m_type == "option_list") return boost::get<OptionList>(m_value).at(m_sel);
throw std::logic_error("ConfigItem::getValue doesn't know type '" + m_type + "'");
}
@@ -179,7 +187,8 @@ void ConfigItem::update(xmlpp::Element& elem, int mode) {
value = elem2.get_content();
}
m_value = value;
- } else if (m_type == "string_list") {
+ } else if (m_type == "string_list" || m_type == "option_list") {
+ //TODO: Option list should also update selection (from attribute?)
std::vector<std::string> value;
xmlpp::NodeSet n2 = elem.find("stringvalue/text()");
for (xmlpp::NodeSet::const_iterator it2 = n2.begin(), end2 = n2.end(); it2 != end2; ++it2) {
@@ -236,6 +245,14 @@ void writeConfig(bool system) {
stringvalueNode->add_child_text(*it);
}
}
+ else if (item.get_type() == "option_list") {
+ //TODO: Write selected also (as attribute?)
+ ConfigItem::OptionList const& value = item.ol();
+ for(ConfigItem::OptionList::const_iterator it = value.begin(); it != value.end(); ++it) {
+ xmlpp::Element* stringvalueNode = entryNode->add_child("stringvalue");
+ stringvalueNode->add_child_text(*it);
+ }
+ }
}
fs::path const& conf = system ? systemConfFile : userConfFile;
std::string tmp = conf.string() + "tmp";
diff --git a/game/configuration.hh b/game/configuration.hh
index 33a6055..e0c92c9 100644
--- a/game/configuration.hh
+++ b/game/configuration.hh
@@ -11,11 +11,13 @@ namespace xmlpp { class Element; } // Forward declaration for libxml++ stuff
class ConfigItem {
public:
typedef std::vector<std::string> StringList; ///< a list of strings
+ typedef std::vector<std::string> OptionList; ///< a list of string options
ConfigItem() {}
ConfigItem(bool bval);
ConfigItem(int ival);
ConfigItem(float fval);
ConfigItem(std::string sval);
+ ConfigItem(OptionList opts);
void update(xmlpp::Element& elem, int mode); ///< Load XML config file, elem = Entry, mode = 0 for schema, 1 for system config and 2 for user config
ConfigItem& operator++() { return incdec(1); } ///< increments config value
ConfigItem& operator--() { return incdec(-1); } ///< decrements config value
@@ -27,6 +29,8 @@ class ConfigItem {
double& f(); ///< Access floating-point item
std::string& s(); ///< Access string item
StringList& sl(); ///< Access stringlist item
+ OptionList& ol(); ///< Access optionlist item
+ std::string& so(); ///< Access currently selected string option
void reset(bool factory = false) { m_value = factory ? m_factoryDefaultValue : m_defaultValue; } ///< Reset to default
void makeSystem() { m_defaultValue = m_value; } ///< Make current value the system default (used when saving system config)
std::string getValue() const; ///< Get a human-readable representation of the current value
@@ -49,6 +53,7 @@ class ConfigItem {
boost::variant<int, double> m_step, m_min, m_max;
boost::variant<int, double> m_multiplier;
std::string m_unit;
+ int m_sel;
};
typedef std::map<std::string, ConfigItem> Config;
|
|
From: Yoda-JM <yo...@us...> - 2010-08-16 20:12:24
|
Module: performous
Branch: joinmenu
Commit: 0924083b33d935cc3b9f1862cc263276138353f1
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Aug 16 22:12:00 2010 +0200
Moved/removed libs/* into game/
---
CMakeLists.txt | 7 -
game/CMakeLists.txt | 4 -
game/audio.cc | 4 +-
game/configuration.cc | 2 +-
{libs/plugin++/src => game}/execname.cc | 2 +-
.../include/plugin++ => game}/execname.hpp | 0
game/ffmpeg.hh | 2 +-
game/fs.cc | 2 +-
{libs/libda/include => game}/libda/fft.hpp | 0
{libs/libda/include => game}/libda/mixer.hpp | 0
{libs/libda/include => game}/libda/portaudio.hpp | 0
{libs/libda/include => game}/libda/sample.hpp | 0
game/pitch.cc | 2 +-
libs/CMakeLists.txt | 7 -
libs/plugin++/CMakeLists.txt | 70 ----
libs/plugin++/cmake/CMakeLists.txt | 11 -
libs/plugin++/cmake/Modules/FindBoost.cmake | 413 --------------------
libs/plugin++/cmake/Modules/FindDL.cmake | 23 --
libs/plugin++/cmake/Modules/LibFindMacros.cmake | 76 ----
libs/plugin++/cmake/Plugin++Config.cmake.in | 10 -
libs/plugin++/cmake/Plugin++ConfigVersion.cmake.in | 13 -
libs/plugin++/cmake/config.h.in | 9 -
libs/plugin++/cmake/plugin++-packaging.cmake | 61 ---
libs/plugin++/include/plugin++/dll.hpp | 40 --
libs/plugin++/include/plugin++/loader.hpp | 24 --
libs/plugin++/include/plugin++/plugin.hpp | 157 --------
libs/plugin++/src/dll.cc | 40 --
libs/plugin++/src/loader.cc | 74 ----
28 files changed, 7 insertions(+), 1046 deletions(-)
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:53:34
|
Module: performous
Branch: joinmenu
Commit: db8ea4dfbc027014e2ee21beb77bbe13a1eb2163
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Aug 15 16:51:02 2010 +0200
Fixed use of new joystick code
---
game/joystick.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 9c4c468..bbe21c6 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -817,7 +817,7 @@ bool input::SDL::pushEvent(SDL_Event _e) {
if (event.nav != input::NONE) {
event.button = 0;
event.type = input::Event::PRESS;
- devices[joy_id].addEvent(event);
+ devices.find(joy_id)->second.addEvent(event);
}
return false;
}
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:53:31
|
Module: performous Branch: joinmenu Commit: a574fa87bd49c6cf2e7d297aef433b6fff82fcf5 Author: Vincent Le Ligeour <yo...@us...> Date: Sun Aug 15 16:50:29 2010 +0200 Merge branch 'master' into joinmenu Conflicts: game/screen_intro.cc --- |
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:53:28
|
Module: performous Branch: joinmenu Commit: b8429c74af2d412c10f2bd03074351a0fcfbaa1e Author: Lasse Karkkainen <tro...@tr...> Date: Sun Aug 15 04:57:36 2010 +0300 Fix FFMPEG CMake scripts' error messages. --- cmake/Modules/FindAVCodec.cmake | 2 +- cmake/Modules/FindAVFormat.cmake | 2 +- cmake/Modules/FindAVUtil.cmake | 2 +- cmake/Modules/FindSWScale.cmake | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/FindAVCodec.cmake b/cmake/Modules/FindAVCodec.cmake index 400ac58..d1e23aa 100644 --- a/cmake/Modules/FindAVCodec.cmake +++ b/cmake/Modules/FindAVCodec.cmake @@ -33,7 +33,7 @@ if(AVCodec_INCLUDE_DIR) endforeach(suffix) if(NOT AVCodec_INCLUDE) - message(FATAL_ERROR "Found avcodec.h include dir, but not the header file. This is an internal error in FindAVCodec.cmake") + message(FATAL_ERROR "Found avcodec.h include dir, but not the header file. Perhaps you need to clear CMake cache?") endif(NOT AVCodec_INCLUDE) endif(AVCodec_INCLUDE_DIR) diff --git a/cmake/Modules/FindAVFormat.cmake b/cmake/Modules/FindAVFormat.cmake index b02d2a6..cc0561a 100644 --- a/cmake/Modules/FindAVFormat.cmake +++ b/cmake/Modules/FindAVFormat.cmake @@ -31,7 +31,7 @@ if(AVFormat_INCLUDE_DIR) endforeach(suffix) if(NOT AVFormat_INCLUDE) - message(FATAL_ERROR "Found avformat.h include dir, but not the header file. This is an internal error in FindAVFormat.cmake") + message(FATAL_ERROR "Found avformat.h include dir, but not the header file. Perhaps you need to clear CMake cache?") endif(NOT AVFormat_INCLUDE) endif(AVFormat_INCLUDE_DIR) diff --git a/cmake/Modules/FindAVUtil.cmake b/cmake/Modules/FindAVUtil.cmake index 99bfbfb..fbf2bd4 100644 --- a/cmake/Modules/FindAVUtil.cmake +++ b/cmake/Modules/FindAVUtil.cmake @@ -29,7 +29,7 @@ if(AVUtil_INCLUDE_DIR) endforeach(suffix) if(NOT AVUtil_INCLUDE) - message(FATAL_ERROR "Found avutil.h include dir, but not the header file. This is an internal error in FindAVUtil.cmake") + message(FATAL_ERROR "Found avutil.h include dir, but not the header file. Perhaps you need to clear CMake cache?") endif(NOT AVUtil_INCLUDE) endif(AVUtil_INCLUDE_DIR) diff --git a/cmake/Modules/FindSWScale.cmake b/cmake/Modules/FindSWScale.cmake index e675a51..f76cc3d 100644 --- a/cmake/Modules/FindSWScale.cmake +++ b/cmake/Modules/FindSWScale.cmake @@ -31,7 +31,7 @@ if(SWScale_INCLUDE_DIR) endforeach(suffix) if(NOT SWScale_INCLUDE) - message(FATAL_ERROR "Found swscale.h include dir, but not the header file. This is an internal error in FindSWScale.cmake") + message(FATAL_ERROR "Found swscale.h include dir, but not the header file. Maybe you need to clear CMake cache?") endif(NOT SWScale_INCLUDE) endif(SWScale_INCLUDE_DIR) |