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