Commit ba908411 authored by jpbl's avatar jpbl
Browse files

trying to get rid of pacpp

parent f17cfdd6
noinst_LTLIBRARIES = libportaudio.la noinst_LTLIBRARIES = libportaudio.la
libportaudio_la_CFLAGS = $(PORTAUDIO_CFLAGS) -Ipa_common/ libportaudio_la_CFLAGS = $(PORTAUDIO_CFLAGS) -Ipa_common/
libportaudio_la_LIBADD = $(PORTAUDIO_LIBS) libportaudio_la_LIBADD = $(PORTAUDIO_LIBS)
libportaudio_la_CXXFLAGS = $(PORTAUDIO_CXXFLAGS) libportaudio_la_CXXFLAGS = $(PORTAUDIO_CXXFLAGS)
libportaudio_la_CPPFLAGS = $(PORTAUDIO_CPPFLAGS) libportaudio_la_CPPFLAGS = $(PORTAUDIO_CPPFLAGS)
......
...@@ -17,12 +17,12 @@ libsflaudio_la_SOURCES = \ ...@@ -17,12 +17,12 @@ libsflaudio_la_SOURCES = \
SFLAudio.hpp \ SFLAudio.hpp \
Source.hpp Source.hpp
AM_CPPFLAGS = $(PORTAUDIO_CFLAGS) -I../pacpp/include -I$(top_srcdir)/libs/portaudio/pa_common -I$(top_srcdir)/libs/ AM_CPPFLAGS = $(PORTAUDIO_CFLAGS) -I$(top_srcdir)/libs/portaudio/pa_common -I$(top_srcdir)/libs/
AM_CXXFLAGS = $(PORTAUDIO_CXXFLAGS) -I$(top_srcdir)/libs/ AM_CXXFLAGS = $(PORTAUDIO_CXXFLAGS) -I$(top_srcdir)/libs/
AM_LDFLAGS = -L$(top_srcdir)/libs/portaudio/ AM_LDFLAGS = -L$(top_srcdir)/libs/portaudio/
LIBADD = $(PORTAUDIO_LIBS) -lportaudio -lopenal LIBADD = $(PORTAUDIO_LIBS) -lportaudio -lopenal
LDADD = libsflaudio.la $(PORTAUDIO_LIBS) -lopenal ../pacpp/source/portaudiocpp/libportaudiocpp.la -lportaudio LDADD = libsflaudio.la $(PORTAUDIO_LIBS) -lopenal -lportaudio
example01_SOURCES = example01.cpp example01_SOURCES = example01.cpp
......
...@@ -30,6 +30,7 @@ namespace SFLAudio ...@@ -30,6 +30,7 @@ namespace SFLAudio
{ {
public: public:
OpenALDevice(); OpenALDevice();
~OpenALDevice();
virtual bool load(); virtual bool load();
virtual void unload(); virtual void unload();
virtual Context *createContext(); virtual Context *createContext();
......
...@@ -19,9 +19,7 @@ ...@@ -19,9 +19,7 @@
*/ */
#include "PortAudioLayer.hpp" #include "PortAudioLayer.hpp"
#include "portaudiocpp/Device.hxx" #include "portaudio.h"
#include "portaudiocpp/HostApi.hxx"
#include "portaudiocpp/System.hxx"
#include "NullDevice.hpp" #include "NullDevice.hpp"
...@@ -29,30 +27,54 @@ ...@@ -29,30 +27,54 @@
SFLAudio::PortAudioLayer::PortAudioLayer() SFLAudio::PortAudioLayer::PortAudioLayer()
: AudioLayer("portaudio") : AudioLayer("portaudio")
{ {
portaudio::System::initialize(); Pa_Initialize();
} }
SFLAudio::PortAudioLayer::~PortAudioLayer() SFLAudio::PortAudioLayer::~PortAudioLayer()
{ {
portaudio::System::terminate(); Pa_Terminate();
} }
std::list< std::string > std::list< std::string >
SFLAudio::PortAudioLayer::getDevicesNames() SFLAudio::PortAudioLayer::getDevicesNames()
{ {
std::list< std::string > devices; refreshDevices();
for(int index = 0; index < portaudio::System::instance().deviceCount(); index++ ) {
portaudio::Device &device = portaudio::System::instance().deviceByIndex(index);
std::string name(device.hostApi().name()); std::list< std::string > devices;
name += ": "; for(DevicesType::iterator pos = mDevices.begin();
name += device.name(); pos != mDevices.end();
devices.push_back(name); pos++) {
devices.push_back(pos->first);
} }
return devices; return devices;
} }
void
SFLAudio::PortAudioLayer::refreshDevices()
{
mDevices.clear();
for(int index = 0; index < Pa_GetDeviceCount(); index++ ) {
const PaDeviceInfo *device = NULL;
const PaHostApiInfo *host = NULL;
device = Pa_GetDeviceInfo(index);
if(device != NULL) {
host = Pa_GetHostApiInfo(device->hostApi);
}
if(device != NULL && host != NULL) {
std::string name(host->name);
name += ": ";
name += device->name;
mDevices.insert(std::make_pair(name, index));
}
}
}
SFLAudio::Device * SFLAudio::Device *
SFLAudio::PortAudioLayer::openDevice() SFLAudio::PortAudioLayer::openDevice()
{ {
......
...@@ -38,7 +38,11 @@ namespace SFLAudio ...@@ -38,7 +38,11 @@ namespace SFLAudio
virtual Device *openDevice(const std::string &name); virtual Device *openDevice(const std::string &name);
private: private:
std::map< std::string, std::pair< int, int > > mDevices; virtual void refreshDevices();
private:
typedef std::map< std::string, int > DevicesType;
DevicesType mDevices;
}; };
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment