mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 09:51:40 +00:00
better handling of missing sound files. fixes the seg when the cd track isn't available.
This commit is contained in:
parent
1be73a528a
commit
253795ca7f
2 changed files with 16 additions and 6 deletions
|
@ -219,7 +219,7 @@ static void
|
||||||
I_OGGMus_PlayNext (int looping)
|
I_OGGMus_PlayNext (int looping)
|
||||||
{
|
{
|
||||||
const char *track;
|
const char *track;
|
||||||
sfx_t *cd_sfx;
|
sfx_t *cd_sfx, *sfx;
|
||||||
wavinfo_t *info = 0;
|
wavinfo_t *info = 0;
|
||||||
|
|
||||||
if (!play_list)
|
if (!play_list)
|
||||||
|
@ -243,18 +243,21 @@ I_OGGMus_PlayNext (int looping)
|
||||||
if (!(cd_channel = S_AllocChannel ()))
|
if (!(cd_channel = S_AllocChannel ()))
|
||||||
return;
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (cd_sfx->wavinfo)
|
if (sfx->wavinfo)
|
||||||
info = cd_sfx->wavinfo (cd_sfx);
|
info = sfx->wavinfo (sfx);
|
||||||
if (info) {
|
if (info) {
|
||||||
if (looping == true)
|
if (looping == true)
|
||||||
info->loopstart = 0;
|
info->loopstart = 0;
|
||||||
else
|
else
|
||||||
info->loopstart = -1;
|
info->loopstart = -1;
|
||||||
}
|
}
|
||||||
cd_channel->sfx = cd_sfx->open (cd_sfx);
|
cd_channel->sfx = sfx;
|
||||||
set_volume ();
|
set_volume ();
|
||||||
|
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
|
@ -81,6 +81,12 @@ snd_open (sfx_t *sfx)
|
||||||
return sfx;
|
return sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static sfx_t *
|
||||||
|
snd_open_fail (sfx_t *sfx)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sfxbuffer_t *
|
sfxbuffer_t *
|
||||||
SND_CacheTouch (sfx_t *sfx)
|
SND_CacheTouch (sfx_t *sfx)
|
||||||
{
|
{
|
||||||
|
@ -331,7 +337,7 @@ SND_Load (sfx_t *sfx)
|
||||||
sfx->touch = sfx->retain = snd_fail;
|
sfx->touch = sfx->retain = snd_fail;
|
||||||
sfx->release = snd_noop;
|
sfx->release = snd_noop;
|
||||||
sfx->close = snd_noop;
|
sfx->close = snd_noop;
|
||||||
sfx->open = snd_open;
|
sfx->open = snd_open_fail;
|
||||||
|
|
||||||
_QFS_FOpenFile (sfx->name, &file, foundname, 1);
|
_QFS_FOpenFile (sfx->name, &file, foundname, 1);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -339,6 +345,7 @@ SND_Load (sfx_t *sfx)
|
||||||
dstring_delete (foundname);
|
dstring_delete (foundname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
sfx->open = snd_open;
|
||||||
if (!strequal (foundname->str, sfx->name)) {
|
if (!strequal (foundname->str, sfx->name)) {
|
||||||
realname = foundname->str;
|
realname = foundname->str;
|
||||||
free (foundname);
|
free (foundname);
|
||||||
|
|
Loading…
Reference in a new issue