Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/sound/sound_source.h @ 7667

Last change on this file since 7667 was 7460, checked in by bensch, 19 years ago

orxonox/trunk: Namespaces for 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 PNode;
14namespace OrxSound
15{
16  class SoundBuffer;
17  //! A class that represents a SoundSource
18  class SoundSource : public BaseObject
19  {
20  public:
21    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
22    SoundSource(const SoundSource& source);
23    SoundSource& operator=(const SoundSource& source);
24    bool operator==(const SoundSource& source);
25
26    virtual ~SoundSource();
27
28    // user interaction
29    void play();
30    void play(const SoundBuffer* buffer);
31    void stop();
32    void pause();
33    void rewind();
34
35    // development functions
36    /** @returns The ID of this Source */
37    inline ALuint getID() const { return this->sourceID; };
38    /** @returns true, if the Source is Playing */
39    inline bool   isPlaying() const { return this->bPlay; };
40    void setSourceNode(const PNode* sourceNode);
41    /** @returns the SoundBuffer of this Source */
42    inline const SoundBuffer* getBuffer() const { return this->buffer; };
43    /** @returns the SourceNode of this Source */
44    inline const PNode* getNode() const { return this->sourceNode; };
45    /** @param resident if the Source is Resident */
46    inline void setResident(bool resident) { this->resident = resident; };
47    /** @returns true if the alSource is Resident */
48    inline bool isResident() const { return this->resident; };
49
50    void setRolloffFactor(ALfloat rolloffFactor);
51
52    static void resetSource(ALuint sourceID);
53
54  private:
55    bool retrieveSource();
56
57  private:
58    bool                   bPlay;                 //!< If the Source is Playing.
59    bool                   resident;              //!< If the alSource should be resident (if true, the alSource will be returned on deletion).
60    ALuint                 sourceID;              //!< The ID of the Source
61    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
62    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
63  };
64}
65#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.