openal: Don't return OpenALAudioSounds that fail to initialize
Also don't register them in _all_sounds, where they won't remove themselves due to having already called cleanup() on themselves. Additionally stops a sound in a cleaned-up state from being passed to the app and played.
This commit is contained in:
parent
bc88566906
commit
f970bc3229
|
|
@ -471,6 +471,12 @@ get_sound(MovieAudio *sound, bool positional, int mode) {
|
|||
PT(OpenALAudioSound) oas =
|
||||
new OpenALAudioSound(this, sound, positional, mode);
|
||||
|
||||
if(!oas->_manager) {
|
||||
// The sound cleaned itself up immediately. It pretty clearly didn't like
|
||||
// something, so we should just return a null sound instead.
|
||||
return get_null_sound();
|
||||
}
|
||||
|
||||
_all_sounds.insert(oas);
|
||||
PT(AudioSound) res = (AudioSound*)(OpenALAudioSound*)oas;
|
||||
return res;
|
||||
|
|
@ -500,6 +506,12 @@ get_sound(const string &file_name, bool positional, int mode) {
|
|||
PT(OpenALAudioSound) oas =
|
||||
new OpenALAudioSound(this, mva, positional, mode);
|
||||
|
||||
if(!oas->_manager) {
|
||||
// The sound cleaned itself up immediately. It pretty clearly didn't like
|
||||
// something, so we should just return a null sound instead.
|
||||
return get_null_sound();
|
||||
}
|
||||
|
||||
_all_sounds.insert(oas);
|
||||
PT(AudioSound) res = (AudioSound*)(OpenALAudioSound*)oas;
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Reference in New Issue