Commit ba908411 authored by jpbl's avatar jpbl

trying to get rid of pacpp

parent f17cfdd6
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_CXXFLAGS = $(PORTAUDIO_CXXFLAGS)
libportaudio_la_CPPFLAGS = $(PORTAUDIO_CPPFLAGS)
......
......@@ -17,12 +17,12 @@ libsflaudio_la_SOURCES = \
SFLAudio.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_LDFLAGS = -L$(top_srcdir)/libs/portaudio/
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
......
......@@ -30,6 +30,7 @@ namespace SFLAudio
{
public:
OpenALDevice();
~OpenALDevice();
virtual bool load();
virtual void unload();
virtual Context *createContext();
......
......@@ -19,9 +19,7 @@
*/
#include "PortAudioLayer.hpp"
#include "portaudiocpp/Device.hxx"
#include "portaudiocpp/HostApi.hxx"
#include "portaudiocpp/System.hxx"
#include "portaudio.h"
#include "NullDevice.hpp"
......@@ -29,30 +27,54 @@
SFLAudio::PortAudioLayer::PortAudioLayer()
: AudioLayer("portaudio")
{
portaudio::System::initialize();
Pa_Initialize();
}
SFLAudio::PortAudioLayer::~PortAudioLayer()
{
portaudio::System::terminate();
Pa_Terminate();
}
std::list< std::string >
SFLAudio::PortAudioLayer::getDevicesNames()
{
std::list< std::string > devices;
for(int index = 0; index < portaudio::System::instance().deviceCount(); index++ ) {
portaudio::Device &device = portaudio::System::instance().deviceByIndex(index);
refreshDevices();
std::string name(device.hostApi().name());
name += ": ";
name += device.name();
devices.push_back(name);
std::list< std::string > devices;
for(DevicesType::iterator pos = mDevices.begin();
pos != mDevices.end();
pos++) {
devices.push_back(pos->first);
}
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::PortAudioLayer::openDevice()
{
......
......@@ -38,7 +38,11 @@ namespace SFLAudio
virtual Device *openDevice(const std::string &name);
private:
std::map< std::string, std::pair< int, int > > mDevices;
virtual void refreshDevices();
private:
typedef std::map< std::string, int > DevicesType;
DevicesType mDevices;
};
}
......
Markdown is supported
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