Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/resources/src/lib/sound/sound_source.h @ 8471

Last change on this file since 8471 was 7065, checked in by bensch, 19 years ago

powerups sounds when pickup

File size: 1.6 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    virtual ~SoundSource();
22
23  // user interaction
24    void play();
25    void play(const SoundBuffer* buffer);
26    void stop();
27    void pause();
28    void rewind();
29
30  // development functions
31    /** @returns The ID of this Source */
32    inline ALuint getID() const { return this->sourceID; }
33    /** @returns true, if the Source is Playing */
34    inline bool   isPlaying() const { return this->bPlay; };
35    /** @param sourceNode the Source this is attached to. */
36    inline void setSourceNode(const PNode* sourceNode) { this->sourceNode = sourceNode;};
37    /** @returns the SoundBuffer of this Source */
38    inline const SoundBuffer* getBuffer() const { return this->buffer; }
39    /** @returns the SourceNode of this Source */
40    inline const PNode* getNode() const { return this->sourceNode;}
41
42    void setRolloffFactor(ALfloat rolloffFactor);
43
44  private:
45    bool                   bPlay;                 //!< If the Source is Playing.
46    ALuint                 sourceID;              //!< The ID of the Source
47    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
48    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
49};
50#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.