Sound manager changes from David Megginson.
This commit is contained in:
parent
d0df197e1d
commit
15f02e9dd6
3 changed files with 42 additions and 18 deletions
|
@ -140,7 +140,7 @@ FGFX::unbind ()
|
||||||
void
|
void
|
||||||
FGFX::update ()
|
FGFX::update ()
|
||||||
{
|
{
|
||||||
FGSoundMgr * mgr = globals->get_soundmgr();
|
// FGSoundMgr * mgr = globals->get_soundmgr();
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -75,6 +75,7 @@ FGSoundMgr::FGSoundMgr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
|
|
||||||
FGSoundMgr::~FGSoundMgr() {
|
FGSoundMgr::~FGSoundMgr() {
|
||||||
sound_map_iterator current = sounds.begin();
|
sound_map_iterator current = sounds.begin();
|
||||||
sound_map_iterator end = sounds.end();
|
sound_map_iterator end = sounds.end();
|
||||||
|
@ -90,7 +91,7 @@ FGSoundMgr::~FGSoundMgr() {
|
||||||
|
|
||||||
|
|
||||||
// initialize the sound manager
|
// initialize the sound manager
|
||||||
bool FGSoundMgr::init() {
|
void FGSoundMgr::init() {
|
||||||
last.stamp();
|
last.stamp();
|
||||||
safety = FG_MAX_SOUND_SAFETY;
|
safety = FG_MAX_SOUND_SAFETY;
|
||||||
|
|
||||||
|
@ -106,16 +107,21 @@ bool FGSoundMgr::init() {
|
||||||
}
|
}
|
||||||
sounds.clear();
|
sounds.clear();
|
||||||
|
|
||||||
if ( audio_sched->not_working() ) {
|
}
|
||||||
return false;
|
|
||||||
} else {
|
void FGSoundMgr::bind ()
|
||||||
return true;
|
{
|
||||||
}
|
// no properties yet
|
||||||
|
}
|
||||||
|
|
||||||
|
void FGSoundMgr::unbind ()
|
||||||
|
{
|
||||||
|
// no properties yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// run the audio scheduler
|
// run the audio scheduler
|
||||||
bool FGSoundMgr::update() {
|
void FGSoundMgr::update() {
|
||||||
SGTimeStamp current;
|
SGTimeStamp current;
|
||||||
current.stamp();
|
current.stamp();
|
||||||
|
|
||||||
|
@ -133,12 +139,8 @@ bool FGSoundMgr::update() {
|
||||||
// cout << "safety = " << safety << endl;
|
// cout << "safety = " << safety << endl;
|
||||||
audio_sched -> setSafetyMargin ( FG_SOUND_SAFETY_MULT * safety ) ;
|
audio_sched -> setSafetyMargin ( FG_SOUND_SAFETY_MULT * safety ) ;
|
||||||
|
|
||||||
if ( !audio_sched->not_working() ) {
|
if ( !audio_sched->not_working() )
|
||||||
audio_sched -> update();
|
audio_sched -> update();
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
|
|
||||||
#include <simgear/timing/timestamp.hxx>
|
#include <simgear/timing/timestamp.hxx>
|
||||||
|
|
||||||
|
#include <Main/fgfs.hxx>
|
||||||
|
|
||||||
SG_USING_STD(map);
|
SG_USING_STD(map);
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
|
@ -82,7 +84,8 @@ typedef sound_map::iterator sound_map_iterator;
|
||||||
typedef sound_map::const_iterator const_sound_map_iterator;
|
typedef sound_map::const_iterator const_sound_map_iterator;
|
||||||
|
|
||||||
|
|
||||||
class FGSoundMgr {
|
class FGSoundMgr : public FGSubsystem
|
||||||
|
{
|
||||||
|
|
||||||
slScheduler *audio_sched;
|
slScheduler *audio_sched;
|
||||||
smMixer *audio_mixer;
|
smMixer *audio_mixer;
|
||||||
|
@ -96,11 +99,30 @@ public:
|
||||||
FGSoundMgr();
|
FGSoundMgr();
|
||||||
~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?
|
// is audio working?
|
||||||
inline bool is_working() const { return !audio_sched->not_working(); }
|
inline bool is_working() const { return !audio_sched->not_working(); }
|
||||||
|
|
Loading…
Reference in a new issue