//
// 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.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
# error This library requires C++
#endif
+#include <vector>
+
#include <simgear/compiler.h>
#include <simgear/props/condition.hxx>
+#include "sample_group.hxx"
#include "sample_openal.hxx"
-#include "soundmgr_openal.hxx"
static const double MAX_TRANSIT_TIME = 0.1; // 100 ms.
/**
* Initialize the sound event.
*
- * Prior to initialization of the sound event the propgrams property root
+ * Prior to initialization of the sound event the program's property root
* has to be defined, the sound configuration XML tree has to be loaded
* and a sound manager class has to be defined.
*
* A sound configuration file would look like this:
* <fx>
* <event_name>
- * <name/> Define the name of the event. For refference only.
+ * <name/> Define the name of the event. For reference only.
* <mode/> Either:
* looped: play this sound looped.
* in-transit: play looped while the event is happening.
* <path/> The relative path to the audio file.
* <property/> Take action if this property becomes true.
* <condition/> Take action if this condition becomes true.
+ * <delay-sec/> Time after which the sound should be played.
* <volume> or <pitch> Define volume or pitch settings.
- * <property/> Take the value of this property as a refference for the
+ * <property/> Take the value of this property as a reference for the
* result.
* <internal/> Either:
* dt_start: the time elapsed since this sound is playing.
* @param root The root node of the programs property tree.
* @param child A pointer to the location of the current event as defined
* in the configuration file.
- * @param sndmgr A pointer to a pre-initialized sound manager class.
+ * @param sgrp A pointer to a pre-initialized sample group class.
+ * @param avionics A pointer to the pre-initialized avionics sample group.
* @param path The path where the audio files remain.
*/
- virtual void init (SGPropertyNode *, SGPropertyNode *, SGSoundMgr *,
- const string &);
+ virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *,
+ SGSampleGroup *, const string &);
/**
- * Check wheter an event has happened and if action has to be taken.
+ * Check whether an event has happened and if action has to be taken.
*/
virtual void update (double dt);
private:
- SGSoundMgr * _mgr;
+ SGSampleGroup * _sgrp;
SGSharedPtr<SGSoundSample> _sample;
- SGCondition * _condition;
+ SGSharedPtr<SGCondition> _condition;
SGPropertyNode_ptr _property;
bool _active;
double _prev_value;
double _dt_play;
double _dt_stop;
+ double _delay; // time after which the sound should be started (default: 0)
double _stopping; // time after the sound should have stopped.
- // This is usefull for lost packets in in-trasit mode.
+ // This is useful for lost packets in in-transit mode.
- vector<_snd_prop> _volume;
- vector<_snd_prop> _pitch;
+ std::vector<_snd_prop> _volume;
+ std::vector<_snd_prop> _pitch;
};