Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10555 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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