mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
openal: Always use release_sound_data
This simplifies cleanup() a little bit.
This commit is contained in:
parent
9a5d7d8254
commit
a10cd7d8bb
@ -55,10 +55,17 @@ require_sound_data() {
|
||||
/**
|
||||
* Checks if the sound data record is present and releasable, and if so,
|
||||
* releases it.
|
||||
*
|
||||
* The sound data is "releasable" if it's from an ordinary, local file. Remote
|
||||
* streams cannot necessarily be reopened if lost, so we'll hold onto them if
|
||||
* so. The `force` argument overrides this, indicating we don't intend to
|
||||
* reacquire the sound data.
|
||||
*/
|
||||
void OpenALAudioSound::
|
||||
release_sound_data() {
|
||||
if ((_sd!=0) && (!_movie->get_filename().empty())) {
|
||||
release_sound_data(bool force) {
|
||||
if (!has_sound_data()) return;
|
||||
|
||||
if (force || !_movie->get_filename().empty()) {
|
||||
_manager->decrement_client_count(_sd);
|
||||
_sd = 0;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ OpenALAudioSound(OpenALAudioManager* manager,
|
||||
audio_warning("stereo sound " << movie->get_filename() << " will not be spatialized");
|
||||
}
|
||||
}
|
||||
release_sound_data();
|
||||
release_sound_data(false);
|
||||
}
|
||||
|
||||
|
||||
@ -106,8 +106,7 @@ cleanup() {
|
||||
stop();
|
||||
}
|
||||
if (has_sound_data()) {
|
||||
_manager->decrement_client_count(_sd);
|
||||
_sd = 0;
|
||||
release_sound_data(true);
|
||||
}
|
||||
_manager->release_sound(this);
|
||||
_manager = 0;
|
||||
@ -219,7 +218,7 @@ stop() {
|
||||
}
|
||||
|
||||
_manager->stopping_sound(this);
|
||||
release_sound_data();
|
||||
release_sound_data(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
void pull_used_buffers();
|
||||
void push_fresh_buffers();
|
||||
INLINE bool require_sound_data();
|
||||
INLINE void release_sound_data();
|
||||
INLINE void release_sound_data(bool force);
|
||||
|
||||
INLINE bool is_valid() const;
|
||||
INLINE bool is_playing() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user