#include "snd_main.h"
#include "snd_ogg.h"
-#include "snd_modplug.h"
#include "csprogs.h"
#include "cl_collision.h"
+#ifdef CONFIG_CD
#include "cdaudio.h"
+#endif
#define SND_MIN_SPEED 8000
{
unsigned int size;
- size = sfx->memsize;
+ size = (unsigned int)sfx->memsize;
Con_Printf ("%c%c%c(%5iHz %2db %6s) %8i : %s\n",
(sfx->loopstart < sfx->total_length) ? 'L' : ' ',
(sfx->flags & SFXFLAG_STREAMED) ? 'S' : ' ',
memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
OGG_OpenLibrary ();
- ModPlug_OpenLibrary ();
}
void S_Terminate (void)
{
S_Shutdown ();
- ModPlug_CloseLibrary ();
OGG_CloseLibrary ();
// Free all SFXs
int S_StartSound_StartPosition_Flags (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float startposition, int flags, float fspeed)
{
channel_t *target_chan, *check, *ch;
- int ch_idx, startpos;
+ int ch_idx, startpos, i;
if (snd_renderbuffer == NULL || sfx == NULL || nosound.integer)
return -1;
{
S_SetChannelVolume(ch_idx, fvol);
S_SetChannelSpeed(ch_idx, fspeed);
+ for(i = 1; i > 0 && (i <= flags || i <= (int) channels[ch_idx].flags); i <<= 1)
+ if((flags ^ channels[ch_idx].flags) & i)
+ S_SetChannelFlag(ch_idx, i, (flags & i) != 0);
ch->distfade = attenuation / snd_soundradius.value;
SND_Spatialize(ch, false);
return ch_idx;
ch = &channels[channel_ind];
sfx = ch->sfx;
- if (ch->sfx != NULL)
+ if (sfx != NULL)
{
if (sfx->fetcher != NULL && sfx->fetcher->stopchannel != NULL)
sfx->fetcher->stopchannel(ch);
ch->fetcher_data = NULL;
ch->sfx = NULL;
+ if (freesfx)
+ S_FreeSfx(sfx, true);
}
if (lockmutex && !simsound)
SndSys_UnlockRenderBuffer();
- if (freesfx)
- S_FreeSfx(sfx, true);
}
if (snd_renderbuffer == NULL)
return;
+#ifdef CONFIG_CD
// stop CD audio because it may be using a faketrack
CDAudio_Stop();
+#endif
if (simsound || SndSys_LockRenderBuffer ())
{