mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
openal: "reattempt" -> "retry"
This commit is contained in:
parent
cb85d01de6
commit
c89bb3d030
@ -30,21 +30,21 @@ ConfigVariableString openal_device
|
||||
PRC_DESC("Specify the OpenAL device string for audio playback (no quotes). If this "
|
||||
"is not specified, the OpenAL default device is used."));
|
||||
|
||||
ConfigVariableInt openal_buffer_delete_reattempts
|
||||
("openal-buffer-delete-reattempts", 5,
|
||||
ConfigVariableInt openal_buffer_delete_retries
|
||||
("openal-buffer-delete-retries", 5,
|
||||
PRC_DESC("If deleting a buffer fails due to still being in use, the OpenAL "
|
||||
"sound plugin will wait a moment and reattempt deletion, with an "
|
||||
"exponentially-increasing delay for each attempt. This number "
|
||||
"specifies how many repeat attempts (not counting the initial attempt) "
|
||||
"sound plugin will wait a moment and retry deletion, with an "
|
||||
"exponentially-increasing delay for each try. This number "
|
||||
"specifies how many repeat tries (not counting the initial try) "
|
||||
"should be made before giving up and raising an error."));
|
||||
|
||||
ConfigVariableDouble openal_buffer_delete_delay
|
||||
("openal-buffer-delete-delay", 0.001,
|
||||
PRC_DESC("If deleting a buffer fails due to still being in use, the OpenAL "
|
||||
"sound plugin will wait a moment and reattempt deletion, with an "
|
||||
"exponentially-increasing delay for each attempt. This number "
|
||||
"sound plugin will wait a moment and retry deletion, with an "
|
||||
"exponentially-increasing delay for each try. This number "
|
||||
"specifies how long, in seconds, the OpenAL plugin will wait after "
|
||||
"its first failed attempt. The second attempt will be double this "
|
||||
"its first failed try. The second try will be double this "
|
||||
"delay, the third quadruple, and so on."));
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern "C" EXPCL_OPENAL_AUDIO void init_libOpenALAudio();
|
||||
extern "C" EXPCL_OPENAL_AUDIO Create_AudioManager_proc *get_audio_manager_func_openal_audio();
|
||||
|
||||
extern ConfigVariableString openal_device;
|
||||
extern ConfigVariableInt openal_buffer_delete_reattempts;
|
||||
extern ConfigVariableInt openal_buffer_delete_retries;
|
||||
extern ConfigVariableDouble openal_buffer_delete_delay;
|
||||
|
||||
#endif // CONFIG_OPENALAUDIO_H
|
||||
|
@ -1140,7 +1140,7 @@ discard_excess_cache(int sample_limit) {
|
||||
void OpenALAudioManager::
|
||||
delete_buffer(ALuint buffer) {
|
||||
ReMutexHolder holder(_lock);
|
||||
int attempt = 0;
|
||||
int tries = 0;
|
||||
ALuint error;
|
||||
|
||||
// Keep trying until we succeed (or give up).
|
||||
@ -1154,13 +1154,13 @@ delete_buffer(ALuint buffer) {
|
||||
} else if (error != AL_INVALID_OPERATION) {
|
||||
// We weren't expecting that. This should be reported.
|
||||
break;
|
||||
} else if (attempt >= openal_buffer_delete_reattempts.get_value()) {
|
||||
// We ran out of reattempts. Give up.
|
||||
} else if (tries >= openal_buffer_delete_retries.get_value()) {
|
||||
// We ran out of retries. Give up.
|
||||
break;
|
||||
} else {
|
||||
// Make another attempt after (delay * 2^n) seconds.
|
||||
Thread::sleep(openal_buffer_delete_delay.get_value() * (1 << attempt));
|
||||
attempt++;
|
||||
// Make another try after (delay * 2^n) seconds.
|
||||
Thread::sleep(openal_buffer_delete_delay.get_value() * (1 << tries));
|
||||
tries++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user