|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 11:25:26
|
Module: performous
Branch: master
Commit: e23af95441b48f5ddb808dc2dce231d2ea0353e2
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Jan 21 13:25:06 2010 +0200
Fix PortAudio driver broken by earlier commit
---
game/main.cc | 11 ++++++-----
libs/libda/plugins/audio_dev_pa19.cpp | 8 ++++----
libs/libda/plugins/portaudio.hh | 9 +++++----
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 3a7cfea..40bfc9b 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -151,13 +151,12 @@ void mainLoop(std::string const& songlist) {
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
ScreenManager sm;
try {
- sm.flashMessage(_("Loading..."), 0.0f, 1.0f, 1.0f); // No fade-in to get it to show
- window.blank();
- sm.drawFlashMessage();
- window.swap();
+ sm.flashMessage(_("Audio capture..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Capture capture;
+ sm.flashMessage(_("Audio playback..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Audio audio;
audioSetup(capture, audio);
+ sm.flashMessage(_("Miscellaneous..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Backgrounds backgrounds;
Database database(getConfigDir() / "database.xml");
Songs songs(database, songlist);
@@ -172,10 +171,12 @@ void mainLoop(std::string const& songlist) {
sm.addScreen(new ScreenPlayers("Players", audio, database));
sm.addScreen(new ScreenHiscore("Hiscore", audio, songs, database));
sm.activateScreen("Intro");
+ sm.flashMessage(_("Main menu..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
+ sm.updateScreen(); // exit/enter, any exception is fatal error
+ sm.flashMessage("");
// Main loop
boost::xtime time = now();
unsigned frames = 0;
- sm.flashMessage("");
while (!sm.isFinished()) {
if( g_take_screenshot ) {
fs::path filename;
diff --git a/libs/libda/plugins/audio_dev_pa19.cpp b/libs/libda/plugins/audio_dev_pa19.cpp
index 68b93d3..215ef1d 100644
--- a/libs/libda/plugins/audio_dev_pa19.cpp
+++ b/libs/libda/plugins/audio_dev_pa19.cpp
@@ -9,10 +9,10 @@ namespace {
settings s;
portaudio::Init init;
portaudio::Stream stream;
- public:
+ public:
pa19_record(settings& s_orig):
s(s_orig),
- stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), portaudio::Params(), s.rate())
+ stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), NULL, s.rate())
{
PaError err = Pa_StartStream(stream);
if( err != paNoError ) throw std::runtime_error("Cannot start PortAudio audio stream " + s.subdev() + ": " + Pa_GetErrorText(err));
@@ -35,10 +35,10 @@ namespace {
settings s;
portaudio::Init init;
portaudio::Stream stream;
- public:
+ public:
pa19_playback(settings& s_orig):
s(s_orig),
- stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), portaudio::Params(), s.rate())
+ stream(*this, NULL, portaudio::Params().channelCount(s.channels()).device(s.subdev()), s.rate())
{
PaError err = Pa_StartStream(stream);
if( err != paNoError ) throw std::runtime_error("Cannot start PortAudio audio stream " + s.subdev() + ": " + Pa_GetErrorText(err));
diff --git a/libs/libda/plugins/portaudio.hh b/libs/libda/plugins/portaudio.hh
index 549dca4..3ab49b4 100644
--- a/libs/libda/plugins/portaudio.hh
+++ b/libs/libda/plugins/portaudio.hh
@@ -32,7 +32,8 @@ namespace portaudio {
struct Params {
PaStreamParameters params;
Params(PaStreamParameters const& init = PaStreamParameters()): params(init) {
- sampleFormat(paFloat32);
+ // Some useful defaults so that things just work
+ channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.1);
}
Params& channelCount(int val) { params.channelCount = val; return *this; }
Params& device(PaDeviceIndex val) { params.device = val; return *this; }
@@ -42,7 +43,7 @@ namespace portaudio {
}
Params& sampleFormat(PaSampleFormat val) { params.sampleFormat = val; return *this; }
Params& suggestedLatency(PaTime val) { params.suggestedLatency = val; return *this; }
- // Params& hostAPISpecificStreamInfo(void* val) { params.hostAPISpecificStreamInfo = val; return *this; }
+ Params& hostApiSpecificStreamInfo(void* val) { params.hostApiSpecificStreamInfo = val; return *this; }
operator PaStreamParameters const*() const { return ¶ms; }
};
@@ -53,7 +54,7 @@ namespace portaudio {
class Stream {
PaStream* m_handle;
public:
- /*Stream(
+ Stream(
PaStreamParameters const* input,
PaStreamParameters const* output,
double sampleRate,
@@ -63,7 +64,7 @@ namespace portaudio {
void* userData = NULL)
{
PORTAUDIO_CHECKED(Pa_OpenStream, (&m_handle, input, output, sampleRate, framesPerBuffer, flags, callback, userData));
- }*/
+ }
template <typename Functor> Stream(
Functor& functor,
PaStreamParameters const* input,
|