diff --git a/src/audio/OpenAL/AudioLayer.cpp b/src/audio/OpenAL/AudioLayer.cpp deleted file mode 100644 index 556f5927c6e447d25b98e109d53313503740c10e..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/AudioLayer.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "AudioLayer.hpp" -#include "Device.hpp" - -SFLAudio::AudioLayer::AudioLayer(const std::string &name) - : mName(name) -{} - -std::string -SFLAudio::AudioLayer::getName() -{ - return mName; -} - - - diff --git a/src/audio/OpenAL/AudioLayer.hpp b/src/audio/OpenAL/AudioLayer.hpp deleted file mode 100644 index 0c5fe9cf5d058b645d903acccfda9981dbc519c6..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/AudioLayer.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_AUDIO_LAYER_HPP__ -#define __SFLAUDIO_AUDIO_LAYER_HPP__ - -#include <list> -#include <string> - -namespace SFLAudio -{ - class Device; - class Emitter; - - class AudioLayer - { - public: - /** - * This will initialize this audio system. The name - * given in argument is the name of the system. - * - */ - AudioLayer(const std::string &name); - - /** - * This function returns all the devices availables - * on the system. - */ - virtual std::list< std::string > getDevicesNames() = 0; - virtual std::list< std::string > getCaptureDevicesNames() = 0; - - /** - * Will return the name of the audio system. OpenAL or - * PortAudio might be an answer. - */ - std::string getName(); - - /** - * Open the default device. - */ - virtual Device *openDevice() = 0; - - /** - * Open the default capture device. - */ - virtual Emitter *openCaptureDevice() = 0; - - /** - * Open the specified device. If the device don't - * exists, the default will be opened. - */ - virtual Device *openDevice(const std::string &name) = 0; - - private: - std::string mName; - }; -} - -#endif - - diff --git a/src/audio/OpenAL/AudioManager.hpp b/src/audio/OpenAL/AudioManager.hpp deleted file mode 100644 index 5c2ee4acde18f990646278bbbf5887000ea6148e..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/AudioManager.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author : Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_AUDIO_MANAGER_HPP__ -#define __SFLAUDIO_AUDIO_MANAGER_HPP__ - -#include "utilspp/Singleton.hpp" -#include "AudioManagerImpl.hpp" - -namespace SFLAudio -{ - typedef utilspp::SingletonHolder< AudioManagerImpl > AudioManager; -} - -#endif - diff --git a/src/audio/OpenAL/AudioManagerImpl.cpp b/src/audio/OpenAL/AudioManagerImpl.cpp deleted file mode 100644 index 514dea39dfc0cab7762d19f1adc726acd7d8d2d8..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/AudioManagerImpl.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "AudioManagerImpl.hpp" -#include "Null/NullLayer.hpp" -#include "OpenAL/OpenALLayer.hpp" -#include "PortAudio/PortAudioLayer.hpp" - -SFLAudio::AudioManagerImpl::AudioManagerImpl() -{ - mLayer = NULL; - registerLayer(new SFLAudio::PortAudioLayer()); - registerLayer(new SFLAudio::OpenALLayer()); -} - -SFLAudio::AudioManagerImpl::~AudioManagerImpl() -{ - for(LayersType::iterator layer = mLayers.begin(); - layer != mLayers.end(); - layer++) { - delete layer->second; - } -} - -std::list< SFLAudio::AudioLayer * > -SFLAudio::AudioManagerImpl::getLayers() -{ - std::list< AudioLayer * > layers; - for(LayersType::iterator layer = mLayers.begin(); - layer != mLayers.end(); - layer++) { - layers.push_back(layer->second); - } - - return layers; -} - -SFLAudio::AudioLayer * -SFLAudio::AudioManagerImpl::getLayer(const std::string &name) -{ - AudioLayer *layer = NULL; - LayersType::iterator it = mLayers.find(name); - if(it != mLayers.end()) { - layer = it->second; - } - else { - layer = new NullLayer(); - } - - return layer; -} - -SFLAudio::AudioLayer * -SFLAudio::AudioManagerImpl::defaultLayer() -{ - return getLayer("openal"); -} - -SFLAudio::AudioLayer * -SFLAudio::AudioManagerImpl::currentLayer() -{ - if(mLayer == NULL) { - mLayer = defaultLayer(); - } - - return mLayer; -} - -void -SFLAudio::AudioManagerImpl::currentLayer(AudioLayer *layer) -{ - if(layer != NULL) { - mLayer = layer; - } -} - -void -SFLAudio::AudioManagerImpl::registerLayer(AudioLayer *layer) -{ - mLayers.insert(std::make_pair(layer->getName(), layer)); -} diff --git a/src/audio/OpenAL/AudioManagerImpl.hpp b/src/audio/OpenAL/AudioManagerImpl.hpp deleted file mode 100644 index e3f68204a623ed7a4d8f6359809a04424c2f5fd5..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/AudioManagerImpl.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_AUDIO_MANAGER_IMPL_HPP__ -#define __SFLAUDIO_AUDIO_MANAGER_IMPL_HPP__ - -#include <list> -#include <map> -#include <string> - -namespace SFLAudio -{ - class AudioLayer; - - class AudioManagerImpl - { - public: - /** - * We load all available layers. - */ - AudioManagerImpl(); - ~AudioManagerImpl(); - - /** - * Return all loaded layers. - */ - std::list< AudioLayer * > getLayers(); - - /** - * Return the layer specified. It will return NULL if - * there's no corresponding layer. - */ - AudioLayer *getLayer(const std::string &name); - - /** - * Return the default layer. - */ - AudioLayer *defaultLayer(); - - /** - * Return the current layer. - */ - AudioLayer *currentLayer(); - - /** - * Set the current layer. It will do nothing if the - * layer is NULL. - */ - void currentLayer(AudioLayer *layer); - - /** - * Will register the layer. The manager will be - * the pointer's owner. You can use this if you - * have a layer that is isn't included in the main - * library. - */ - void registerLayer(AudioLayer *layer); - - private: - typedef std::map< std::string, AudioLayer * > LayersType; - LayersType mLayers; - - AudioLayer *mLayer; - }; -} - -#endif - diff --git a/src/audio/OpenAL/Context.cpp b/src/audio/OpenAL/Context.cpp deleted file mode 100644 index ae84dd842829c2334a9a508f879059728e615010..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Context.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Context.hpp" -#include "Emitter.hpp" - -SFLAudio::Source * -SFLAudio::Context::createSource(SFLAudio::Emitter *emitter) -{ - Source *source = createSource(emitter->getFormat(), emitter->getFrequency()); - emitter->connect(source); - return source; -} diff --git a/src/audio/OpenAL/Context.hpp b/src/audio/OpenAL/Context.hpp deleted file mode 100644 index 7cf28e683b657b9a6f61d03ca5839de76e59d261..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Context.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_CONTEXT_HPP__ -#define __SFLAUDIO_CONTEXT_HPP__ - -namespace SFLAudio -{ - class Emitter; - class Source; - - class Context - { - public: - virtual bool isNull() {return false;} - - /** - * Create a source for the context. - */ - virtual Source *createSource(int format, int freq) = 0; - Source *createSource(Emitter *emitter); - }; -} - -#endif diff --git a/src/audio/OpenAL/Device.cpp b/src/audio/OpenAL/Device.cpp deleted file mode 100644 index b95720a3e6b08c04a4a7cfaef268a081080ffa26..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Device.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Device.hpp" - -SFLAudio::Device::Device() - : mContext(0) -{} - -SFLAudio::Device::Device(const std::string &name) - : mName(name) - , mContext(0) -{} - -std::string -SFLAudio::Device::getName() -{ - return mName; -} - -bool -SFLAudio::Device::isNull() -{ - return false; -} - -void -SFLAudio::Device::setName(const std::string &name) -{ - mName = name; -} - -SFLAudio::Context * -SFLAudio::Device::currentContext(Context *context) -{ - if(context != 0) { - mContext = context; - } - - return mContext; -} diff --git a/src/audio/OpenAL/Device.hpp b/src/audio/OpenAL/Device.hpp deleted file mode 100644 index 143d2ff491b890a7e92dc86b6ea6c6a129f9a9e9..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Device.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_DEVICE_HPP__ -#define __SFLAUDIO_DEVICE_HPP__ - -#include <string> - -namespace SFLAudio -{ - class Context; - - class Device - { - public: - Device(); - Device(const std::string &name); - - /** - * This will load the device. You shouldn't use - * this function directly. It returns true if - * the load is successfull. - */ - virtual bool load() = 0; - virtual void unload() = 0; - - /** - * This will create a context for the device. - * If there's no current context, it will be - * set as the current; - */ - virtual Context *createContext() = 0; - - /** - * This will set the current context. If NULL is - * given, the context isn't changed. It returns the - * current context. - */ - Context *currentContext(Context *context = 0); - - std::string getName(); - void setName(const std::string &name); - - /** - * Return true if the device is the NullDevice. - */ - bool isNull(); - - private: - std::string mName; - Context *mContext; - - }; -} - -#endif diff --git a/src/audio/OpenAL/Emitter.cpp b/src/audio/OpenAL/Emitter.cpp deleted file mode 100644 index 682003df07292171aa0a261c817d3579ee1f2ec1..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Emitter.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Context.hpp" -#include "Emitter.hpp" - - -SFLAudio::Emitter::Emitter() - : mSource(0) - , mFormat(0) - , mFreq(0) -{} - - -SFLAudio::Emitter::Emitter(int format, int freq) - : mSource(0) - , mFormat(format) - , mFreq(freq) -{} - - -int -SFLAudio::Emitter::getFrequency() -{return mFreq;} - -int -SFLAudio::Emitter::getFormat() -{return mFormat;} - -void -SFLAudio::Emitter::setFrequency(int freq) -{mFreq = freq;} - -void -SFLAudio::Emitter::setFormat(int format) -{mFormat = format;} - -void -SFLAudio::Emitter::connect(Source *source) -{mSource = source;} - -void -SFLAudio::Emitter::connect(Context *context) -{mSource = context->createSource(this);} - -SFLAudio::Source * -SFLAudio::Emitter::getSource() -{return mSource;} - -bool -SFLAudio::Emitter::isNull() -{return false;} diff --git a/src/audio/OpenAL/Emitter.hpp b/src/audio/OpenAL/Emitter.hpp deleted file mode 100644 index 00f46335dc2fe722e5bf539266836e64189f2233..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Emitter.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_EMITTER_HPP__ -#define __SFLAUDIO_EMITTER_HPP__ - -namespace SFLAudio -{ - class Context; - class Source; - - class Emitter - { - public: - Emitter(); - Emitter(int format, int freq); - - int getFrequency(); - int getFormat(); - - void setFrequency(int freq); - void setFormat(int format); - - void connect(Source *source); - void connect(Context *context); - Source *getSource(); - - virtual bool isNull(); - - virtual void play() = 0; - - - private: - Source *mSource; - - int mFormat; - int mFreq; - }; - -} - -#endif - diff --git a/src/audio/OpenAL/Makefile.am b/src/audio/OpenAL/Makefile.am deleted file mode 100644 index 08da8be03a2809b99a83ecbf844cb47ccbd277c0..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -if MAINTENER_CODE - -noinst_PROGRAMS = example01 example02 example03 example04 example05 example06 -noinst_LTLIBRARIES = libsflaudio.la - -libsflaudio_la_SOURCES = \ - AudioLayer.cpp AudioLayer.hpp \ - AudioManagerImpl.cpp AudioManagerImpl.hpp \ - Context.cpp Context.hpp \ - Device.cpp Device.hpp \ - Emitter.cpp Emitter.hpp \ - ./Null/NullLayer.cpp ./Null/NullLayer.hpp \ - Null/NullContext.cpp Null/NullContext.hpp \ - Null/NullDevice.cpp Null/NullDevice.hpp \ - Null/NullEmitter.hpp \ - Null/NullSource.cpp Null/NullSource.hpp \ - OpenAL/MicEmitter.cpp OpenAL/MicEmitter.hpp \ - OpenALLayer.cpp OpenALLayer.hpp \ - OpenALDevice.cpp OpenALDevice.hpp \ - OpenALContext.cpp OpenALContext.hpp \ - OpenALSource.cpp OpenALSource.hpp \ - PortAudioLayer.cpp PortAudioLayer.hpp \ - SFLAudio.hpp \ - Source.cpp Source.hpp \ - WavEmitter.cpp WavEmitter.hpp - -AM_CPPFLAGS = -I$(top_srcdir)/libs/portaudio/pa_common -I$(top_srcdir)/libs/ -AM_CXXFLAGS = $(PORTAUDIO_CXXFLAGS) $(PORTAUDIO_CFLAGS) -I$(top_srcdir)/libs/ $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) -AM_LDFLAGS = -L$(top_srcdir)/libs/portaudio/ - -LIBADD = $(PORTAUDIO_LIBS) -lportaudio -lopenal -lalut -LDADD = libsflaudio.la $(PORTAUDIO_LIBS) -lopenal -lportaudio -lalut $(libccgnu2_LIBS) - -example01_SOURCES = example01.cpp -example02_SOURCES = example02.cpp -example03_SOURCES = example03.cpp -example04_SOURCES = example04.cpp -example05_SOURCES = example05.cpp -example06_SOURCES = example06.cpp - -endif - diff --git a/src/audio/OpenAL/MicEmitter.cpp b/src/audio/OpenAL/MicEmitter.cpp deleted file mode 100644 index 723092452831577ef1e7786c493163b928e769d3..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/MicEmitter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/alut.h> -#include <AL/alut.h> -#include <iostream> - -#include "OpenALLayer.hpp" -#include "MicEmitter.hpp" -#include "Source.hpp" - -SFLAudio::MicEmitter::MicEmitter(int format, int freq, int size, - PFNALCAPTURESTARTPROC palCaptureStart, - PFNALCAPTURESTOPPROC palCaptureStop, - PFNALCAPTUREGETDATAPROC palCaptureGetData) - : Emitter(format, freq) - , mSize(size) - , mAlCaptureStart(palCaptureStart) - , mAlCaptureStop(palCaptureStop) - , mAlCaptureGetData(palCaptureGetData) - , mThread(0) -{} - -void -SFLAudio::MicEmitter::play() -{ - if(mThread == 0) { - mAlCaptureStart(); - - mThread = new MicEmitterThread(getFormat(), getFrequency(), mSize, mAlCaptureGetData); - mThread->setSource(getSource()); - mThread->start(); - } -} - -void -SFLAudio::MicEmitter::stop() -{ - if(mThread != 0) { - delete mThread; - mThread = 0; - } -} - - -SFLAudio::MicEmitterThread::MicEmitterThread(int format, - int freq, - int size, - PFNALCAPTUREGETDATAPROC palCaptureGetData) - : mSource(0) - , mFormat(format) - , mFreq(freq) - , mSize(size) - , mAlCaptureGetData(palCaptureGetData) -{ - setCancel(cancelDeferred); - mData = (ALchar *)malloc(mSize); -} - -SFLAudio::MicEmitterThread::~MicEmitterThread() -{ - terminate(); - free(mData); -} - -void -SFLAudio::MicEmitterThread::setSource(SFLAudio::Source *source) { - mSource = source; -} - -void -SFLAudio::MicEmitterThread::fill() { - ALsizei retval = 0; - std::cout << "filling capture buffer...\n"; - while(retval < mSize) { - int size = mAlCaptureGetData(&mData[retval], - mSize - retval, - mFormat, - mFreq); - retval += size; - if(size != 0) - std::cout << "read " << size << - " bytes from capture, for a total of " << retval << std::endl; - } - std::cout << "capture buffer filled!\n"; -} - -void -SFLAudio::MicEmitterThread::run() -{ - while (!testCancel()) { - if(mData) { - fill(); - } - - if(mSource && mData) { - mSource->stream(mData, mSize); - } - else { - std::cerr << "source or buffer invalid.\n"; - } - std::cout << "done." << std::endl; - } -} diff --git a/src/audio/OpenAL/MicEmitter.hpp b/src/audio/OpenAL/MicEmitter.hpp deleted file mode 100644 index 719686fe84606b77af1a587022e74f72d8047311..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/MicEmitter.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_MIC_EMITTER_HPP__ -#define __SFLAUDIO_MIC_EMITTER_HPP__ - -#include <AL/al.h> -#include <cc++/thread.h> -#include "Emitter.hpp" - - -namespace SFLAudio -{ - class Source; - - class MicEmitterThread : public ost::Thread - { - public: - MicEmitterThread(int format, int freq, int size, PFNALCAPTUREGETDATAPROC palCaptureGetData); - ~MicEmitterThread(); - - void setSource(SFLAudio::Source *source); - virtual void run(); - void fill(); - - private: - SFLAudio::Source *mSource; - ALchar *mData; - ALsizei mFormat; - ALsizei mFreq; - ALsizei mSize; - - PFNALCAPTUREGETDATAPROC mAlCaptureGetData; - }; - - class MicEmitter : public Emitter - { - private: - MicEmitter(); - - public: - MicEmitter(int format, int freq, int size, - PFNALCAPTURESTARTPROC palCaptureStart, - PFNALCAPTURESTOPPROC palCaptureStop, - PFNALCAPTUREGETDATAPROC palCaptureGetData); - virtual void play(); - virtual void stop(); - - - private: - ALsizei mSize; - PFNALCAPTURESTARTPROC mAlCaptureStart; - PFNALCAPTURESTOPPROC mAlCaptureStop; - PFNALCAPTUREGETDATAPROC mAlCaptureGetData; - - MicEmitterThread* mThread; - }; - -} - -#endif diff --git a/src/audio/OpenAL/Null/NullContext.cpp b/src/audio/OpenAL/Null/NullContext.cpp deleted file mode 100644 index 07000897d48744bdccbdce6b58a57f202bbeb304..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullContext.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Null/NullContext.hpp" -#include "Null/NullSource.hpp" - -SFLAudio::Source * -SFLAudio::NullContext::createSource(int, int) -{ - return new NullSource(); -} diff --git a/src/audio/OpenAL/Null/NullContext.hpp b/src/audio/OpenAL/Null/NullContext.hpp deleted file mode 100644 index a8393105792e3cd888270054bd7237754e63bdf2..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullContext.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_CONTEXT_HPP__ -#define __SFLAUDIO_NULL_CONTEXT_HPP__ - -#include "Context.hpp" - -namespace SFLAudio -{ - class NullContext : public Context - { - public: - virtual bool isNull() {return true;} - Source *createSource(int format, int freq); - }; -} - -#endif diff --git a/src/audio/OpenAL/Null/NullDevice.cpp b/src/audio/OpenAL/Null/NullDevice.cpp deleted file mode 100644 index 2eccfb40445492712913b5d968322da1e8d41aab..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullDevice.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> - -#include "Null/NullDevice.hpp" -#include "Null/NullContext.hpp" - -SFLAudio::NullDevice::NullDevice() - : Device("Null/NullDevice") -{ - currentContext(createContext()); -} - -SFLAudio::Context * -SFLAudio::NullDevice::createContext() -{ - return new NullContext(); -} - - -bool -SFLAudio::NullDevice::load() -{ - return true; -} - -void -SFLAudio::NullDevice::unload() -{} - -bool -SFLAudio::NullDevice::isNull() -{ - return true; -} diff --git a/src/audio/OpenAL/Null/NullDevice.hpp b/src/audio/OpenAL/Null/NullDevice.hpp deleted file mode 100644 index 43387038ed946feb7aa8a21803729e4a9a7603e1..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullDevice.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_DEVICE_HPP__ -#define __SFLAUDIO_NULL_DEVICE_HPP__ - -#include "Device.hpp" - -namespace SFLAudio -{ - class NullDevice : public Device - { - public: - NullDevice(); - Context *createContext(); - - virtual bool load(); - virtual void unload(); - bool isNull(); - }; -} - -#endif diff --git a/src/audio/OpenAL/Null/NullEmitter.hpp b/src/audio/OpenAL/Null/NullEmitter.hpp deleted file mode 100644 index bd685121ab6f9e209bc2198a3467f7370f2e3f77..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullEmitter.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_EMITTER_HPP__ -#define __SFLAUDIO_NULL_EMITTER_HPP__ - -#include "Emitter.hpp" - -namespace SFLAudio -{ - class Context; - class Source; - - class NullEmitter : public Emitter - { - public: - virtual bool isNull() {return true;} - virtual void play() {} - }; - -} - -#endif - diff --git a/src/audio/OpenAL/Null/NullLayer.cpp b/src/audio/OpenAL/Null/NullLayer.cpp deleted file mode 100644 index 5e3e4c07f6db1316fa594adc864fa59ec330d947..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullLayer.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Null/NullLayer.hpp" -#include "Null/NullDevice.hpp" -#include "Null/NullEmitter.hpp" - -SFLAudio::NullLayer::NullLayer() - : AudioLayer("Null/NullLayer") -{} - -std::list< std::string > -SFLAudio::NullLayer::getDevicesNames() -{return std::list< std::string >();} - -std::list< std::string > -SFLAudio::NullLayer::getCaptureDevicesNames() -{return std::list< std::string >();} - -SFLAudio::Device * -SFLAudio::NullLayer::openDevice() -{ - return new NullDevice(); -} - -SFLAudio::Emitter * -SFLAudio::NullLayer::openCaptureDevice() -{ - return new NullEmitter(); -} - -SFLAudio::Device * -SFLAudio::NullLayer::openDevice(const std::string &) -{ - return new NullDevice(); -} - diff --git a/src/audio/OpenAL/Null/NullLayer.hpp b/src/audio/OpenAL/Null/NullLayer.hpp deleted file mode 100644 index 4d02b8f5ad5af20929975e2df5c6ee4561af1f01..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullLayer.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_LAYER_HPP__ -#define __SFLAUDIO_NULL_LAYER_HPP__ - -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - class NullLayer : public AudioLayer - { - public: - NullLayer(); - std::list< std::string > getDevicesNames(); - std::list< std::string > getCaptureDevicesNames(); - virtual Device *openDevice(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(const std::string &name); - }; -} - -#endif - diff --git a/src/audio/OpenAL/Null/NullSource.cpp b/src/audio/OpenAL/Null/NullSource.cpp deleted file mode 100644 index a4aa3d6c951cd53b149c9e19bcb0bbe8bf850380..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullSource.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "Null/NullSource.hpp" - -SFLAudio::NullSource::NullSource() - : Source(0, 0) -{} - -bool -SFLAudio::NullSource::isPlaying() -{return true;} - -void -SFLAudio::NullSource::play(void *, int) -{} - -void -SFLAudio::NullSource::stream(void *, int) -{} - -void -SFLAudio::NullSource::stop() -{} diff --git a/src/audio/OpenAL/Null/NullSource.hpp b/src/audio/OpenAL/Null/NullSource.hpp deleted file mode 100644 index 5d6c2ecfcd84e76626d77642b679d868be0c9a63..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Null/NullSource.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_SOURCE_HPP__ -#define __SFLAUDIO_NULL_SOURCE_HPP__ - -#include "Source.hpp" - -namespace SFLAudio -{ - class NullSource : public Source - { - public: - NullSource(); - - virtual bool isNull() {return true;}; - virtual bool isPlaying(); - virtual void stream(void *data, int size); - virtual void play(void *data, int size); - virtual void stop(); - }; -} - -#endif diff --git a/src/audio/OpenAL/NullContext.cpp b/src/audio/OpenAL/NullContext.cpp deleted file mode 100644 index c83df7887ce2eb974860b536736fb3eba56fb5d8..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullContext.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "NullContext.hpp" -#include "NullSource.hpp" - -SFLAudio::Source * -SFLAudio::NullContext::createSource(int, int) -{ - return new NullSource(); -} diff --git a/src/audio/OpenAL/NullContext.hpp b/src/audio/OpenAL/NullContext.hpp deleted file mode 100644 index a8393105792e3cd888270054bd7237754e63bdf2..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullContext.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_CONTEXT_HPP__ -#define __SFLAUDIO_NULL_CONTEXT_HPP__ - -#include "Context.hpp" - -namespace SFLAudio -{ - class NullContext : public Context - { - public: - virtual bool isNull() {return true;} - Source *createSource(int format, int freq); - }; -} - -#endif diff --git a/src/audio/OpenAL/NullDevice.cpp b/src/audio/OpenAL/NullDevice.cpp deleted file mode 100644 index cef84a8de276fbe2734e50bfd1c0627b2f4663d8..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullDevice.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> - -#include "NullDevice.hpp" -#include "NullContext.hpp" - -SFLAudio::NullDevice::NullDevice() - : Device("NullDevice") -{ - currentContext(createContext()); -} - -SFLAudio::Context * -SFLAudio::NullDevice::createContext() -{ - return new NullContext(); -} - - -bool -SFLAudio::NullDevice::load() -{ - return true; -} - -void -SFLAudio::NullDevice::unload() -{} - -bool -SFLAudio::NullDevice::isNull() -{ - return true; -} diff --git a/src/audio/OpenAL/NullDevice.hpp b/src/audio/OpenAL/NullDevice.hpp deleted file mode 100644 index 43387038ed946feb7aa8a21803729e4a9a7603e1..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullDevice.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_DEVICE_HPP__ -#define __SFLAUDIO_NULL_DEVICE_HPP__ - -#include "Device.hpp" - -namespace SFLAudio -{ - class NullDevice : public Device - { - public: - NullDevice(); - Context *createContext(); - - virtual bool load(); - virtual void unload(); - bool isNull(); - }; -} - -#endif diff --git a/src/audio/OpenAL/NullEmitter.hpp b/src/audio/OpenAL/NullEmitter.hpp deleted file mode 100644 index bd685121ab6f9e209bc2198a3467f7370f2e3f77..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullEmitter.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_EMITTER_HPP__ -#define __SFLAUDIO_NULL_EMITTER_HPP__ - -#include "Emitter.hpp" - -namespace SFLAudio -{ - class Context; - class Source; - - class NullEmitter : public Emitter - { - public: - virtual bool isNull() {return true;} - virtual void play() {} - }; - -} - -#endif - diff --git a/src/audio/OpenAL/NullLayer.cpp b/src/audio/OpenAL/NullLayer.cpp deleted file mode 100644 index 6acee5dff399050fa3260c16644564815a263a9b..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullLayer.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "NullLayer.hpp" -#include "NullDevice.hpp" -#include "NullEmitter.hpp" - -SFLAudio::NullLayer::NullLayer() - : AudioLayer("NullLayer") -{} - -std::list< std::string > -SFLAudio::NullLayer::getDevicesNames() -{return std::list< std::string >();} - -SFLAudio::Device * -SFLAudio::NullLayer::openDevice() -{ - return new NullDevice(); -} - -SFLAudio::Emitter * -SFLAudio::NullLayer::openCaptureDevice() -{ - return new NullEmitter(); -} - -SFLAudio::Device * -SFLAudio::NullLayer::openDevice(const std::string &) -{ - return new NullDevice(); -} - diff --git a/src/audio/OpenAL/NullLayer.hpp b/src/audio/OpenAL/NullLayer.hpp deleted file mode 100644 index 5bdda6b7109c05248da2fa05f655299830035c1f..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullLayer.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_LAYER_HPP__ -#define __SFLAUDIO_NULL_LAYER_HPP__ - -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - class NullLayer : public AudioLayer - { - public: - NullLayer(); - std::list< std::string > getDevicesNames(); - virtual Device *openDevice(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(const std::string &name); - }; -} - -#endif - diff --git a/src/audio/OpenAL/NullSource.cpp b/src/audio/OpenAL/NullSource.cpp deleted file mode 100644 index 6f149b5d892d0f2edc476684bd205e637468e3b8..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullSource.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "NullSource.hpp" - -SFLAudio::NullSource::NullSource() - : Source(0, 0) -{} - -bool -SFLAudio::NullSource::isPlaying() -{return true;} - -void -SFLAudio::NullSource::play(void *, int) -{} - -void -SFLAudio::NullSource::stream(void *, int) -{} - -void -SFLAudio::NullSource::stop() -{} diff --git a/src/audio/OpenAL/NullSource.hpp b/src/audio/OpenAL/NullSource.hpp deleted file mode 100644 index 5d6c2ecfcd84e76626d77642b679d868be0c9a63..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/NullSource.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_NULL_SOURCE_HPP__ -#define __SFLAUDIO_NULL_SOURCE_HPP__ - -#include "Source.hpp" - -namespace SFLAudio -{ - class NullSource : public Source - { - public: - NullSource(); - - virtual bool isNull() {return true;}; - virtual bool isPlaying(); - virtual void stream(void *data, int size); - virtual void play(void *data, int size); - virtual void stop(); - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenAL/MicEmitter.cpp b/src/audio/OpenAL/OpenAL/MicEmitter.cpp deleted file mode 100644 index f09848f484dd43305ded4fb036045d99c9e9d0b4..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/MicEmitter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/alut.h> -#include <AL/alut.h> -#include <iostream> - -#include "OpenAL/OpenALLayer.hpp" -#include "MicEmitter.hpp" -#include "Source.hpp" - -SFLAudio::MicEmitter::MicEmitter(int format, int freq, int size, - PFNALCAPTURESTARTPROC palCaptureStart, - PFNALCAPTURESTOPPROC palCaptureStop, - PFNALCAPTUREGETDATAPROC palCaptureGetData) - : Emitter(format, freq) - , mSize(size) - , mAlCaptureStart(palCaptureStart) - , mAlCaptureStop(palCaptureStop) - , mAlCaptureGetData(palCaptureGetData) - , mThread(0) -{} - -void -SFLAudio::MicEmitter::play() -{ - if(mThread == 0) { - mAlCaptureStart(); - - mThread = new MicEmitterThread(getFormat(), getFrequency(), mSize, mAlCaptureGetData); - mThread->setSource(getSource()); - mThread->start(); - } -} - -void -SFLAudio::MicEmitter::stop() -{ - if(mThread != 0) { - delete mThread; - mThread = 0; - } -} - - -SFLAudio::MicEmitterThread::MicEmitterThread(int format, - int freq, - int size, - PFNALCAPTUREGETDATAPROC palCaptureGetData) - : mSource(0) - , mFormat(format) - , mFreq(freq) - , mSize(size) - , mAlCaptureGetData(palCaptureGetData) -{ - setCancel(cancelDeferred); - mData = (ALchar *)malloc(mSize); -} - -SFLAudio::MicEmitterThread::~MicEmitterThread() -{ - terminate(); - free(mData); -} - -void -SFLAudio::MicEmitterThread::setSource(SFLAudio::Source *source) { - mSource = source; -} - -void -SFLAudio::MicEmitterThread::fill() { - ALsizei retval = 0; - std::cout << "filling capture buffer...\n"; - while(retval < mSize) { - int size = mAlCaptureGetData(&mData[retval], - mSize - retval, - mFormat, - mFreq); - retval += size; - if(size != 0) - std::cout << "read " << size << - " bytes from capture, for a total of " << retval << std::endl; - } - std::cout << "capture buffer filled!\n"; -} - -void -SFLAudio::MicEmitterThread::run() -{ - while (!testCancel()) { - if(mData) { - fill(); - } - - if(mSource && mData) { - mSource->stream(mData, mSize); - } - else { - std::cerr << "source or buffer invalid.\n"; - } - std::cout << "done." << std::endl; - } -} diff --git a/src/audio/OpenAL/OpenAL/MicEmitter.hpp b/src/audio/OpenAL/OpenAL/MicEmitter.hpp deleted file mode 100644 index 719686fe84606b77af1a587022e74f72d8047311..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/MicEmitter.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_MIC_EMITTER_HPP__ -#define __SFLAUDIO_MIC_EMITTER_HPP__ - -#include <AL/al.h> -#include <cc++/thread.h> -#include "Emitter.hpp" - - -namespace SFLAudio -{ - class Source; - - class MicEmitterThread : public ost::Thread - { - public: - MicEmitterThread(int format, int freq, int size, PFNALCAPTUREGETDATAPROC palCaptureGetData); - ~MicEmitterThread(); - - void setSource(SFLAudio::Source *source); - virtual void run(); - void fill(); - - private: - SFLAudio::Source *mSource; - ALchar *mData; - ALsizei mFormat; - ALsizei mFreq; - ALsizei mSize; - - PFNALCAPTUREGETDATAPROC mAlCaptureGetData; - }; - - class MicEmitter : public Emitter - { - private: - MicEmitter(); - - public: - MicEmitter(int format, int freq, int size, - PFNALCAPTURESTARTPROC palCaptureStart, - PFNALCAPTURESTOPPROC palCaptureStop, - PFNALCAPTUREGETDATAPROC palCaptureGetData); - virtual void play(); - virtual void stop(); - - - private: - ALsizei mSize; - PFNALCAPTURESTARTPROC mAlCaptureStart; - PFNALCAPTURESTOPPROC mAlCaptureStop; - PFNALCAPTUREGETDATAPROC mAlCaptureGetData; - - MicEmitterThread* mThread; - }; - -} - -#endif diff --git a/src/audio/OpenAL/OpenAL/OpenALContext.cpp b/src/audio/OpenAL/OpenAL/OpenALContext.cpp deleted file mode 100644 index 13795f18603a9ec3bcbfed338c7cffa27c5a8377..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALContext.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> - -#include "OpenAL/OpenALContext.hpp" -#include "OpenAL/OpenALSource.hpp" -#include "Null/NullSource.hpp" - -SFLAudio::OpenALContext::OpenALContext(ALCcontext *context) - : mContext(context) -{} - -SFLAudio::Source * -SFLAudio::OpenALContext::createSource(int format, int freq) -{ - Source *source = 0; - if(mContext == 0) { - source = new NullSource(); - } - else { - source = OpenALSource::create(this, format, freq); - } - - return source; -} diff --git a/src/audio/OpenAL/OpenAL/OpenALContext.hpp b/src/audio/OpenAL/OpenAL/OpenALContext.hpp deleted file mode 100644 index d287bccaf8814818676aa274f2735edab04f3a46..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALContext.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_CONTEXT_HPP__ -#define __SFLAUDIO_OPENAL_CONTEXT_HPP__ - -#include "Context.hpp" -#include "AL/alc.h" - -namespace SFLAudio -{ - class OpenALContext : public Context - { - private: - OpenALContext(); - - public: - OpenALContext(ALCcontext *context); - Source *createSource(int format, int freq); - - private: - ALCcontext *mContext; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenAL/OpenALDevice.cpp b/src/audio/OpenAL/OpenAL/OpenALDevice.cpp deleted file mode 100644 index a0437bf170128babd9144068ab01ef630323714a..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALDevice.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <AL/al.h> -#include <AL/alc.h> - - -#include "OpenAL/OpenALDevice.hpp" -#include "OpenAL/OpenALContext.hpp" -#include "OpenAL/OpenALLayer.hpp" -#include "Null/NullContext.hpp" -#include "Null/NullDevice.hpp" - -SFLAudio::OpenALDevice::OpenALDevice() - : mDevice(0) -{} - -SFLAudio::OpenALDevice::~OpenALDevice() -{ - unload(); -} - -void -SFLAudio::OpenALDevice::unload() { - if(mDevice) { - if(alcCloseDevice(mDevice) == ALC_FALSE) { - ALenum error = alcGetError(mDevice); - std::cerr << "OpenAL/OpenAL::alcCloseDevice: " << alGetString(error) << std::endl; - } - mDevice = 0; - } -} - - -bool -SFLAudio::OpenALDevice::load() { - ALCcontext *context = alcGetCurrentContext(); - mDevice = alcGetContextsDevice(context); - if(mDevice != 0) { - const ALCchar *device = alcGetString(mDevice, ALC_DEVICE_SPECIFIER); - setName(device); - } - - return mDevice; -} - - -SFLAudio::Context * -SFLAudio::OpenALDevice::createContext() -{ - SFLAudio::Context *context = NULL; - if (mDevice) { - ALCcontext *c = alcCreateContext(mDevice, NULL); - alcMakeContextCurrent(c); - if(c == NULL) { - ALenum error = alcGetError(mDevice); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL::alcCreateContext: " << alGetString(error) << std::endl; - } - context = new NullContext(); - } - else { - alcMakeContextCurrent(c); - context = new OpenALContext(c); - } - } - else { - context = new NullContext(); - } - - return context; -} diff --git a/src/audio/OpenAL/OpenAL/OpenALDevice.hpp b/src/audio/OpenAL/OpenAL/OpenALDevice.hpp deleted file mode 100644 index 1e9d1321baea95bba1b63520675ae75e8956951c..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALDevice.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_DEVICE_HPP__ -#define __SFLAUDIO_OPENAL_DEVICE_HPP__ - -#include <AL/alc.h> -#include "Device.hpp" - -namespace SFLAudio -{ - class OpenALDevice : public Device - { - public: - OpenALDevice(); - ~OpenALDevice(); - virtual bool load(); - virtual void unload(); - virtual Context *createContext(); - - private: - ALCdevice *mDevice; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenAL/OpenALLayer.cpp b/src/audio/OpenAL/OpenAL/OpenALLayer.cpp deleted file mode 100644 index ecd07628fc56e929456e8629d563bd56d3a279c5..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALLayer.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "OpenAL/OpenALLayer.hpp" -#include "OpenAL/OpenALDevice.hpp" -#include "MicEmitter.hpp" -#include "Null/NullDevice.hpp" -#include "Null/NullEmitter.hpp" - -#include <iostream> -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alext.h> -#include <AL/alut.h> - -#define DEFAULT_DEVICE_NAME "default" -#define DEFAULT_CAPTURE_DEVICE_NAME "default" - -#define MIC_FORMAT AL_FORMAT_MONO16 -#define FREQ 8192 -#define SAMPLES (1 * FREQ) -#define SIZE (SAMPLES * 2) - -#define GP(type,var,name) \ - var = (type)alGetProcAddress((const ALchar*) name); \ - if( var == NULL ) { \ - fprintf( stderr, "Could not get %s extension entry\n", name ); \ - } - - - -SFLAudio::OpenALLayer::OpenALLayer() - : AudioLayer("openal") -{ - alutInit(0, 0); - GP( PFNALCAPTUREINITPROC, palCaptureInit, "alCaptureInit_EXT" ); - GP( PFNALCAPTUREDESTROYPROC, palCaptureDestroy, - "alCaptureDestroy_EXT" ); - GP( PFNALCAPTURESTARTPROC, palCaptureStart, "alCaptureStart_EXT" ); - GP( PFNALCAPTURESTOPPROC, palCaptureStop, "alCaptureStop_EXT" ); - GP( PFNALCAPTUREGETDATAPROC, palCaptureGetData, - "alCaptureGetData_EXT" ); -} - - -SFLAudio::Emitter * -SFLAudio::OpenALLayer::openCaptureDevice() -{ - if(palCaptureInit == 0 || - !palCaptureInit( MIC_FORMAT, FREQ, 1024 ) ) { - printf( "Unable to initialize capture\n" ); - return new NullEmitter(); - } - - return new MicEmitter(MIC_FORMAT, FREQ, SIZE, - palCaptureStart, - palCaptureStop, - palCaptureGetData); -} - - -std::list< std::string > -SFLAudio::OpenALLayer::getDevicesNames() -{ - std::list< std::string > devices; - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { - const ALCchar *devs = alcGetString(NULL, ALC_DEVICE_SPECIFIER); - const ALCchar *devname = devs; - while(devname) { - devices.push_back(devname); - devname += sizeof(ALCchar) * (strlen(devname) + 1); - } - } - else { - devices.push_back(alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER)); - } - - - return devices; - -} - -std::list< std::string > -SFLAudio::OpenALLayer::getCaptureDevicesNames() -{ - std::list< std::string > devices; - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { - const ALCchar *devs = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); - const ALCchar *devname = devs; - while(devname) { - devices.push_back(devname); - devname += sizeof(ALCchar) * (strlen(devname) + 1); - } - } - else { - devices.push_back(alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); - } - - - return devices; - -} - - -SFLAudio::Device * -SFLAudio::OpenALLayer::openDevice() -{ - Device *dev = new OpenALDevice(); - if(dev->load()) { - dev->setName(DEFAULT_DEVICE_NAME); - } - else { - delete dev; - dev = new NullDevice(); - } - - return dev; -} - -SFLAudio::Device * -SFLAudio::OpenALLayer::openDevice(const std::string &) -{ - return openDevice(); -} - - diff --git a/src/audio/OpenAL/OpenAL/OpenALLayer.hpp b/src/audio/OpenAL/OpenAL/OpenALLayer.hpp deleted file mode 100644 index 0e2888c893a8db52b76d86c9c78e7849a7fb6db3..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALLayer.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_LAYER_HPP__ -#define __SFLAUDIO_OPENAL_LAYER_HPP__ - -#include <AL/alext.h> -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - - class OpenALLayer : public AudioLayer - { - public: - OpenALLayer(); - - virtual std::list< std::string > getDevicesNames(); - virtual std::list< std::string > getCaptureDevicesNames(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(); - virtual Device *openDevice(const std::string &name); - - private: - PFNALCAPTUREINITPROC palCaptureInit; - PFNALCAPTUREDESTROYPROC palCaptureDestroy; - PFNALCAPTURESTARTPROC palCaptureStart; - PFNALCAPTURESTOPPROC palCaptureStop; - PFNALCAPTUREGETDATAPROC palCaptureGetData; - - }; -} - -#endif - - diff --git a/src/audio/OpenAL/OpenAL/OpenALSource.cpp b/src/audio/OpenAL/OpenAL/OpenALSource.cpp deleted file mode 100644 index b551cc747bf9697c6a355e07abb52a0e0a4a6c49..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALSource.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alut.h> -#include <iostream> -#include <unistd.h> - -#include "Context.hpp" -#include "Null/NullSource.hpp" -#include "OpenAL/OpenALSource.hpp" - -SFLAudio::OpenALSource::OpenALSource(int format, int freq, ALuint buffer, ALuint source) - : Source(format, freq) - , mBuffer(buffer) - , mSource(source) - , mIsAttached(false) - , mIsStatic(true) -{ - mBuffers.push_back(buffer); -} - -SFLAudio::OpenALSource::~OpenALSource() -{ - alGetError(); - - alDeleteSources(1, &mSource); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alDeleteSources : " << alGetString(error) << std::endl; - } - - for(std::list< ALuint >::iterator pos = mBuffers.begin(); - pos != mBuffers.end(); - pos++) { - alDeleteBuffers(1, &(*pos)); - error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alDeleteBuffers : " << alGetString(error) << std::endl; - } - } -} - - -bool -SFLAudio::OpenALSource::genBuffer(ALuint &buffer) { - // Generate buffer - alGetError(); // clear error code - alGenBuffers(1, &buffer); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alGenBuffers : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::genSource(ALuint &source) { - // Generate buffer - alGetError(); // clear error code - alGenSources(1, &source); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alGenSources : " << alGetString(error) << std::endl;; - return false; - } - - alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); - alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); - alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); - alSourcef (source, AL_ROLLOFF_FACTOR, 0.0); - alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE); - - return true; -} - -bool -SFLAudio::OpenALSource::deleteSource(ALuint &source) { - // Generate buffer - alGetError(); // clear error code - alDeleteSources(1, &source); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alDeleteSources : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::deleteBuffer(ALuint &buffer) { - // Generate buffer - alGetError(); // clear error code - alDeleteBuffers(1, &buffer); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alDeleteBuffers : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::detach() -{ - alSourcei(mSource, AL_BUFFER, 0); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alSourcei : " << alGetString(error); - return false; - } - - mIsAttached = false; - - return true; -} - -ALuint -SFLAudio::OpenALSource::getSourceState() -{ -// ALint answer; -// alGetError(); - -// alGetSourcei(mSource, AL_SOURCE_TYPE, &answer); -// ALenum error = alGetError(); -// if(error != AL_NO_ERROR) { -// std::cerr << "OpenAL/OpenAL: alGetSourcei(state) : " << alGetString(error); -// return AL_UNDETERMINED; -// } - -// return answer; - - if(!mIsAttached) { - return AL_UNDETERMINED; - } - - if(mIsStatic) { - return AL_STATIC; - } - - return AL_STREAMING; -} - -bool -SFLAudio::OpenALSource::isStatic() -{ - return (getSourceState() == AL_STATIC); -} - -bool -SFLAudio::OpenALSource::isUndetermined() -{ - return (getSourceState() == AL_UNDETERMINED); -} - -bool -SFLAudio::OpenALSource::isStreaming() -{ - return (getSourceState() == AL_STREAMING); -} - -bool -SFLAudio::OpenALSource::isAttached() -{ - return (getSourceState() != AL_UNDETERMINED); -} - -bool check(const char *message) { - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << message << alGetString(error); - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::attach() -{ - if(isAttached()) { - if(isStatic() == true) { - // it's already attached as static - return true; - } - - detach(); - } - - // Attach buffer to source - alSourcei(mSource, AL_BUFFER, mBuffer); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alSourcei : " << alGetString(error); - return false; - } - - mIsAttached = true; - mIsStatic = true; - - return true; -} - -SFLAudio::Source * -SFLAudio::OpenALSource::create(OpenALContext *, int format, int freq) { - ALuint buffer; - ALuint source; - - // Generate buffer - if(!genBuffer(buffer)){ - deleteBuffer(buffer); - return new NullSource(); - } - - // Generate source - if(!genSource(source)){ - deleteBuffer(buffer); - deleteSource(source); - return new NullSource(); - } - - return new OpenALSource(format, freq, buffer, source); -} - - -bool -SFLAudio::OpenALSource::isPlaying() -{ - ALint state; - if(alIsSource(mSource) == AL_FALSE) { - return false; - } - - alGetSourcei(mSource, AL_SOURCE_STATE, &state); - - return (state == AL_PLAYING); -} - -void -SFLAudio::OpenALSource::stream(void *data, int size) -{ - int processed; - ALuint buffer; - - alGetSourcei(mSource, AL_BUFFERS_PROCESSED, &processed); - - if(processed == 0) { - if(genBuffer(buffer) == false) { - return; - } - - // Attach streaming buffer to source - alSourceQueueBuffers(mSource, 1, &buffer); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alSourceQueueBuffers : " << alGetString(error); - return; - } - mBuffers.push_back(buffer); - - mIsAttached = true; - mIsStatic = false; - - } - else { - alSourceUnqueueBuffers(mSource, 1, &buffer); - } - - alBufferData(buffer, getFormat(), data, size, getFrequency()); - alSourceQueueBuffers(mSource, 1, &buffer); - - if(!isPlaying()) { - alSourcePlay(mSource); - } -} - -void -SFLAudio::OpenALSource::play(void *data, int size) -{ - attach(); - - alGetError(); - - // Copy data into AL Buffer - alBufferData(mBuffer, getFormat(), data, size, getFrequency()); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: alBufferData : " << alGetString(error); - } - - alSourcePlay(mSource); -} - -void -SFLAudio::OpenALSource::stop() -{ - alSourceStop(mSource); -} diff --git a/src/audio/OpenAL/OpenAL/OpenALSource.hpp b/src/audio/OpenAL/OpenAL/OpenALSource.hpp deleted file mode 100644 index 42b92b05cbf462fdc87dcbff7698ca9bf9fb5f93..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/OpenALSource.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_SOURCE_HPP__ -#define __SFLAUDIO_OPENAL_SOURCE_HPP__ - -#include <list> - -#include <AL/al.h> -#include <AL/alc.h> -#include "Source.hpp" - -namespace SFLAudio -{ - class OpenALContext; - - class OpenALSource : public Source - { - private: - OpenALSource(); - - public: - OpenALSource(int format, int freq, ALuint buffer, ALuint source); - ~OpenALSource(); - - static Source *create(OpenALContext *context, int format, int freq); - - // Source functions - virtual bool isPlaying(); - virtual void play(void *data, int size); - virtual void stream(void *data, int size); - virtual void stop(); - - private: - ALuint getSourceState(); - bool isStatic(); - bool isAttached(); - bool isStreaming(); - bool isUndetermined(); - bool attach(); - bool detach(); - - bool check(const char *message); - - static bool genBuffer(ALuint &buffer); - static bool genSource(ALuint &source); - static bool deleteBuffer(ALuint &buffer); - static bool deleteSource(ALuint &source); - - - private: - // Buffers that we'll eventually need to delete - std::list< ALuint > mBuffers; - - // Buffers to hold sound data. - ALuint mBuffer; - - // Sources are points of emitting sound. - ALuint mSource; - - bool mIsAttached; - bool mIsStatic; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenAL/WavEmitter.cpp b/src/audio/OpenAL/OpenAL/WavEmitter.cpp deleted file mode 100644 index eb7a98f986f9c82ac24a418fc16a1503eb9f5971..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/WavEmitter.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/alut.h> -#include <iostream> - -#include "WavEmitter.hpp" -#include "Source.hpp" - -SFLAudio::WavEmitter::WavEmitter(char *filename) - : mData(0) - , mSize(0) -{ - ALenum format; - ALsizei freq; - ALboolean loop; - - // Load test.wav - alutLoadWAVFile(filename, &format,&mData,&mSize,&freq,&loop); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: loadWAVFile : " << alGetString(error); - mData = 0; - } - else { - setFrequency(freq); - setFormat(format); - } -} - -void -SFLAudio::WavEmitter::play() -{ - Source *source = getSource(); - if(source && mData) { - source->play(mData, mSize); - - // Unload test.wav - alutUnloadWAV(getFormat(), mData, mSize, getFrequency()); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: unloadWAV : " << alGetString(error); - } - } -} diff --git a/src/audio/OpenAL/OpenAL/WavEmitter.hpp b/src/audio/OpenAL/OpenAL/WavEmitter.hpp deleted file mode 100644 index 34af517b0eeee5aed5046d9edf1e907bc51326e2..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenAL/WavEmitter.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_WAV_EMITTER_HPP__ -#define __SFLAUDIO_WAV_EMITTER_HPP__ - -#include <AL/al.h> -#include "Emitter.hpp" - -namespace SFLAudio -{ - class Source; - - class WavEmitter : public Emitter - { - private: - WavEmitter(); - - public: - WavEmitter(char *filename); - void play(); - - private: - ALvoid *mData; - ALsizei mSize; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenALContext.cpp b/src/audio/OpenAL/OpenALContext.cpp deleted file mode 100644 index b6cf92b65bba91db7732567081382196a97221fe..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALContext.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> - -#include "OpenALContext.hpp" -#include "OpenALSource.hpp" -#include "NullSource.hpp" - -SFLAudio::OpenALContext::OpenALContext(ALCcontext *context) - : mContext(context) -{} - -SFLAudio::Source * -SFLAudio::OpenALContext::createSource(int format, int freq) -{ - Source *source = 0; - if(mContext == 0) { - source = new NullSource(); - } - else { - source = OpenALSource::create(this, format, freq); - } - - return source; -} diff --git a/src/audio/OpenAL/OpenALContext.hpp b/src/audio/OpenAL/OpenALContext.hpp deleted file mode 100644 index d287bccaf8814818676aa274f2735edab04f3a46..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALContext.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_CONTEXT_HPP__ -#define __SFLAUDIO_OPENAL_CONTEXT_HPP__ - -#include "Context.hpp" -#include "AL/alc.h" - -namespace SFLAudio -{ - class OpenALContext : public Context - { - private: - OpenALContext(); - - public: - OpenALContext(ALCcontext *context); - Source *createSource(int format, int freq); - - private: - ALCcontext *mContext; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenALDevice.cpp b/src/audio/OpenAL/OpenALDevice.cpp deleted file mode 100644 index ffdd537388f8a634c094724a50cf3670da30a98a..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALDevice.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <AL/al.h> -#include <AL/alc.h> - - -#include "OpenALDevice.hpp" -#include "OpenALContext.hpp" -#include "OpenALLayer.hpp" -#include "NullContext.hpp" -#include "NullDevice.hpp" - -SFLAudio::OpenALDevice::OpenALDevice() - : mDevice(0) -{} - -SFLAudio::OpenALDevice::~OpenALDevice() -{ - unload(); -} - -void -SFLAudio::OpenALDevice::unload() { - if(mDevice) { - if(alcCloseDevice(mDevice) == ALC_FALSE) { - ALenum error = alcGetError(mDevice); - std::cerr << "OpenAL::alcCloseDevice: " << alGetString(error) << std::endl; - } - mDevice = 0; - } -} - - -bool -SFLAudio::OpenALDevice::load() { - ALCcontext *context = alcGetCurrentContext(); - mDevice = alcGetContextsDevice(context); - if(mDevice != 0) { - const ALCchar *device = alcGetString(mDevice, ALC_DEVICE_SPECIFIER); - setName(device); - } - - return mDevice; -} - - -SFLAudio::Context * -SFLAudio::OpenALDevice::createContext() -{ - SFLAudio::Context *context = NULL; - if (mDevice) { - ALCcontext *c = alcCreateContext(mDevice, NULL); - alcMakeContextCurrent(c); - if(c == NULL) { - ALenum error = alcGetError(mDevice); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL::alcCreateContext: " << alGetString(error) << std::endl; - } - context = new NullContext(); - } - else { - alcMakeContextCurrent(c); - context = new OpenALContext(c); - } - } - else { - context = new NullContext(); - } - - return context; -} diff --git a/src/audio/OpenAL/OpenALDevice.hpp b/src/audio/OpenAL/OpenALDevice.hpp deleted file mode 100644 index 1e9d1321baea95bba1b63520675ae75e8956951c..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALDevice.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_DEVICE_HPP__ -#define __SFLAUDIO_OPENAL_DEVICE_HPP__ - -#include <AL/alc.h> -#include "Device.hpp" - -namespace SFLAudio -{ - class OpenALDevice : public Device - { - public: - OpenALDevice(); - ~OpenALDevice(); - virtual bool load(); - virtual void unload(); - virtual Context *createContext(); - - private: - ALCdevice *mDevice; - }; -} - -#endif diff --git a/src/audio/OpenAL/OpenALLayer.cpp b/src/audio/OpenAL/OpenALLayer.cpp deleted file mode 100644 index 83e1d0e9c63ad6813f9cd2e41c3132637aca27d2..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALLayer.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "OpenALLayer.hpp" -#include "OpenALDevice.hpp" -#include "MicEmitter.hpp" -#include "NullDevice.hpp" -#include "NullEmitter.hpp" - -#include <iostream> -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alext.h> -#include <AL/alut.h> - -#define DEFAULT_DEVICE_NAME "default" -#define DEFAULT_CAPTURE_DEVICE_NAME "default" - -#define MIC_FORMAT AL_FORMAT_MONO8 -#define FREQ 8192 -#define SAMPLES (5 * FREQ) -#define SIZE (SAMPLES * 1) - -#define GP(type,var,name) \ - var = (type)alGetProcAddress((const ALchar*) name); \ - if( var == NULL ) { \ - fprintf( stderr, "Could not get %s extension entry\n", name ); \ - } - - - -SFLAudio::OpenALLayer::OpenALLayer() - : AudioLayer("openal") -{ - alutInit(0, 0); - GP( PFNALCAPTUREINITPROC, palCaptureInit, "alCaptureInit_EXT" ); - GP( PFNALCAPTUREDESTROYPROC, palCaptureDestroy, - "alCaptureDestroy_EXT" ); - GP( PFNALCAPTURESTARTPROC, palCaptureStart, "alCaptureStart_EXT" ); - GP( PFNALCAPTURESTOPPROC, palCaptureStop, "alCaptureStop_EXT" ); - GP( PFNALCAPTUREGETDATAPROC, palCaptureGetData, - "alCaptureGetData_EXT" ); -} - - -SFLAudio::Emitter * -SFLAudio::OpenALLayer::openCaptureDevice() -{ - if(palCaptureInit == 0 || - !palCaptureInit( MIC_FORMAT, FREQ, 1024 ) ) { - printf( "Unable to initialize capture\n" ); - return new NullEmitter(); - } - - return new MicEmitter(MIC_FORMAT, FREQ, SIZE, - palCaptureStart, - palCaptureStop, - palCaptureGetData); -} - - -std::list< std::string > -SFLAudio::OpenALLayer::getDevicesNames() -{ - std::list< std::string > devices; - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { - const ALCchar *devs = alcGetString(NULL, ALC_DEVICE_SPECIFIER); - const ALCchar *devname = devs; - while(devname) { - devices.push_back(devname); - devname += sizeof(ALCchar) * (strlen(devname) + 1); - } - } - else { - devices.push_back(DEFAULT_DEVICE_NAME); - } - - - return devices; - -} - -std::list< std::string > -SFLAudio::OpenALLayer::getCaptureDevicesNames() -{ - std::list< std::string > devices; - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { - const ALCchar *devs = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); - const ALCchar *devname = devs; - while(devname) { - devices.push_back(devname); - devname += sizeof(ALCchar) * (strlen(devname) + 1); - } - } - else { - devices.push_back(DEFAULT_CAPTURE_DEVICE_NAME); - } - - - return devices; - -} - - -SFLAudio::Device * -SFLAudio::OpenALLayer::openDevice() -{ - Device *dev = new OpenALDevice(); - if(dev->load()) { - dev->setName(DEFAULT_DEVICE_NAME); - } - else { - delete dev; - dev = new NullDevice(); - } - - return dev; -} - -SFLAudio::Device * -SFLAudio::OpenALLayer::openDevice(const std::string &) -{ - return openDevice(); -} - - diff --git a/src/audio/OpenAL/OpenALLayer.hpp b/src/audio/OpenAL/OpenALLayer.hpp deleted file mode 100644 index 0e2888c893a8db52b76d86c9c78e7849a7fb6db3..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALLayer.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_LAYER_HPP__ -#define __SFLAUDIO_OPENAL_LAYER_HPP__ - -#include <AL/alext.h> -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - - class OpenALLayer : public AudioLayer - { - public: - OpenALLayer(); - - virtual std::list< std::string > getDevicesNames(); - virtual std::list< std::string > getCaptureDevicesNames(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(); - virtual Device *openDevice(const std::string &name); - - private: - PFNALCAPTUREINITPROC palCaptureInit; - PFNALCAPTUREDESTROYPROC palCaptureDestroy; - PFNALCAPTURESTARTPROC palCaptureStart; - PFNALCAPTURESTOPPROC palCaptureStop; - PFNALCAPTUREGETDATAPROC palCaptureGetData; - - }; -} - -#endif - - diff --git a/src/audio/OpenAL/OpenALSource.cpp b/src/audio/OpenAL/OpenALSource.cpp deleted file mode 100644 index b6716ae1709e363509c3d5de3614456fe003277f..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALSource.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alut.h> -#include <iostream> -#include <unistd.h> - -#include "Context.hpp" -#include "NullSource.hpp" -#include "OpenALSource.hpp" - -SFLAudio::OpenALSource::OpenALSource(int format, int freq, ALuint buffer, ALuint source) - : Source(format, freq) - , mBuffer(buffer) - , mSource(source) - , mIsAttached(false) - , mIsStatic(true) -{ - mBuffers.push_back(buffer); -} - -SFLAudio::OpenALSource::~OpenALSource() -{ - alGetError(); - - alDeleteSources(1, &mSource); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL: alDeleteSources : " << alGetString(error) << std::endl; - } - - for(std::list< ALuint >::iterator pos = mBuffers.begin(); - pos != mBuffers.end(); - pos++) { - alDeleteBuffers(1, &(*pos)); - error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL: alDeleteBuffers : " << alGetString(error) << std::endl; - } - } -} - - -bool -SFLAudio::OpenALSource::genBuffer(ALuint &buffer) { - // Generate buffer - alGetError(); // clear error code - alGenBuffers(1, &buffer); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: alGenBuffers : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::genSource(ALuint &source) { - // Generate buffer - alGetError(); // clear error code - alGenSources(1, &source); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: alGenSources : " << alGetString(error) << std::endl;; - return false; - } - - alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); - alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); - alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); - alSourcef (source, AL_ROLLOFF_FACTOR, 0.0); - alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE); - - return true; -} - -bool -SFLAudio::OpenALSource::deleteSource(ALuint &source) { - // Generate buffer - alGetError(); // clear error code - alDeleteSources(1, &source); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: alDeleteSources : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::deleteBuffer(ALuint &buffer) { - // Generate buffer - alGetError(); // clear error code - alDeleteBuffers(1, &buffer); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: alDeleteBuffers : " << alGetString(error) << std::endl;; - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::detach() -{ - alSourcei(mSource, AL_BUFFER, 0); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL: alSourcei : " << alGetString(error); - return false; - } - - mIsAttached = false; - - return true; -} - -ALuint -SFLAudio::OpenALSource::getSourceState() -{ -// ALint answer; -// alGetError(); - -// alGetSourcei(mSource, AL_SOURCE_TYPE, &answer); -// ALenum error = alGetError(); -// if(error != AL_NO_ERROR) { -// std::cerr << "OpenAL: alGetSourcei(state) : " << alGetString(error); -// return AL_UNDETERMINED; -// } - -// return answer; - - if(!mIsAttached) { - return AL_UNDETERMINED; - } - - if(mIsStatic) { - return AL_STATIC; - } - - return AL_STREAMING; -} - -bool -SFLAudio::OpenALSource::isStatic() -{ - return (getSourceState() == AL_STATIC); -} - -bool -SFLAudio::OpenALSource::isUndetermined() -{ - return (getSourceState() == AL_UNDETERMINED); -} - -bool -SFLAudio::OpenALSource::isStreaming() -{ - return (getSourceState() == AL_STREAMING); -} - -bool -SFLAudio::OpenALSource::isAttached() -{ - return (getSourceState() != AL_UNDETERMINED); -} - -bool check(const char *message) { - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << message << alGetString(error); - return false; - } - - return true; -} - -bool -SFLAudio::OpenALSource::attach() -{ - if(isAttached()) { - if(isStatic() == true) { - // it's already attached as static - return true; - } - - detach(); - } - - // Attach buffer to source - alSourcei(mSource, AL_BUFFER, mBuffer); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL: alSourcei : " << alGetString(error); - return false; - } - - mIsAttached = true; - mIsStatic = true; - - return true; -} - -SFLAudio::Source * -SFLAudio::OpenALSource::create(OpenALContext *, int format, int freq) { - ALuint buffer; - ALuint source; - - // Generate buffer - if(!genBuffer(buffer)){ - deleteBuffer(buffer); - return new NullSource(); - } - - // Generate source - if(!genSource(source)){ - deleteBuffer(buffer); - deleteSource(source); - return new NullSource(); - } - - return new OpenALSource(format, freq, buffer, source); -} - - -bool -SFLAudio::OpenALSource::isPlaying() -{ - ALint state; - if(alIsSource(mSource) == AL_FALSE) { - return false; - } - - alGetSourcei(mSource, AL_SOURCE_STATE, &state); - - return (state == AL_PLAYING); -} - -void -SFLAudio::OpenALSource::stream(void *data, int size) -{ - int processed; - ALuint buffer; - - alGetSourcei(mSource, AL_BUFFERS_PROCESSED, &processed); - - if(processed == 0) { - if(genBuffer(buffer) == false) { - return; - } - - // Attach streaming buffer to source - alSourceQueueBuffers(mSource, 1, &buffer); - ALenum error = alGetError(); - if(error != AL_NO_ERROR) { - std::cerr << "OpenAL: alSourceQueueBuffers : " << alGetString(error); - return; - } - mBuffers.push_back(buffer); - - mIsAttached = true; - mIsStatic = false; - - } - else { - alSourceUnqueueBuffers(mSource, 1, &buffer); - } - - alBufferData(buffer, getFormat(), data, size, getFrequency()); - alSourceQueueBuffers(mSource, 1, &buffer); - - if(!isPlaying()) { - alSourcePlay(mSource); - } -} - -void -SFLAudio::OpenALSource::play(void *data, int size) -{ - attach(); - - alGetError(); - - // Copy data into AL Buffer - alBufferData(mBuffer, getFormat(), data, size, getFrequency()); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: alBufferData : " << alGetString(error); - } - - alSourcePlay(mSource); -} - -void -SFLAudio::OpenALSource::stop() -{ - alSourceStop(mSource); -} diff --git a/src/audio/OpenAL/OpenALSource.hpp b/src/audio/OpenAL/OpenALSource.hpp deleted file mode 100644 index 42b92b05cbf462fdc87dcbff7698ca9bf9fb5f93..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/OpenALSource.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_OPENAL_SOURCE_HPP__ -#define __SFLAUDIO_OPENAL_SOURCE_HPP__ - -#include <list> - -#include <AL/al.h> -#include <AL/alc.h> -#include "Source.hpp" - -namespace SFLAudio -{ - class OpenALContext; - - class OpenALSource : public Source - { - private: - OpenALSource(); - - public: - OpenALSource(int format, int freq, ALuint buffer, ALuint source); - ~OpenALSource(); - - static Source *create(OpenALContext *context, int format, int freq); - - // Source functions - virtual bool isPlaying(); - virtual void play(void *data, int size); - virtual void stream(void *data, int size); - virtual void stop(); - - private: - ALuint getSourceState(); - bool isStatic(); - bool isAttached(); - bool isStreaming(); - bool isUndetermined(); - bool attach(); - bool detach(); - - bool check(const char *message); - - static bool genBuffer(ALuint &buffer); - static bool genSource(ALuint &source); - static bool deleteBuffer(ALuint &buffer); - static bool deleteSource(ALuint &source); - - - private: - // Buffers that we'll eventually need to delete - std::list< ALuint > mBuffers; - - // Buffers to hold sound data. - ALuint mBuffer; - - // Sources are points of emitting sound. - ALuint mSource; - - bool mIsAttached; - bool mIsStatic; - }; -} - -#endif diff --git a/src/audio/OpenAL/PortAudio/PortAudioLayer.cpp b/src/audio/OpenAL/PortAudio/PortAudioLayer.cpp deleted file mode 100644 index 3a9c7315b6c89736829ce2ca1f56548ee171e087..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/PortAudio/PortAudioLayer.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "PortAudio/PortAudioLayer.hpp" -#include "portaudio.h" - -#include "Null/NullDevice.hpp" -#include "Null/NullEmitter.hpp" - - -SFLAudio::PortAudioLayer::PortAudioLayer() - : AudioLayer("portaudio") -{ - Pa_Initialize(); -} - -SFLAudio::PortAudioLayer::~PortAudioLayer() -{ - Pa_Terminate(); -} - - - -std::list< std::string > -SFLAudio::PortAudioLayer::getDevicesNames() -{ - refreshDevices(); - - std::list< std::string > devices; - for(DevicesType::iterator pos = mDevices.begin(); - pos != mDevices.end(); - pos++) { - devices.push_back(pos->first); - } - - return devices; -} - - -std::list< std::string > -SFLAudio::PortAudioLayer::getCaptureDevicesNames() -{ - return std::list< std::string >(); -} - - -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() -{ - return new NullDevice(); -} - -SFLAudio::Emitter * -SFLAudio::PortAudioLayer::openCaptureDevice() -{ - return new NullEmitter(); -} - -SFLAudio::Device * -SFLAudio::PortAudioLayer::openDevice(const std::string &) -{ - return new NullDevice(); -} diff --git a/src/audio/OpenAL/PortAudio/PortAudioLayer.hpp b/src/audio/OpenAL/PortAudio/PortAudioLayer.hpp deleted file mode 100644 index 9db73d523e62e4ba1cac892d1dada02526d14766..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/PortAudio/PortAudioLayer.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_PORTAUDIO_LAYER_HPP__ -#define __SFLAUDIO_PORTAUDIO_LAYER_HPP__ - -#include <map> - -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - class PortAudioLayer : public AudioLayer - { - public: - PortAudioLayer(); - ~PortAudioLayer(); - - virtual std::list< std::string > getDevicesNames(); - virtual std::list< std::string > getCaptureDevicesNames(); - virtual Device *openDevice(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(const std::string &name); - - private: - virtual void refreshDevices(); - - private: - typedef std::map< std::string, int > DevicesType; - DevicesType mDevices; - }; -} - -#endif - - diff --git a/src/audio/OpenAL/PortAudioLayer.cpp b/src/audio/OpenAL/PortAudioLayer.cpp deleted file mode 100644 index da9602b19c08e287fa109a3dc7f8d079446ecabf..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/PortAudioLayer.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "PortAudioLayer.hpp" -#include "portaudio.h" - -#include "NullDevice.hpp" -#include "NullEmitter.hpp" - - -SFLAudio::PortAudioLayer::PortAudioLayer() - : AudioLayer("portaudio") -{ - Pa_Initialize(); -} - -SFLAudio::PortAudioLayer::~PortAudioLayer() -{ - Pa_Terminate(); -} - - - -std::list< std::string > -SFLAudio::PortAudioLayer::getDevicesNames() -{ - refreshDevices(); - - 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() -{ - return new NullDevice(); -} - -SFLAudio::Emitter * -SFLAudio::PortAudioLayer::openCaptureDevice() -{ - return new NullEmitter(); -} - -SFLAudio::Device * -SFLAudio::PortAudioLayer::openDevice(const std::string &) -{ - return new NullDevice(); -} diff --git a/src/audio/OpenAL/PortAudioLayer.hpp b/src/audio/OpenAL/PortAudioLayer.hpp deleted file mode 100644 index 9b58451d0208f0b5bedac35da3667d895f52e568..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/PortAudioLayer.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_PORTAUDIO_LAYER_HPP__ -#define __SFLAUDIO_PORTAUDIO_LAYER_HPP__ - -#include <map> - -#include "AudioLayer.hpp" - -namespace SFLAudio -{ - class PortAudioLayer : public AudioLayer - { - public: - PortAudioLayer(); - ~PortAudioLayer(); - - virtual std::list< std::string > getDevicesNames(); - virtual Device *openDevice(); - virtual Emitter *openCaptureDevice(); - virtual Device *openDevice(const std::string &name); - - private: - virtual void refreshDevices(); - - private: - typedef std::map< std::string, int > DevicesType; - DevicesType mDevices; - }; -} - -#endif - - diff --git a/src/audio/OpenAL/README.txt b/src/audio/OpenAL/README.txt deleted file mode 100644 index 6006f0f69bd08d61096afc02db837c08c63bddb6..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -example01.cpp: This is an enumeration of device example. -example02.cpp: A simple WAV player with a direct handling of sound buffer. -example03.cpp: A simple WAV player, with 2 files playing at the same time. -example04.cpp: A simple WAV player. (Uses the simple WavEmitter class) -example05.cpp: A Capture example. -example06.cpp: A OGG streaming example. \ No newline at end of file diff --git a/src/audio/OpenAL/SFLAudio.hpp b/src/audio/OpenAL/SFLAudio.hpp deleted file mode 100644 index 28c1202faf5f37fe0b5c60ca0dc8d608be56bb1b..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/SFLAudio.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "AudioManager.hpp" -#include "AudioLayer.hpp" -#include "Device.hpp" -#include "Context.hpp" -#include "Source.hpp" - diff --git a/src/audio/OpenAL/Source.cpp b/src/audio/OpenAL/Source.cpp deleted file mode 100644 index ff35229517122cc64d31f4cb06db784349b8f118..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alut.h> -#include <iostream> -#include <unistd.h> - -#include "Context.hpp" -#include "Null/NullSource.hpp" -#include "OpenAL/OpenALSource.hpp" - -SFLAudio::Source::Source(int format, int freq) - : mFormat(format) - , mFreq(freq) -{} diff --git a/src/audio/OpenAL/Source.hpp b/src/audio/OpenAL/Source.hpp deleted file mode 100644 index a03215c2d0a51281d6a2bcdaee002315c7604fbd..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/Source.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_SOURCE_HPP__ -#define __SFLAUDIO_SOURCE_HPP__ - -namespace SFLAudio -{ - class Source - { - private: - Source(); - - public: - Source(int format, int freq); - - virtual bool isNull() {return false;} - virtual bool isPlaying() = 0; - virtual void stream(void *data, int size) = 0; - virtual void play(void *data, int size) = 0; - virtual void stop() = 0; - - int getFrequency() {return mFreq;} - int getFormat() {return mFormat;} - - private: - int mFormat; - int mFreq; - }; -} - -#endif - diff --git a/src/audio/OpenAL/WavEmitter.cpp b/src/audio/OpenAL/WavEmitter.cpp deleted file mode 100644 index 9bd47b34da1021b34ab11763e2b1e5c18fb7bb76..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/WavEmitter.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <AL/alut.h> -#include <iostream> - -#include "WavEmitter.hpp" -#include "Source.hpp" - -SFLAudio::WavEmitter::WavEmitter(char *filename) - : mData(0) - , mSize(0) -{ - ALenum format; - ALsizei freq; - ALboolean loop; - - // Load test.wav - alutLoadWAVFile(filename, &format,&mData,&mSize,&freq,&loop); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: loadWAVFile : " << alGetString(error); - mData = 0; - } - else { - setFrequency(freq); - setFormat(format); - } -} - -void -SFLAudio::WavEmitter::play() -{ - Source *source = getSource(); - if(source && mData) { - source->play(mData, mSize); - - // Unload test.wav - alutUnloadWAV(getFormat(), mData, mSize, getFrequency()); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL: unloadWAV : " << alGetString(error); - } - } -} diff --git a/src/audio/OpenAL/WavEmitter.hpp b/src/audio/OpenAL/WavEmitter.hpp deleted file mode 100644 index 34af517b0eeee5aed5046d9edf1e907bc51326e2..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/WavEmitter.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SFLAUDIO_WAV_EMITTER_HPP__ -#define __SFLAUDIO_WAV_EMITTER_HPP__ - -#include <AL/al.h> -#include "Emitter.hpp" - -namespace SFLAudio -{ - class Source; - - class WavEmitter : public Emitter - { - private: - WavEmitter(); - - public: - WavEmitter(char *filename); - void play(); - - private: - ALvoid *mData; - ALsizei mSize; - }; -} - -#endif diff --git a/src/audio/OpenAL/example01.cpp b/src/audio/OpenAL/example01.cpp deleted file mode 100644 index db398d86e1952a248873e0f6f723cf834f6cdc4e..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/example01.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <list> -#include <string> - -#include "AudioManager.hpp" -#include "AudioLayer.hpp" - - -int main(int, char* []) -{ - std::list< SFLAudio::AudioLayer * > layers = - SFLAudio::AudioManager::instance().getLayers(); - for(std::list< SFLAudio::AudioLayer *>::iterator it = layers.begin(); - it != layers.end(); - it++) { - std::cout << "Layer: " << (*it)->getName() << std::endl; - std::list< std::string > devices = (*it)->getDevicesNames(); - for(std::list< std::string >::iterator device = devices.begin(); - device != devices.end(); - device++) { - std::cout << " Device: " << *device << std::endl; - } - } -} diff --git a/src/audio/OpenAL/example02.cpp b/src/audio/OpenAL/example02.cpp deleted file mode 100644 index f0370cef62b14ba61a022e3b1c440c6bbe91d41a..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/example02.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <list> -#include <string> - -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alut.h> - -#include "SFLAudio.hpp" - -using namespace SFLAudio; - -int main(int, char* []) -{ - ALenum format; - ALvoid *data; - ALsizei size; - ALsizei freq; - ALboolean loop; - - AudioLayer *layer = SFLAudio::AudioManager::instance().currentLayer(); - Device *device = layer->openDevice(); - Context *context = device->createContext(); - - // Load test.wav - alutLoadWAVFile("test.wav",&format,&data,&size,&freq,&loop); - ALenum error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: loadWAVFile : " << alGetString(error); - return 1; - } - - Source *source = context->createSource(format, freq); - source->play(data, size); - - // Unload test.wav - alutUnloadWAV(format, data, size, freq); - std::cin.get(); - error = alGetError(); - - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: unloadWAV : " << alGetString(error); - } - - -} diff --git a/src/audio/OpenAL/example03.cpp b/src/audio/OpenAL/example03.cpp deleted file mode 100644 index c0c60cf2bf1f9980f5a5a05b25c4f1ac2bd9d1a8..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/example03.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <list> -#include <string> - -#include <AL/al.h> -#include <AL/alc.h> -#include <AL/alut.h> - -#include "SFLAudio.hpp" - -using namespace SFLAudio; - -struct Info -{ - ALenum format; - ALvoid *data; - ALsizei size; - ALsizei freq; - ALboolean loop; -}; - -int main(int argc, char* argv[]) -{ - AudioLayer *layer = SFLAudio::AudioManager::instance().currentLayer(); - Device *device = layer->openDevice(); - Context *context = device->createContext(); - - ALbyte *files[] = {"test.wav", "test2.wav"}; - - - Info *infos = new Info[2]; - ALenum error; - - // Load wav files - for(int i = 0; i < 2; i++) { - alutLoadWAVFile(files[i], - &infos[i].format, - &infos[i].data, - &infos[i].size, - &infos[i].freq, - &infos[i].loop); - error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: loadWAVFile : " << alGetString(error); - return 1; - } - } - - // Start the wav playing. - for(int i = 0; i < 2; i++) { - Source *source = context->createSource(infos[i].format, infos[i].freq); - source->play(infos[i].data, infos[i].size); - } - - // Unload wav files - for(int i = 0; i < 2; i++) { - alutUnloadWAV(infos[i].format, - infos[i].data, - infos[i].size, - infos[i].freq); - error = alGetError(); - if (error != AL_NO_ERROR) { - std::cerr << "OpenAL/OpenAL: unloadWAV : " << alGetString(error); - } - } - - // Wait for user input. - std::cout << "Press any key to quit the program." << std::endl; - std::cin.get(); -} - diff --git a/src/audio/OpenAL/example04.cpp b/src/audio/OpenAL/example04.cpp deleted file mode 100644 index 606ade66b12960cfdaf099de3cc0dab3e99cc135..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/example04.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <list> -#include <string> - -#include "SFLAudio.hpp" -#include "WavEmitter.hpp" - -using namespace SFLAudio; - -int main(int, char* []) -{ - AudioLayer *layer = SFLAudio::AudioManager::instance().currentLayer(); - Device *device = layer->openDevice(); - Context *context = device->createContext(); - - // Load test.wav - SFLAudio::WavEmitter wav("test.wav"); - wav.connect(context); - - wav.play(); - - // Wait for user input. - std::cout << "Press any key to quit the program." << std::endl; - std::cin.get(); -} diff --git a/src/audio/OpenAL/example05.cpp b/src/audio/OpenAL/example05.cpp deleted file mode 100644 index 4e49d987c92d2801fe0b6b548f5dbdc62a03a691..0000000000000000000000000000000000000000 --- a/src/audio/OpenAL/example05.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jean-Philippe Barrette-LaPierre - * <jean-philippe.barrette-lapierre@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <list> -#include <string> - -#include "SFLAudio.hpp" -#include "Emitter.hpp" - -using namespace SFLAudio; - -int main(int, char* []) -{ - AudioLayer *layer = SFLAudio::AudioManager::instance().currentLayer(); - Device *device = layer->openDevice(); - Context *context = device->createContext(); - Emitter *mic = layer->openCaptureDevice(); - - mic->connect(context); - mic->play(); - - // Wait for user input. - std::cout << "Press any key to quit the program." << std::endl; - std::cin.get(); -}