| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- $#include "SoundSource.h"
- /// %Sound source component with stereo position.
- class SoundSource : public Component
- {
- public:
- /// Play a sound.
- void Play(Sound* sound);
- /// Play a sound with specified frequency.
- void Play(Sound* sound, float frequency);
- /// Play a sound with specified frequency and gain.
- void Play(Sound* sound, float frequency, float gain);
- /// Play a sound with specified frequency, gain and panning.
- void Play(Sound* sound, float frequency, float gain, float panning);
- /// Stop playback.
- void Stop();
- /// Set sound type, determines the master gain group.
- void SetSoundType(SoundType type);
- /// Set frequency.
- void SetFrequency(float frequency);
- /// Set gain. 0.0 is silence, 1.0 is full volume.
- void SetGain(float gain);
- /// Set attenuation. 1.0 is unaltered. Used for distance attenuated playback.
- void SetAttenuation(float attenuation);
- /// Set stereo panning. -1.0 is full left and 1.0 is full right.
- void SetPanning(float panning);
- /// Set whether sound source will be automatically removed from the scene node when playback stops.
- void SetAutoRemove(bool enable);
- /// Set new playback position.
- void SetPlayPosition(signed char* pos);
-
- /// Return sound.
- Sound* GetSound() const { return sound_; }
- /// Return playback position.
- volatile signed char* GetPlayPosition() const { return position_; }
- /// Return sound type, determines the master gain group.
- SoundType GetSoundType() const { return soundType_; }
- /// Return playback time position.
- float GetTimePosition() const { return timePosition_; }
- /// Return frequency.
- float GetFrequency() const { return frequency_; }
- /// Return gain.
- float GetGain() const { return gain_; }
- /// Return attenuation.
- float GetAttenuation() const { return attenuation_; }
- /// Return stereo panning.
- float GetPanning() const { return panning_; }
- /// Return autoremove mode.
- bool GetAutoRemove() const { return autoRemove_; }
- /// Return whether is playing.
- bool IsPlaying() const;
-
- /// Play a sound without locking the audio mutex. Called internally.
- void PlayLockless(Sound* sound);
- /// Stop sound without locking the audio mutex. Called internally.
- void StopLockless();
- };
|