Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10677 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
RevLine 
[4838]1/*!
[8255]2* @file sound_source.h
3* @brief Definition of the SoundSource.
[3245]4*/
[1853]5
[5386]6#ifndef _SOUND_SOURCE_H
7#define _SOUND_SOURCE_H
[1853]8
[3543]9#include "base_object.h"
[9869]10#include "sound_buffer.h"
[5386]11#include "alincl.h"
[1853]12
[4838]13// FORWARD DECLARATION
[5386]14class PNode;
[7460]15namespace OrxSound
[5386]16{
[8793]17  //! A class that represents a SoundSource
18  class SoundSource : public BaseObject
19  {
[9869]20    ObjectListDeclaration(SoundSource);
[8793]21  public:
[9869]22    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer& buffer = SoundBuffer());
[8793]23    SoundSource(const SoundSource& source);
24    SoundSource& operator=(const SoundSource& source);
25    bool operator==(const SoundSource& source);
[8495]26
[8793]27    virtual ~SoundSource();
28
29    // user interaction
30    void play();
[9869]31    void play(const SoundBuffer& buffer);
32    void play(const SoundBuffer& buffer, float gain);
33    void play(const SoundBuffer& buffer, float gain, bool loop);
[8793]34
[9869]35    void gain(const SoundBuffer& buffer, float gain);
[8793]36
37    void stop();
38    void pause();
39    void rewind();
[9869]40    void fadein(const SoundBuffer& buffer, ALfloat duration);
[8793]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 */
[9869]49    inline const SoundBuffer& getBuffer() const { return this->buffer; };
[8793]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
[9869]68    SoundBuffer            buffer;      //!< The buffer to play in this source.
[8793]69    const PNode*           sourceNode;  //!< The SourceNode representing the position/velocity... of this source.
70  };
[7460]71}
[5386]72#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.