|
From: Stefano A. <xa...@us...> - 2010-01-28 18:26:02
|
Module: performous
Branch: master
Commit: b61274c265ec128bab1a638f12b87b6fdcc834c5
Author: Xaldyz <xa...@us...>
Date: Thu Jan 28 19:25:05 2010 +0100
Fixed autodetection of default device (input and output) of Portaudio.
---
libs/libda/plugins/audio_dev_pa19.cpp | 4 ++--
libs/libda/plugins/portaudio.hh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libs/libda/plugins/audio_dev_pa19.cpp b/libs/libda/plugins/audio_dev_pa19.cpp
index ffeb044..bf4f6d4 100644
--- a/libs/libda/plugins/audio_dev_pa19.cpp
+++ b/libs/libda/plugins/audio_dev_pa19.cpp
@@ -27,7 +27,7 @@ namespace {
public:
pa19_record(settings& s_orig):
s(s_orig),
- stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), NULL, s.rate())
+ stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev(), true), 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));
@@ -53,7 +53,7 @@ namespace {
public:
pa19_playback(settings& s_orig):
s(s_orig),
- stream(*this, NULL, portaudio::Params().channelCount(s.channels()).device(s.subdev()), s.rate())
+ stream(*this, NULL, portaudio::Params().channelCount(s.channels()).device(s.subdev(), false), 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 3ab49b4..347d9d5 100644
--- a/libs/libda/plugins/portaudio.hh
+++ b/libs/libda/plugins/portaudio.hh
@@ -37,8 +37,8 @@ namespace portaudio {
}
Params& channelCount(int val) { params.channelCount = val; return *this; }
Params& device(PaDeviceIndex val) { params.device = val; return *this; }
- Params& device(std::string const& name) {
- device(name.empty() ? 0 : std::atoi(name.c_str())); // TODO: Name matching and error handling
+ Params& device(std::string const& name, bool inputDevice) {
+ device(name.empty() ? ((inputDevice) ? Pa_GetDefaultInputDevice() : Pa_GetDefaultOutputDevice()) : std::atoi(name.c_str())); // TODO: Name matching and error handling
return *this;
}
Params& sampleFormat(PaSampleFormat val) { params.sampleFormat = val; return *this; }
|