Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/presentation/src/lib/sound/sound_source.h @ 10717

Last change on this file since 10717 was 10695, checked in by snellen, 18 years ago

changes on soundengine and mover by fabian landau

File size: 2.5 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, float rolloff);
33    void play(const SoundBuffer& buffer, float gain, float rolloff, bool loop);
34    void play(const SoundBuffer& buffer, bool loop);
35
36    void gain(const SoundBuffer& buffer, float gain);
37
38    void stop();
39    void pause();
40    void rewind();
41    void fadein(const SoundBuffer& buffer, ALfloat duration);
42
43    // development functions
44    /** @returns The ID of this Source */
45    inline ALuint getID() const { return this->sourceID; };
46    /** @returns true, if the Source is Playing */
47    inline bool isPlaying() const { return this->bPlay; };
48    void setSourceNode(const PNode* sourceNode);
49    /** @returns the SoundBuffer of this Source */
50    inline const SoundBuffer& getBuffer() const { return this->buffer; };
51    /** @returns the SourceNode of this Source */
52    inline const PNode* getNode() const { return this->sourceNode; };
53    /** @param resident if the Source is Resident */
54    inline void setResident(bool resident) { this->resident = resident; };
55    /** @returns true if the alSource is Resident */
56    inline bool isResident() const { return this->resident; };
57
58    void setRolloffFactor(ALfloat rolloffFactor);
59
60    static void resetSource(ALuint sourceID);
61
62  private:
63    bool                   retrieveSource();
64
65  private:
66    bool                   bPlay;       //!< If the Source is Playing.
67    bool                   resident;    //!< If the alSource should be resident (if true, the alSource will be returned on deletion).
68    ALuint                 sourceID;    //!< The ID of the Source
69    SoundBuffer            buffer;      //!< The buffer to play in this source.
70    const PNode*           sourceNode;  //!< The SourceNode representing the position/velocity... of this source.
71  };
72}
73#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.