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: Yoda-JM <yo...@us...> - 2010-08-15 14:52:18
|
Module: performous Branch: joinmenu Commit: c98951d17e65b78b99834e8852e6f811d6f5822a Author: Lasse Karkkainen <tro...@tr...> Date: Thu Jun 24 03:44:34 2010 +0300 - Config schema for new audio device configuration - Audio code rewritten with multiple device support - Samples now take std::string const& instead of std::string * Must use std::auto_ptr for ptr_map insert (avoid leaks when key copycon throws) --- data/schema.xml | 25 +++------ game/audio.cc | 154 +++++++++++++++++++++++++++++++++--------------------- game/audio.hh | 6 +- 3 files changed, 105 insertions(+), 80 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:52:15
|
Module: performous
Branch: joinmenu
Commit: 2661a16adb2a245da582970940c8f30387b56783
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Jun 23 08:27:59 2010 +0300
Cleanup
---
game/audio.cc | 34 ++++++++++++++++++++--------------
game/audio.hh | 5 +++--
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 4cd5ae4..899615a 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -13,8 +13,8 @@
class Music {
struct Track {
FFmpeg mpeg;
- float volume;
- Track(std::string const& filename, unsigned int sr): mpeg(false, true, filename, sr), volume(1.0f) {}
+ float fadeLevel;
+ Track(std::string const& filename, unsigned int sr): mpeg(false, true, filename, sr), fadeLevel(1.0f) {}
};
typedef boost::ptr_map<std::string, Track> Tracks;
Tracks tracks; ///< Audio decoders
@@ -35,7 +35,7 @@ public:
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.volume)) eof = false;
+ if (t.mpeg.audioQueue(&*mixbuf.begin(), &*mixbuf.end(), m_pos, t.fadeLevel)) eof = false;
}
m_pos += end - begin;
for (size_t i = 0, iend = mixbuf.size(); i != iend; ++i) {
@@ -66,10 +66,10 @@ public:
}
return ready;
}
- void trackLevel(std::string const& id, double level) {
- Tracks::iterator it = tracks.find(id);
+ void trackFade(std::string const& name, double fadeLevel) {
+ Tracks::iterator it = tracks.find(name);
if (it == tracks.end()) return;
- it->second->volume = level;
+ it->second->fadeLevel = fadeLevel;
}
};
@@ -103,7 +103,11 @@ struct SampleNew {
};
-typedef std::pair<std::string, double> Command; ///< <stream ID, volume level>
+struct Command {
+ enum { TRACK_FADE } type;
+ std::string track;
+ double fadeLevel;
+};
struct Audio::Impl {
boost::mutex mutex;
@@ -133,9 +137,12 @@ struct Audio::Impl {
}
// Process commands
for (size_t i = 0; i < commands.size(); ++i) {
- std::string id = commands[i].first;
- double level = commands[i].second;
- if (!playing.empty()) playing[0].trackLevel(id, level);
+ Command const& cmd = commands[i];
+ switch (cmd.type) {
+ case Command::TRACK_FADE:
+ if (!playing.empty()) playing[0].trackFade(cmd.track, cmd.fadeLevel);
+ break;
+ }
}
commands.clear();
}
@@ -184,7 +191,6 @@ bool Audio::isOpen() const {
}
void Audio::loadSample(std::string streamId, std::string filename) {
- std::cout << ">>> Loading sample \"" << streamId << "\"" << std::endl;
{
boost::mutex::scoped_lock l(self->mutex);
self->samples.insert(streamId, new SampleNew(filename, getSR()));
@@ -200,7 +206,6 @@ void Audio::playSample(std::string streamId) {
}
void Audio::unloadSample(std::string streamId) {
- std::cout << ">>> Unloading sample \"" << streamId << "\"" << std::endl;
{
boost::mutex::scoped_lock l(self->mutex);
self->samples.erase(streamId);
@@ -270,9 +275,10 @@ void Audio::pause(bool state) {
bool Audio::isPaused() const { return self->paused; }
-void Audio::streamFade(std::string stream_id, double level) {
+void Audio::streamFade(std::string track, double fadeLevel) {
boost::mutex::scoped_lock l(self->mutex);
- self->commands.push_back(Command(stream_id, level));
+ Command cmd = { Command::TRACK_FADE, track, fadeLevel };
+ self->commands.push_back(cmd);
}
boost::ptr_vector<Analyzer>& Audio::analyzers() { return self->analyzers; }
diff --git a/game/audio.hh b/game/audio.hh
index cab5e4f..53ce5b2 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -54,8 +54,9 @@ public:
void togglePause() { pause(!isPaused()); }
void pause(bool state = true);
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);
+ void toggleSynth(Notes const&) { /*m_notes = (m_notes ? NULL : ¬es); */} ///< toggles synth playback
+ /// 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);
double getSR() const { return 48000.0; }
};
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:52:12
|
Module: performous
Branch: joinmenu
Commit: 90ec6dd54629b5a447ee2154b962cb25d3f303d9
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Jun 23 08:11:40 2010 +0300
Implement track fading (the current commands structure is a simple hack which is supposed to be improved to support more things in the future).
---
game/audio.cc | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 7c1779b..4cd5ae4 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -41,8 +41,8 @@ public:
for (size_t i = 0, iend = mixbuf.size(); i != iend; ++i) {
if (i % 2 == 0) {
fadeLevel += fadeRate;
- if (fadeLevel <= 0.0f) return false;
- if (fadeLevel > 1.0f) { fadeLevel = 1.0f; fadeRate = 0.0f; }
+ if (fadeLevel <= 0.0) return false;
+ if (fadeLevel > 1.0) { fadeLevel = 1.0; fadeRate = 0.0; }
}
begin[i] += mixbuf[i] * fadeLevel;
}
@@ -66,6 +66,11 @@ public:
}
return ready;
}
+ void trackLevel(std::string const& id, double level) {
+ Tracks::iterator it = tracks.find(id);
+ if (it == tracks.end()) return;
+ it->second->volume = level;
+ }
};
// rename to Sample once totally implemented
@@ -98,12 +103,15 @@ struct SampleNew {
};
+typedef std::pair<std::string, double> Command; ///< <stream ID, volume level>
+
struct Audio::Impl {
boost::mutex mutex;
std::auto_ptr<Music> preloading;
boost::ptr_vector<Music> playing, disposing;
boost::ptr_map<std::string, SampleNew> samples;
boost::ptr_vector<Analyzer> analyzers;
+ std::vector<Command> commands;
portaudio::Init init;
boost::ptr_vector<portaudio::Stream> streams;
volatile bool paused;
@@ -123,6 +131,13 @@ struct Audio::Impl {
if (!playing.empty()) playing[0].fadeRate = -preloading->fadeRate; // Fade out the old music
playing.insert(playing.begin(), preloading);
}
+ // Process commands
+ for (size_t i = 0; i < commands.size(); ++i) {
+ std::string id = commands[i].first;
+ double level = commands[i].second;
+ if (!playing.empty()) playing[0].trackLevel(id, level);
+ }
+ commands.clear();
}
void callbackInput(float const* begin, float const* end) {
analyzers[0].input(begin, end); // TODO: non-pointer sample iterators and support more analyzers
@@ -199,6 +214,7 @@ void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool p
Music& m = *self->preloading.get();
m.seek(startPos);
m.fadeRate = 1.0 / getSR() / fadeTime;
+ self->commands.clear(); // Remove old unprocessed commands (they should not apply to the new music)
}
void Audio::playMusic(std::string const& filename, bool preview, double fadeTime, double startPos) {
@@ -255,6 +271,8 @@ void Audio::pause(bool state) {
bool Audio::isPaused() const { return self->paused; }
void Audio::streamFade(std::string stream_id, double level) {
+ boost::mutex::scoped_lock l(self->mutex);
+ self->commands.push_back(Command(stream_id, level));
}
boost::ptr_vector<Analyzer>& Audio::analyzers() { return self->analyzers; }
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:52:10
|
Module: performous
Branch: joinmenu
Commit: 62e1916e4be836cc53f4cf563874f618f34adcac
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Jun 23 07:33:33 2010 +0300
Implement capture (analyzer) for one channel. Improve code comments in audio.cc.
---
game/audio.cc | 31 +++++++++++++++++++++----------
game/audio.hh | 2 +-
game/engine.hh | 1 +
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 3a6c9e8..7c1779b 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -103,12 +103,15 @@ struct Audio::Impl {
std::auto_ptr<Music> preloading;
boost::ptr_vector<Music> playing, disposing;
boost::ptr_map<std::string, SampleNew> samples;
+ boost::ptr_vector<Analyzer> analyzers;
portaudio::Init init;
boost::ptr_vector<portaudio::Stream> streams;
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));
+ streams.push_back(new portaudio::Stream(*this, portaudio::Params().channelCount(1).device(dev, true), portaudio::Params().channelCount(2).device(dev, false), 48000));
+ // One analyzer for mono input (TODO: fix callbackInput to allow more)
+ analyzers.push_back(new Analyzer(48000.0));
PaError err = Pa_StartStream(streams[0]);
if( err != paNoError ) throw std::runtime_error("Cannot start PortAudio audio stream " + dev + ": " + Pa_GetErrorText(err));
}
@@ -121,17 +124,24 @@ struct Audio::Impl {
playing.insert(playing.begin(), preloading);
}
}
- void callbackInput(float const* begin, float const* end) {}
+ void callbackInput(float const* begin, float const* end) {
+ analyzers[0].input(begin, end); // TODO: non-pointer sample iterators and support more analyzers
+ }
void callbackOutput(float* begin, float* end) {
std::fill(begin, end, 0.0f);
if (paused) return;
+ // Mix in from the streams currently playing
for (size_t i = 0; i < playing.size();) {
- bool keep = playing[i](begin, end);
- // Disposing hack
- boost::mutex::scoped_try_lock l(mutex);
- if (!l.owns_lock()) keep = true; // Cannot dispose without lock
- if (keep) ++i; else disposing.transfer(disposing.end(), playing.begin() + i, playing);
+ bool keep = playing[i](begin, end); // Do the actual mixing
+ boost::mutex::scoped_try_lock l(mutex, boost::defer_lock);
+ if (!keep && l.try_lock()) {
+ // Dispose streams no longer needed by moving them to another container (that will be cleared by another thread).
+ disposing.transfer(disposing.end(), playing.begin() + i, playing);
+ continue;
+ }
+ ++i;
}
+ // Mix in the samples currently playing
for(boost::ptr_map<std::string, SampleNew>::iterator it = samples.begin() ; it != samples.end() ; ++it) {
boost::mutex::scoped_try_lock l(mutex);
(*it->second)(begin, end);
@@ -140,10 +150,9 @@ struct Audio::Impl {
int operator()(void const* input, void* output, unsigned long frames, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags) try {
float const* in = static_cast<float const*>(input);
float* out = static_cast<float*>(output);
- size_t samples = 2 * frames;
- callbackInput(in, in + samples);
+ callbackInput(in, in + 1 * frames); // TODO: no hardcoded channel count
callbackUpdate();
- callbackOutput(out, out + samples);
+ callbackOutput(out, out + 2 * frames);
return paContinue;
} catch (std::exception& e) {
std::cerr << "Exception in audio callback: " << e.what() << std::endl;
@@ -248,3 +257,5 @@ bool Audio::isPaused() const { return self->paused; }
void Audio::streamFade(std::string stream_id, double level) {
}
+boost::ptr_vector<Analyzer>& Audio::analyzers() { return self->analyzers; }
+
diff --git a/game/audio.hh b/game/audio.hh
index 4f620ee..cab5e4f 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -18,7 +18,7 @@ class Audio {
public:
Audio();
~Audio();
- boost::ptr_vector<Analyzer>& analyzers() { static boost::ptr_vector<Analyzer> ana; return ana; }
+ boost::ptr_vector<Analyzer>& analyzers();
bool isOpen() const;
/** Play a song beginning at startPos (defaults to 0)
* @param filename the track filename
diff --git a/game/engine.hh b/game/engine.hh
index f1c7882..c2dad6d 100644
--- a/game/engine.hh
+++ b/game/engine.hh
@@ -65,6 +65,7 @@ class Engine {
std::for_each(m_database.cur.begin(), m_database.cur.end(), boost::bind(&Player::prepare, _1));
double t = m_audio.getPosition() - config["audio/round-trip"].f();
double timeLeft = m_time * TIMESTEP - t;
+ if (timeLeft != timeLeft || timeLeft > 1.0) timeLeft = 1.0; // FIXME: Workaround for NaN values and other weirdness (should fix the weirdness instead)
if (timeLeft > 0.0) { boost::thread::sleep(now() + std::min(TIMESTEP, timeLeft)); continue; }
for (Notes::const_iterator it = m_vocals.notes.begin(); it != m_vocals.notes.end(); ++it) it->power = 0.0f;
std::for_each(m_database.cur.begin(), m_database.cur.end(), boost::bind(&Player::update, _1));
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:52:07
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:52:05
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:52:01
|
Module: performous
Branch: joinmenu
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-08-15 14:51:58
|
Module: performous Branch: joinmenu 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-08-15 14:51:56
|
Module: performous
Branch: joinmenu
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");
}
}
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:51:51
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:51:48
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:51:46
|
Module: performous
Branch: joinmenu
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: Yoda-JM <yo...@us...> - 2010-08-15 14:51:44
|
Module: performous Branch: joinmenu Commit: 0d35bcbd489e904ced0216f97fd8e16b646c8f0e Author: Lasse Karkkainen <tro...@tr...> Date: Fri Jun 18 04:20:02 2010 +0300 Merge branch 'master' into portaudio --- |
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:51:41
|
Module: performous Branch: joinmenu 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: Yoda-JM <yo...@us...> - 2010-08-15 14:51:39
|
Module: performous
Branch: joinmenu
Commit: 2a086a48576811bea2b495a908a7348d63050568
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun May 30 13:43:59 2010 +0200
Added few methods to enable simple track play
---
game/audio.cc | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 66fe695..bc45462 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -145,24 +145,39 @@ void Audio::fadeout(double fadeTime) {
}
double Audio::getPosition() const {
- return 0.0;
+ boost::mutex::scoped_lock l(self->mutex);
+ return self->playing.empty() ? getNaN() : self->playing[0].pos();
}
double Audio::getLength() const {
- return 0.0;
+ boost::mutex::scoped_lock l(self->mutex);
+ return self->playing.empty() ? getNaN() : self->playing[0].duration();
}
bool Audio::isPlaying() const {
- return false;
+ boost::mutex::scoped_lock l(self->mutex);
+ return !self->playing.empty();
}
void Audio::seek(double offset) {
+ boost::mutex::scoped_lock l(self->mutex);
+ for(boost::ptr_vector<Music>::iterator it = self->playing.begin() ; it != self->playing.end() ; ++it) {
+ it->seek(clamp(it->pos() + offset, 0.0, it->duration()));
+ }
+ pause(false);
}
void Audio::seekPos(double pos) {
+ boost::mutex::scoped_lock l(self->mutex);
+ for(boost::ptr_vector<Music>::iterator it = self->playing.begin() ; it != self->playing.end() ; ++it) {
+ it->seek(pos);
+ }
+ pause(false);
}
void Audio::pause(bool state) {
+ boost::mutex::scoped_lock l(self->mutex);
+ pause(state);
}
void Audio::streamFade(std::string stream_id, double level) {
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:51:36
|
Module: performous
Branch: joinmenu
Commit: d3d2634a2581e1732bfebaaf9fc5f0344d1a2c76
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun May 30 13:11:14 2010 +0200
Fixed compilation error
---
game/screen_sing.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 003b380..9d3d04b 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -81,7 +81,7 @@ void ScreenSing::enter() {
m_progress.reset(new ProgressBar(getThemePath("sing_progressbg.svg"), getThemePath("sing_progressfg.svg"), ProgressBar::HORIZONTAL, 0.01f, 0.01f, true));
m_progress->dimensions.fixedWidth(0.4).left(-0.5).screenTop();
theme->timer.dimensions.screenTop(0.5 * m_progress->dimensions.h());
- boost::ptr_vector<Analyzer>& analyzers = m_capture.analyzers();
+ boost::ptr_vector<Analyzer>& analyzers = m_audio.analyzers();
m_layout_singer.reset(new LayoutSinger(m_song->vocals, m_database, theme));
// Load instrument and dance tracks
{
|
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:51:34
|
Module: performous Branch: joinmenu Commit: 6fc0a38608954259145f5a3eef66639f7e062e56 Author: Vincent Le Ligeour <yo...@us...> Date: Sun May 30 13:01:32 2010 +0200 Merged and solved conflict from master --- |
|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:51:31
|
Module: performous Branch: joinmenu Commit: 04c09a279de7be78393b151a1b20b7ed7588453b Author: Lasse Karkkainen <tro...@tr...> Date: Sat Feb 27 04:49:54 2010 +0200 Fifth generation audio rewrite: - Removed most libda functionality - Ripped away a lot of things to make Performous compile again - Using PortAudio directly within audio.cc - audio.cc/audio.hh completely redesigned (now with pImpl) - Supports multiple tracks and simple crossfading - Many other things missing - Audio device configuration not implemented, a lot of hardcoded stuff - Displays "no playback devices found" always. (still a long way to go) --- cmake/Modules/FindPortAudio.cmake | 35 ++ cmake/Modules/FindPortaudio.cmake | 35 -- game/CMakeLists.txt | 12 +- game/audio.cc | 227 ++++---- game/audio.hh | 91 +--- game/ffmpeg.hh | 17 +- game/main.cc | 90 +--- game/record.hh | 45 -- game/screen_intro.cc | 4 +- game/screen_intro.hh | 4 +- game/screen_practice.cc | 10 +- game/screen_practice.hh | 5 +- game/screen_sing.cc | 3 +- game/screen_sing.hh | 6 +- libs/CMakeLists.txt | 1 - libs/libda/CMakeLists.txt | 71 --- libs/libda/cmake/CMakeLists.txt | 11 - libs/libda/cmake/LibDAConfig.cmake.in | 10 - libs/libda/cmake/LibDAConfigVersion.cmake.in | 13 - libs/libda/cmake/Modules/FindALSA.cmake | 34 -- libs/libda/cmake/Modules/FindAVCodec.cmake | 48 -- libs/libda/cmake/Modules/FindAVFormat.cmake | 46 -- libs/libda/cmake/Modules/FindAVUtil.cmake | 44 -- libs/libda/cmake/Modules/FindAtk.cmake | 34 -- libs/libda/cmake/Modules/FindAtkmm.cmake | 35 -- libs/libda/cmake/Modules/FindBoost.cmake | 413 -------------- libs/libda/cmake/Modules/FindCairo.cmake | 34 -- libs/libda/cmake/Modules/FindCairomm.cmake | 34 -- libs/libda/cmake/Modules/FindClanLib.cmake | 48 -- libs/libda/cmake/Modules/FindDL.cmake | 23 - libs/libda/cmake/Modules/FindFAAC.cmake | 24 - libs/libda/cmake/Modules/FindFreetype.cmake | 31 - libs/libda/cmake/Modules/FindGDK-PixBuf.cmake | 32 -- libs/libda/cmake/Modules/FindGDK.cmake | 43 -- libs/libda/cmake/Modules/FindGDKmm.cmake | 44 -- libs/libda/cmake/Modules/FindGIO.cmake | 27 - libs/libda/cmake/Modules/FindGIOmm.cmake | 35 -- libs/libda/cmake/Modules/FindGLEW.cmake | 29 - libs/libda/cmake/Modules/FindGLFW.cmake | 38 -- libs/libda/cmake/Modules/FindGObject.cmake | 31 - libs/libda/cmake/Modules/FindGStreamer.cmake | 33 -- libs/libda/cmake/Modules/FindGTK.cmake | 38 -- libs/libda/cmake/Modules/FindGTKmm.cmake | 46 -- libs/libda/cmake/Modules/FindGlib.cmake | 39 -- libs/libda/cmake/Modules/FindGlibmm.cmake | 42 -- libs/libda/cmake/Modules/FindJack.cmake | 28 - libs/libda/cmake/Modules/FindJpeg.cmake | 28 - libs/libda/cmake/Modules/FindLibPulse.cmake | 28 - libs/libda/cmake/Modules/FindLibPulseSimple.cmake | 28 - libs/libda/cmake/Modules/FindLibRSVG.cmake | 35 -- libs/libda/cmake/Modules/FindLibXML++.cmake | 42 -- libs/libda/cmake/Modules/FindLibXML2.cmake | 29 - libs/libda/cmake/Modules/FindMagick++.cmake | 33 -- libs/libda/cmake/Modules/FindMagick.cmake | 38 -- libs/libda/cmake/Modules/FindOpenGL.cmake | 35 -- libs/libda/cmake/Modules/FindPThread.cmake | 21 - libs/libda/cmake/Modules/FindPango.cmake | 36 -- libs/libda/cmake/Modules/FindPangoCairo.cmake | 35 -- libs/libda/cmake/Modules/FindPangomm.cmake | 36 -- libs/libda/cmake/Modules/FindPng.cmake | 28 - libs/libda/cmake/Modules/FindPortMidi.cmake | 21 - libs/libda/cmake/Modules/FindPortaudio.cmake | 35 -- libs/libda/cmake/Modules/FindProjectM.cmake | 30 - libs/libda/cmake/Modules/FindSDL.cmake | 59 -- libs/libda/cmake/Modules/FindSDL_mixer.cmake | 32 -- libs/libda/cmake/Modules/FindSWScale.cmake | 46 -- libs/libda/cmake/Modules/FindSigC++.cmake | 38 -- libs/libda/cmake/Modules/FindTiff.cmake | 28 - libs/libda/cmake/Modules/FindZ.cmake | 28 - libs/libda/cmake/Modules/LibFindMacros.cmake | 76 --- libs/libda/cmake/config.h.in | 11 - libs/libda/cmake/libda-packaging.cmake | 61 -- libs/libda/examples/CMakeLists.txt | 7 - libs/libda/examples/capture.cpp | 71 --- libs/libda/include/libda/audio.hpp | 171 ------ libs/libda/include/libda/audio_dev.hpp | 35 -- .../portaudio.hh => include/libda/portaudio.hpp} | 30 +- libs/libda/plugins/CMakeLists.txt | 170 ------ libs/libda/plugins/alsa/alsa.hpp | 581 -------------------- libs/libda/plugins/audio_dev_alsa.cpp | 260 --------- libs/libda/plugins/audio_dev_gst.cpp | 94 ---- libs/libda/plugins/audio_dev_jack.cpp | 134 ----- libs/libda/plugins/audio_dev_pa18.cpp | 90 --- libs/libda/plugins/audio_dev_pa19.cpp | 78 --- libs/libda/plugins/audio_dev_pulse.cpp | 122 ---- libs/libda/plugins/audio_dev_tone.cpp | 109 ---- libs/libda/src/CMakeLists.txt | 31 - libs/libda/src/audio.cpp | 103 ---- 88 files changed, 222 insertions(+), 4824 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-15 02:12:40
|
Module: performous Branch: master 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) |
|
From: Yoda-JM <yo...@us...> - 2010-08-12 22:55:32
|
Module: performous
Branch: master
Commit: 7b038c5d9b01a797067b531f51c3c5cea852d263
Author: Vincent Le Ligeour <yo...@us...>
Date: Fri Aug 13 00:55:06 2010 +0200
Fixed ebuild for new portaudio audio code
---
.../games-arcade/performous/performous-9999.ebuild | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/portage-overlay/games-arcade/performous/performous-9999.ebuild b/portage-overlay/games-arcade/performous/performous-9999.ebuild
index 05a3313..5532ccd 100644
--- a/portage-overlay/games-arcade/performous/performous-9999.ebuild
+++ b/portage-overlay/games-arcade/performous/performous-9999.ebuild
@@ -34,7 +34,7 @@ LICENSE="GPL-2
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE="alsa debug editor gstreamer jack midi portaudio pulseaudio songs tools webcam"
+IUSE="debug editor midi songs tools webcam"
RDEPEND="gnome-base/librsvg
>=dev-libs/boost-1.39.0
@@ -48,11 +48,7 @@ RDEPEND="gnome-base/librsvg
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 )
- portaudio? ( media-libs/portaudio )
- gstreamer? ( media-libs/gstreamer )
- pulseaudio? ( media-sound/pulseaudio )
+ media-libs/portaudio
sys-apps/help2man
!games-arcade/ultrastar-ng"
# Waiting for portmidi to enter portage (#90614)
@@ -77,19 +73,12 @@ src_unpack() {
src_configure() {
local mycmakeargs="
- $(cmake-utils_use alsa LibDA_PLUGIN_ALSA)
- $(cmake-utils_use jack LibDA_PLUGIN_JACK)
- $(cmake-utils_use gstreamer LibDA_PLUGIN_GSTREAMER)
- $(cmake-utils_use portaudio LibDA_PLUGIN_PORTAUDIO)
- $(cmake-utils_use pulseaudio LibDA_PLUGIN_PULSEAUDIO)
$(cmake-utils_use_enable tools TOOLS)
$(cmake-utils_use_enable editor EDITOR)
$(cmake-utils_use_no webcam WEBCAM)
-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}
-DSHARE_INSTALL=share/performous
-DLOCALE_DIR=/usr/share
- -DLIBDA_AUTODETECT_PLUGINS=false
- -DLIBDA_PLUGIN_TESTING=false
-DCMAKE_BUILD_TYPE=Release"
# local mycmakeargs="
# $(cmake-utils_use_no midi MIDI)
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-12 22:45:33
|
Module: performous Branch: master Commit: 5bac66a8438f845bc1048ce319d6281944d43a47 Author: Lasse Karkkainen <tro...@tr...> Date: Fri Aug 13 01:44:19 2010 +0300 Merge branch 'portaudio' Conflicts: libs/libda/plugins/audio_dev_alsa.cpp libs/libda/plugins/audio_dev_pa19.cpp --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-12 22:45:30
|
Module: performous Branch: master Commit: fcd25d5a9b71be47c5f99612ae794e2f51241b47 Author: Tapio Vierros <tap...@gm...> Date: Thu Aug 12 17:17:07 2010 +0300 Merge branch 'master' into portaudio Conflicts: game/audio.cc game/audio.hh game/main.cc game/screen_practice.cc --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-12 22:45:28
|
Module: performous Branch: master Commit: 7f4450f014ab90c03e0eeafcf4bb36206353669d Author: Tapio Vierros <tap...@gm...> Date: Wed Aug 4 18:00:04 2010 +0300 Merge branch 'master' into portaudio --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-08-12 22:45:24
|
Module: performous
Branch: master
Commit: a6fd1f98cedfdd849955bb63efc8ffc791d7f1ce
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 3 21:25:08 2010 +0300
Simple time code correction for smoother gameplay.
---
game/audio.cc | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 27c499a..bfba389 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -60,12 +60,20 @@ 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
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(); }
+
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_preview(preview), fadeLevel(), fadeRate() {
+ 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) {
tracks.insert(it->first, std::auto_ptr<Track>(new Track(it->second, sr)));
}
@@ -79,6 +87,7 @@ public:
if (t.mpeg.audioQueue(&*mixbuf.begin(), &*mixbuf.end(), m_pos, t.fadeLevel)) eof = false;
}
m_pos += end - begin;
+ timeSync(); // Keep audio synced
for (size_t i = 0, iend = mixbuf.size(); i != iend; ++i) {
if (i % 2 == 0) {
fadeLevel += fadeRate;
@@ -91,7 +100,11 @@ public:
}
void seek(double time) { m_pos = time * srate * 2.0; }
/// Get current position in seconds
- double pos() const { return double(m_pos) / srate / 2.0; }
+ 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
+ }
double duration() const {
double dur = 0.0;
for (Tracks::const_iterator it = tracks.begin(), itend = tracks.end(); it != itend; ++it) {
|