Skip to content
Snippets Groups Projects
Commit 6b052b39 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Remove unuseful audio code

OpenAL and portaudio
parent 95a8c71f
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1154 deletions
/*
* 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;
}
/*
* 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
/**
* 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
/*
* 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));
}
/*
* 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
/*
* 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;
}
/*
* 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
/*
* 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;
}
/*
* 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
/*
* 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;}
/*
* 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
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
/*
* 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;
}
}
/*
* 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
/*
* 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();
}
/*
* 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
/*
* 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;
}
/*
* 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
/*
* 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
/*
* 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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment