post-Kernel
This commit is contained in:
parent
23324b1508
commit
51f0f64807
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: AudioCore.hpp,v 1.2 2005/03/01 07:51:23 cozman Exp $
|
||||
// $Id: AudioCore.hpp,v 1.3 2005/03/14 05:34:08 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_AUDIO_AUDIOCORE_HPP
|
||||
#define PHOTON_AUDIO_AUDIOCORE_HPP
|
||||
@ -13,7 +13,7 @@
|
||||
#include "al.h"
|
||||
#include "alc.h"
|
||||
|
||||
#include "util/Singleton.hpp"
|
||||
#include "Task.hpp"
|
||||
#include "util/VersionInfo.hpp"
|
||||
|
||||
namespace photon
|
||||
@ -27,9 +27,19 @@ namespace audio
|
||||
//
|
||||
// Parent:
|
||||
// <Singleton>
|
||||
class AudioCore : public util::Singleton<AudioCore>
|
||||
class AudioCore : public Singleton<AudioCore>
|
||||
{
|
||||
|
||||
// Group: (Con/De)structors
|
||||
public:
|
||||
// Function: AudioCore
|
||||
// Initialize underlying APIs and setup <Task> internals.
|
||||
AudioCore();
|
||||
|
||||
// Function: ~AudioCore
|
||||
// Shutdown underlying APIs.
|
||||
~AudioCore();
|
||||
|
||||
// Group: Accessors
|
||||
public:
|
||||
// Function: getAudioDeviceName
|
||||
@ -61,14 +71,6 @@ private:
|
||||
// data members
|
||||
private:
|
||||
static std::string deviceName_;
|
||||
|
||||
// Singleton-required code
|
||||
private:
|
||||
AudioCore();
|
||||
~AudioCore();
|
||||
|
||||
friend class util::Singleton<AudioCore>;
|
||||
friend class std::auto_ptr<AudioCore>;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: AudioCore.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $
|
||||
// $Id: AudioCore.cpp,v 1.3 2005/03/14 05:34:25 cozman Exp $
|
||||
|
||||
#include "audio/AudioCore.hpp"
|
||||
|
||||
@ -17,6 +17,28 @@ namespace photon
|
||||
namespace audio
|
||||
{
|
||||
|
||||
AudioCore::AudioCore() :
|
||||
Task("AudioCore",PRI_CORE)
|
||||
{
|
||||
util::VersionInfo oalReq(1,0,0); // requires OpenAL 1.0 (TODO: check?)
|
||||
|
||||
util::ensureVersion("OpenAL", initOpenAL(), oalReq);
|
||||
}
|
||||
|
||||
AudioCore::~AudioCore()
|
||||
{
|
||||
// retrieve both the context and device
|
||||
ALCcontext* context( alcGetCurrentContext() );
|
||||
ALCdevice* device( alcGetContextsDevice(context) );
|
||||
|
||||
// set current context to null
|
||||
alcMakeContextCurrent(0);
|
||||
|
||||
// destroy context & device
|
||||
alcDestroyContext(context);
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
|
||||
std::string AudioCore::getAudioDeviceName() const
|
||||
{
|
||||
ALCdevice* device (alcGetContextsDevice( alcGetCurrentContext() ));
|
||||
@ -102,26 +124,5 @@ void AudioCore::setDesiredDevice(const std::string& name)
|
||||
|
||||
std::string AudioCore::deviceName_;
|
||||
|
||||
AudioCore::AudioCore()
|
||||
{
|
||||
util::VersionInfo oalReq(1,0,0); // requires OpenAL 1.0 (TODO: check?)
|
||||
|
||||
util::ensureVersion("OpenAL", initOpenAL(), oalReq);
|
||||
}
|
||||
|
||||
AudioCore::~AudioCore()
|
||||
{
|
||||
// retrieve both the context and device
|
||||
ALCcontext* context( alcGetCurrentContext() );
|
||||
ALCdevice* device( alcGetContextsDevice(context) );
|
||||
|
||||
// set current context to null
|
||||
alcMakeContextCurrent(0);
|
||||
|
||||
// destroy context & device
|
||||
alcDestroyContext(context);
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user