1
0
Fork 0

Sound manager changes from David Megginson.

This commit is contained in:
curt 2001-10-29 04:40:43 +00:00
parent d0df197e1d
commit 15f02e9dd6
3 changed files with 42 additions and 18 deletions

View file

@ -140,7 +140,7 @@ FGFX::unbind ()
void
FGFX::update ()
{
FGSoundMgr * mgr = globals->get_soundmgr();
// FGSoundMgr * mgr = globals->get_soundmgr();
////////////////////////////////////////////////////////////////////

View file

@ -75,6 +75,7 @@ FGSoundMgr::FGSoundMgr() {
}
// destructor
FGSoundMgr::~FGSoundMgr() {
sound_map_iterator current = sounds.begin();
sound_map_iterator end = sounds.end();
@ -90,7 +91,7 @@ FGSoundMgr::~FGSoundMgr() {
// initialize the sound manager
bool FGSoundMgr::init() {
void FGSoundMgr::init() {
last.stamp();
safety = FG_MAX_SOUND_SAFETY;
@ -106,16 +107,21 @@ bool FGSoundMgr::init() {
}
sounds.clear();
if ( audio_sched->not_working() ) {
return false;
} else {
return true;
}
}
void FGSoundMgr::bind ()
{
// no properties yet
}
void FGSoundMgr::unbind ()
{
// no properties yet
}
// run the audio scheduler
bool FGSoundMgr::update() {
void FGSoundMgr::update() {
SGTimeStamp current;
current.stamp();
@ -133,12 +139,8 @@ bool FGSoundMgr::update() {
// cout << "safety = " << safety << endl;
audio_sched -> setSafetyMargin ( FG_SOUND_SAFETY_MULT * safety ) ;
if ( !audio_sched->not_working() ) {
if ( !audio_sched->not_working() )
audio_sched -> update();
return true;
} else {
return false;
}
}

View file

@ -41,6 +41,8 @@
#include <simgear/timing/timestamp.hxx>
#include <Main/fgfs.hxx>
SG_USING_STD(map);
SG_USING_STD(string);
@ -82,7 +84,8 @@ typedef sound_map::iterator sound_map_iterator;
typedef sound_map::const_iterator const_sound_map_iterator;
class FGSoundMgr {
class FGSoundMgr : public FGSubsystem
{
slScheduler *audio_sched;
smMixer *audio_mixer;
@ -96,11 +99,30 @@ public:
FGSoundMgr();
~FGSoundMgr();
// initialize the sound manager
bool init();
// run the audio scheduler
bool update();
/**
* Initialize the sound manager.
*/
void init();
/**
* Bind properties for the sound manager.
*/
void bind ();
/**
* Unbind properties for the sound manager.
*/
void unbind ();
/**
* Run the audio scheduler.
*/
void update();
// is audio working?
inline bool is_working() const { return !audio_sched->not_working(); }