diff --git a/libs/audio/cd/cd_file.c b/libs/audio/cd/cd_file.c index 3da941ba7..96d18a224 100644 --- a/libs/audio/cd/cd_file.c +++ b/libs/audio/cd/cd_file.c @@ -219,7 +219,7 @@ static void I_OGGMus_PlayNext (int looping) { const char *track; - sfx_t *cd_sfx; + sfx_t *cd_sfx, *sfx; wavinfo_t *info = 0; if (!play_list) @@ -243,18 +243,21 @@ I_OGGMus_PlayNext (int looping) if (!(cd_channel = S_AllocChannel ())) return; - if (!(cd_sfx = S_LoadSound (track))) + if (!(cd_sfx = S_LoadSound (track)) || !(sfx = cd_sfx->open (cd_sfx))) { + S_ChannelStop (cd_channel); + cd_channel = 0; return; + } - if (cd_sfx->wavinfo) - info = cd_sfx->wavinfo (cd_sfx); + if (sfx->wavinfo) + info = sfx->wavinfo (sfx); if (info) { if (looping == true) info->loopstart = 0; else info->loopstart = -1; } - cd_channel->sfx = cd_sfx->open (cd_sfx); + cd_channel->sfx = sfx; set_volume (); playing = true; diff --git a/libs/audio/renderer/snd_mem.c b/libs/audio/renderer/snd_mem.c index 3c7b1534d..50929193c 100644 --- a/libs/audio/renderer/snd_mem.c +++ b/libs/audio/renderer/snd_mem.c @@ -81,6 +81,12 @@ snd_open (sfx_t *sfx) return sfx; } +static sfx_t * +snd_open_fail (sfx_t *sfx) +{ + return 0; +} + sfxbuffer_t * SND_CacheTouch (sfx_t *sfx) { @@ -331,7 +337,7 @@ SND_Load (sfx_t *sfx) sfx->touch = sfx->retain = snd_fail; sfx->release = snd_noop; sfx->close = snd_noop; - sfx->open = snd_open; + sfx->open = snd_open_fail; _QFS_FOpenFile (sfx->name, &file, foundname, 1); if (!file) { @@ -339,6 +345,7 @@ SND_Load (sfx_t *sfx) dstring_delete (foundname); return; } + sfx->open = snd_open; if (!strequal (foundname->str, sfx->name)) { realname = foundname->str; free (foundname);