cpp_photon/include/audio/AudioCore.hpp

85 lines
1.9 KiB
C++
Raw Normal View History

2005-02-27 05:55:18 +00:00
//This file is part of Photon (http://photon.sourceforge.net)
//Copyright (C) 2004-2005 James Turk
//
// Author:
// James Turk (jpt2433@rit.edu)
//
// Version:
2005-07-04 03:06:48 +00:00
// $Id: AudioCore.hpp,v 1.6 2005/07/04 03:06:48 cozman Exp $
#ifdef PHOTON_USE_OPENAL
2005-02-27 05:55:18 +00:00
#ifndef PHOTON_AUDIO_AUDIOCORE_HPP
#define PHOTON_AUDIO_AUDIOCORE_HPP
2005-04-21 19:30:19 +00:00
#include "AL/al.h"
#include "AL/alc.h"
2005-02-27 05:55:18 +00:00
2005-03-15 18:41:27 +00:00
#include "util/Singleton.hpp"
2005-02-27 05:55:18 +00:00
#include "util/VersionInfo.hpp"
namespace photon
{
namespace audio
{
2005-03-01 07:51:23 +00:00
// Class: AudioCore
2005-03-14 05:34:08 +00:00
// Photon's <Singleton> core for audio manipulation/control. Defines the
2005-03-01 07:51:23 +00:00
// interface through which all audio related functions are performed.
//
// Parent:
// <Singleton>
2005-03-15 18:41:27 +00:00
class AudioCore : public util::Singleton<AudioCore>
2005-02-27 05:55:18 +00:00
{
2005-03-01 07:51:23 +00:00
2005-03-14 05:34:08 +00:00
// Group: (Con/De)structors
public:
// Function: AudioCore
// Initialize underlying APIs and setup <Task> internals.
AudioCore();
// Function: ~AudioCore
// Shutdown underlying APIs.
~AudioCore();
2005-03-01 07:51:23 +00:00
// Group: Accessors
2005-02-27 05:55:18 +00:00
public:
2005-03-01 07:51:23 +00:00
// Function: getAudioDeviceName
// Get name of active audio device.
//
// Returns:
// Name of audio device currently in use.
2005-02-27 05:55:18 +00:00
std::string getAudioDeviceName() const;
2005-03-14 05:34:08 +00:00
2005-03-01 07:51:23 +00:00
// Group: Initialization
public:
// Function: setDesiredDevice
2005-03-14 05:34:08 +00:00
// Set the name of the desired audio device to use. Static function of
2005-03-01 07:51:23 +00:00
// AudioCore, must be called before AudioCore::initialize() or not at all.
//
2005-03-14 05:34:08 +00:00
// If called, the initialization of the audio library will attempt to
2005-03-01 07:51:23 +00:00
// use the specified audio device, otherwise the default device will be
// used.
//
// Parameters:
// name - Name of audio device to use.
static void setDesiredDevice(const std::string& name);
2005-03-14 05:34:08 +00:00
2005-03-01 07:51:23 +00:00
// OpenAL specifics
2005-02-27 05:55:18 +00:00
private:
util::VersionInfo initOpenAL();
static std::string checkOpenALError();
2005-03-01 07:51:23 +00:00
// data members
2005-02-27 05:55:18 +00:00
private:
2005-03-14 05:34:08 +00:00
static std::string deviceName_;
2005-02-27 05:55:18 +00:00
};
}
}
#endif //PHOTON_AUDIO_AUDIOCORE_HPP
2005-07-04 03:06:48 +00:00
#endif //PHOTON_USE_OPENAL