Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

changes on soundengine and mover by fabian landau

File size: 2.5 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);
[10695]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);
[8793]35
[9869]36    void gain(const SoundBuffer& buffer, float gain);
[8793]37
38    void stop();
39    void pause();
40    void rewind();
[9869]41    void fadein(const SoundBuffer& buffer, ALfloat duration);
[8793]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 */
[9869]50    inline const SoundBuffer& getBuffer() const { return this->buffer; };
[8793]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
[9869]69    SoundBuffer            buffer;      //!< The buffer to play in this source.
[8793]70    const PNode*           sourceNode;  //!< The SourceNode representing the position/velocity... of this source.
71  };
[7460]72}
[5386]73#endif /* _SOUND_SOURCE_H */
Note: See TracBrowser for help on using the repository browser.