~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/Sound/fg_fx.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2011-01-30 15:46:35 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110130154635-rlynmg9n5hzxq5xe
Tags: 2.0.0-3
* Recommend fgfs-aircraft-base and fgfs-models-base.
  Closes. #610276.
* Added note about scenery SharedModels.tgz to README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include <simgear/compiler.h>
28
28
 
29
 
#include <queue>
30
29
#include <vector>
31
30
 
32
 
#include <simgear/sound/sample_openal.hxx>
33
31
#include <simgear/structure/subsystem_mgr.hxx>
34
 
 
35
 
using std::queue;
36
 
using std::vector;
 
32
#include <simgear/sound/sample_group.hxx>
37
33
 
38
34
class SGXmlSound;
39
35
 
40
36
/**
41
37
 * Generator for FlightGear sound effects.
42
38
 *
43
 
 * This module uses FGSoundMgr to generate sound effects based
44
 
 * on current flight conditions.  The sound manager must be initialized
 
39
 * This module uses a FGSampleGroup class to generate sound effects based
 
40
 * on current flight conditions. The sound manager must be initialized
45
41
 * before this object is.
46
42
 *
47
 
 * Note: this module supports two separate sound mechanisms concurrently.
48
 
 *
49
 
 * 1. This module will load and play a set of sound effects defined in an
 
43
 *    This module will load and play a set of sound effects defined in an
50
44
 *    xml file and tie them to various property states.
51
 
 * 2. This modules also maintains a queue of 'message' audio files.  These
52
 
 *    are played sequentially with no overlap until the queue is finished.
53
 
 *    This second mechanims is useful for things like tutorial messages or
54
 
 *    background atc chatter.
55
45
 */
56
 
class FGFX : public SGSubsystem
 
46
class FGFX : public SGSampleGroup
57
47
{
58
48
 
59
49
public:
60
50
 
61
 
    FGFX ();
 
51
    FGFX ( SGSoundMgr *smgr, const string &refname );
62
52
    virtual ~FGFX ();
63
53
 
64
54
    virtual void init ();
65
55
    virtual void reinit ();
66
 
    virtual void bind ();
67
 
    virtual void unbind ();
68
56
    virtual void update (double dt);
69
57
 
70
 
    /**
71
 
     * add a sound sample to the message queue which is played sequentially
72
 
     * in order.
73
 
     */
74
 
    void play_message( SGSoundSample *_sample );
75
 
    void play_message( const string path, const string fname, double volume );
76
 
 
77
58
private:
78
59
 
79
 
    void update_pos_and_orientation(SGSoundMgr *smgr, double dt);
80
 
    sgdVec3 last_visitor_pos;
81
 
    sgdVec3 last_model_pos;
82
 
 
83
 
    vector<SGXmlSound *> _sound;
84
 
    queue<SGSoundSample *> _samplequeue;
85
 
 
86
 
    bool last_pause;
87
 
    double last_volume;
88
 
 
89
 
    SGPropertyNode_ptr _pause;
 
60
    SGSharedPtr<SGSampleGroup> _avionics;
 
61
    std::vector<SGXmlSound *> _sound;
 
62
 
 
63
    SGPropertyNode_ptr _enabled;
90
64
    SGPropertyNode_ptr _volume;
 
65
    SGPropertyNode_ptr _avionics_enabled;
 
66
    SGPropertyNode_ptr _avionics_volume;
 
67
    SGPropertyNode_ptr _avionics_external;
 
68
    SGPropertyNode_ptr _internal;
91
69
};
92
70
 
93
71