Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/sound/sound_source.h @ 7768

Last change on this file since 7768 was 7647, checked in by amaechler, 19 years ago

branches/atmospheric_engine: loop updates and chopper sound

File size: 2.2 KB
Line 
1/*!
2 * @file sound_source.h
3 * @brief Definition of the SoundSource.
4*/
5
6#ifndef _SOUND_SOURCE_H
7#define _SOUND_SOURCE_H
8
9#include "base_object.h"
10#include "alincl.h"
11
12// FORWARD DECLARATION
13class SoundBuffer;
14class PNode;
15
16//! A class that represents a SoundSource
17class SoundSource : public BaseObject
18{
19  public:
20    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
21    SoundSource(const SoundSource& source);
22    SoundSource& operator=(const SoundSource& source);
23    bool operator==(const SoundSource& source);
24
25    virtual ~SoundSource();
26
27  // user interaction
28    void play();
29    void play(const SoundBuffer* buffer);
30    void loop();
31    void loop(const SoundBuffer* buffer);
32    void stop();
33    void pause();
34    void rewind();
35
36  // development functions
37    /** @returns The ID of this Source */
38    inline ALuint getID() const { return this->sourceID; };
39    /** @returns true, if the Source is Playing */
40    inline bool   isPlaying() const { return this->bPlay; };
41    void setSourceNode(const PNode* sourceNode);
42    /** @returns the SoundBuffer of this Source */
43    inline const SoundBuffer* getBuffer() const { return this->buffer; };
44    /** @returns the SourceNode of this Source */
45    inline const PNode* getNode() const { return this->sourceNode; };
46    /** @param resident if the Source is Resident */
47    inline void setResident(bool resident) { this->resident = resident; };
48    /** @returns true if the alSource is Resident */
49    inline bool isResident() const { return this->resident; };
50
51    void setRolloffFactor(ALfloat rolloffFactor);
52
53    static void resetSource(ALuint sourceID);
54
55  private:
56    bool retrieveSource();
57
58  private:
59    bool                   bPlay;                 //!< If the Source is Playing.
60    bool                   resident;              //!< If the alSource should be resident (if true, the alSource will be returned on deletion).
61    ALuint                 sourceID;              //!< The ID of the Source
62    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
63    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
64};
65#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.