mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
audio: Add positional property getter to AudioSound
Fixes #1257 Closes #1282 Co-authored-by: morganmliang <morganmliang@users.noreply.github.com>
This commit is contained in:
parent
fea66ea087
commit
2ec147f3b0
@ -10,3 +10,11 @@
|
||||
* @author jyelon
|
||||
* @date 2007-08-01
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns true if this was created as a positional sound.
|
||||
*/
|
||||
INLINE bool AudioSound::
|
||||
is_positional() const {
|
||||
return _positional;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ AudioSound::
|
||||
*
|
||||
*/
|
||||
AudioSound::
|
||||
AudioSound() {
|
||||
AudioSound(bool positional) : _positional(positional) {
|
||||
// Intentionally blank.
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,8 @@ PUBLISHED:
|
||||
// There is no set_name(), this is intentional.
|
||||
virtual const std::string& get_name() const = 0;
|
||||
|
||||
INLINE bool is_positional() const;
|
||||
|
||||
// return: playing time in seconds.
|
||||
virtual PN_stdfloat length() const = 0;
|
||||
|
||||
@ -134,9 +136,12 @@ PUBLISHED:
|
||||
MAKE_PROPERTY(play_rate, get_play_rate, set_play_rate);
|
||||
MAKE_PROPERTY(active, get_active, set_active);
|
||||
MAKE_PROPERTY(name, get_name);
|
||||
MAKE_PROPERTY(positional, is_positional);
|
||||
|
||||
protected:
|
||||
AudioSound();
|
||||
AudioSound(bool positional);
|
||||
|
||||
const bool _positional = false;
|
||||
|
||||
friend class AudioManager;
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace {
|
||||
/**
|
||||
* All of these functions are just stubs.
|
||||
*/
|
||||
NullAudioSound::NullAudioSound() {
|
||||
NullAudioSound::NullAudioSound() : AudioSound(false) {
|
||||
// Intentionally blank.
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,8 @@ TypeHandle FmodAudioSound::_type_handle;
|
||||
* Constructor All sound will DEFAULT load as a 2D sound unless otherwise
|
||||
* specified.
|
||||
*/
|
||||
|
||||
FmodAudioSound::
|
||||
FmodAudioSound(AudioManager *manager, VirtualFile *file, bool positional) {
|
||||
FmodAudioSound(AudioManager *manager, VirtualFile *file, bool positional) : AudioSound(positional) {
|
||||
ReMutexHolder holder(FmodAudioManager::_lock);
|
||||
audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: "
|
||||
<< file->get_original_filename());
|
||||
|
@ -37,6 +37,7 @@ OpenALAudioSound(OpenALAudioManager* manager,
|
||||
MovieAudio *movie,
|
||||
bool positional,
|
||||
int mode) :
|
||||
AudioSound(positional),
|
||||
_movie(movie),
|
||||
_sd(nullptr),
|
||||
_playing_loops(0),
|
||||
@ -47,7 +48,6 @@ OpenALAudioSound(OpenALAudioManager* manager,
|
||||
_volume(1.0f),
|
||||
_balance(0),
|
||||
_play_rate(1.0),
|
||||
_positional(positional),
|
||||
_min_dist(1.0f),
|
||||
_max_dist(1000000000.0f),
|
||||
_drop_off_factor(1.0f),
|
||||
|
@ -152,7 +152,6 @@ private:
|
||||
PN_stdfloat _balance; // -1..1
|
||||
PN_stdfloat _play_rate; // 0..1.0
|
||||
|
||||
bool _positional;
|
||||
ALfloat _location[3];
|
||||
ALfloat _velocity[3];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user