AGS: Removed redundant sound destroy calls

From upstream c8bedc8838635381fc186c9f54e8789a8c276063
This commit is contained in:
Paul Gilbert 2022-03-18 22:39:47 -07:00
parent a4bf82bd35
commit 699a72af3b
2 changed files with 0 additions and 8 deletions

View File

@ -397,7 +397,6 @@ void PlayMP3File(const char *filename) {
if (filename != &_GP(play).playmp3file_name[0])
snprintf(_GP(play).playmp3file_name, sizeof(_GP(play).playmp3file_name), filename);
} else {
clip->destroy();
delete clip;
clip = nullptr;
}
@ -432,7 +431,6 @@ void PlaySilentMIDI(int mnum) {
AudioChans::SetChannel(_GP(play).silent_midi_channel, clip);
if (!clip->play()) {
clip->destroy();
delete clip;
clip = nullptr;
quitprintf("!PlaySilentMIDI: failed to play aMusic%d", mnum);
@ -524,7 +522,6 @@ static bool play_voice_clip_on_channel(const String &voice_name) {
speechmp3->set_volume(_GP(play).speech_volume);
if (!speechmp3->play()) {
// not assigned to a channel, so clean up manually.
speechmp3->destroy();
delete speechmp3;
speechmp3 = nullptr;
}

View File

@ -352,7 +352,6 @@ ScriptAudioChannel *play_audio_clip_on_channel(int channel, ScriptAudioClip *cli
if (soundfx->play_from(fromOffset) == 0) {
// not assigned to a channel, so clean up manually.
soundfx->destroy();
delete soundfx;
soundfx = nullptr;
debug_script_log("AudioClip.Play: failed to play sound file");
@ -431,7 +430,6 @@ void stop_and_destroy_channel_ex(int chid, bool resetLegacyMusicSettings) {
SOUNDCLIP *ch = AudioChans::GetChannel(chid);
if (ch != nullptr) {
ch->destroy();
delete ch;
AudioChans::SetChannel(chid, nullptr);
ch = nullptr;
@ -571,7 +569,6 @@ SOUNDCLIP *load_sound_and_play(ScriptAudioClip *aclip, bool repeat) {
if (soundfx->play() == 0) {
// not assigned to a channel, so clean up manually.
soundfx->destroy();
delete soundfx;
return nullptr;
}
@ -684,7 +681,6 @@ void process_scheduled_music_update() {
void clear_music_cache() {
if (_G(cachedQueuedMusic) != nullptr) {
_G(cachedQueuedMusic)->destroy();
delete _G(cachedQueuedMusic);
_G(cachedQueuedMusic) = nullptr;
}
@ -995,7 +991,6 @@ static void play_new_music(int mnum, SOUNDCLIP *music) {
if (ch != nullptr) {
if (!ch->play()) {
// previous behavior was to set channel[] to null on error, so continue to do that here.
ch->destroy();
delete ch;
ch = nullptr;
AudioChans::SetChannel(useChannel, nullptr);