mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
port Bruce Momjian's patches from newtree with a less incestuous
implementation of his sound/focus patch. NOTE: only alsa 0.9 is tested (Rhamph, can you test 0.5, please?) and only the alsa drivers stop the hardware right ow. WARNING!!! you /will/ have to re-install your plugins, or you will get segfaults when the window gains/loses focus. How do you tell if a window has focus on first mapping in X11?
This commit is contained in:
parent
6f022f5d9f
commit
fc09d2b00f
17 changed files with 227 additions and 171 deletions
|
@ -97,8 +97,8 @@ AC_CHECK_HEADERS(
|
|||
dsound.h errno.h fcntl.h fnmatch.h glide/sst1vid.h io.h \
|
||||
libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \
|
||||
machine/soundcard.h malloc.h math.h mgraph.h _mingw.h netdb.h \
|
||||
netinet/in.h pwd.h setjmp.h signal.h stdarg.h stdio.h stdlib.h \
|
||||
string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
|
||||
netinet/in.h pwd.h rpc/types.h setjmp.h signal.h stdarg.h stdio.h \
|
||||
stdlib.h string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
|
||||
sys/ioctl.h sys/io.h sys/ipc.h sys/mman.h sys/param.h sys/poll.h \
|
||||
sys/shm.h sys/signal.h sys/socket.h sys/soundcard.h sys/stat.h \
|
||||
sys/time.h sys/types.h sys/wait.h time.h unistd.h vga.h \
|
||||
|
|
|
@ -52,6 +52,8 @@ typedef void (QFPLUGIN *P_S_BeginPrecaching) (void);
|
|||
typedef void (QFPLUGIN *P_S_EndPrecaching) (void);
|
||||
typedef void (QFPLUGIN *P_S_ExtraUpdate) (void);
|
||||
typedef void (QFPLUGIN *P_S_LocalSound) (char *s);
|
||||
typedef void (QFPLUGIN *P_S_BlockSound) (void);
|
||||
typedef void (QFPLUGIN *P_S_UnblockSound) (void);
|
||||
|
||||
typedef struct sound_funcs_s {
|
||||
P_S_AmbientOff pS_AmbientOff;
|
||||
|
@ -69,6 +71,8 @@ typedef struct sound_funcs_s {
|
|||
P_S_EndPrecaching pS_EndPrecaching;
|
||||
P_S_ExtraUpdate pS_ExtraUpdate;
|
||||
P_S_LocalSound pS_LocalSound;
|
||||
P_S_BlockSound pS_BlockSound;
|
||||
P_S_UnblockSound pS_UnblockSound;
|
||||
} sound_funcs_t;
|
||||
|
||||
typedef struct sound_data_s {
|
||||
|
|
|
@ -120,18 +120,38 @@ void S_ClearBuffer (void);
|
|||
void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void S_ExtraUpdate (void);
|
||||
void S_BlockSound (void);
|
||||
void S_UnblockSound (void);
|
||||
|
||||
sfx_t *S_PrecacheSound (char *sample);
|
||||
void S_TouchSound (char *sample);
|
||||
void S_ClearPrecache (void);
|
||||
void S_BeginPrecaching (void);
|
||||
void S_EndPrecaching (void);
|
||||
void S_PaintChannels(int endtime);
|
||||
void S_InitPaintChannels (void);
|
||||
void SND_PaintChannels(int endtime);
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
void SND_BlockSound (void);
|
||||
void SND_UnblockSound (void);
|
||||
|
||||
void SND_InitScaletable (void);
|
||||
// picks a channel based on priorities, empty slots, number of channels
|
||||
channel_t *SND_PickChannel(int entnum, int entchannel);
|
||||
|
||||
// spatializes a channel
|
||||
void SND_Spatialize(channel_t *ch);
|
||||
|
||||
|
@ -196,8 +216,9 @@ sfxcache_t *S_LoadSound (sfx_t *s);
|
|||
|
||||
wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
|
||||
|
||||
void SND_InitScaletable (void);
|
||||
void SNDDMA_Submit(void);
|
||||
void SNDDMA_BlockSound (void);
|
||||
void SNDDMA_UnblockSound (void);
|
||||
|
||||
void S_AmbientOff (void);
|
||||
void S_AmbientOn (void);
|
||||
|
|
|
@ -206,3 +206,17 @@ S_LocalSound (char *s)
|
|||
if (sndmodule)
|
||||
sndmodule->functions->sound->pS_LocalSound (s);
|
||||
}
|
||||
|
||||
void
|
||||
S_BlockSound (void)
|
||||
{
|
||||
if (sndmodule)
|
||||
sndmodule->functions->sound->pS_BlockSound ();
|
||||
}
|
||||
|
||||
void
|
||||
S_UnblockSound (void)
|
||||
{
|
||||
if (sndmodule)
|
||||
sndmodule->functions->sound->pS_UnblockSound ();
|
||||
}
|
||||
|
|
|
@ -82,24 +82,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
int
|
||||
check_card (int card)
|
||||
{
|
||||
|
@ -352,6 +334,8 @@ SNDDMA_Submit (void)
|
|||
int i, s, e;
|
||||
int rc;
|
||||
|
||||
if (snd_blocked)
|
||||
return;
|
||||
count += setup.buf.block.frag_size - 1;
|
||||
count /= setup.buf.block.frag_size;
|
||||
s = soundtime / setup.buf.block.frag_size;
|
||||
|
@ -422,6 +406,33 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
if (mmap_control->status.status == SND_PCM_STATUS_RUNNING) {
|
||||
if ((rc = snd_pcm_channel_stop (pcm_handle, SND_PCM_CHANNEL_PLAYBACK))
|
||||
< 0) {
|
||||
fprintf (stderr, "unable to stop playback. %s\n",
|
||||
snd_strerror (rc));
|
||||
exit (1);
|
||||
}
|
||||
if ((rc = snd_pcm_plugin_prepare (pcm_handle,
|
||||
SND_PCM_CHANNEL_PLAYBACK)) < 0) {
|
||||
fprintf (stderr,
|
||||
"underrun: playback channel prepare error. %s\n",
|
||||
snd_strerror (rc));
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -56,24 +56,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
|
||||
qboolean
|
||||
SNDDMA_Init (void)
|
||||
|
@ -292,6 +274,9 @@ SNDDMA_Submit (void)
|
|||
int state;
|
||||
int count = paintedtime - soundtime;
|
||||
|
||||
if (snd_blocked)
|
||||
return;
|
||||
|
||||
nframes = count / shm->channels;
|
||||
|
||||
snd_pcm_mmap_begin (pcm, &areas, &offset, &nframes);
|
||||
|
@ -352,6 +337,20 @@ PluginInfo (void)
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
snd_pcm_pause (pcm, 1);
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
snd_pcm_pause (pcm, 0);
|
||||
}
|
||||
|
|
|
@ -62,24 +62,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
qboolean
|
||||
SNDDMA_Init (void)
|
||||
{
|
||||
|
@ -138,6 +120,9 @@ SNDDMA_Submit (void)
|
|||
{
|
||||
int count = (paintedtime - soundtime) * shm->samplebits / 8;
|
||||
|
||||
if (snd_blocked)
|
||||
return;
|
||||
|
||||
Qwrite (snd_file, shm->buffer, count);
|
||||
}
|
||||
|
||||
|
@ -178,6 +163,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -988,3 +988,19 @@ void
|
|||
SND_EndPrecaching (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SND_BlockSound (void)
|
||||
{
|
||||
if (++snd_blocked == 1)
|
||||
SNDDMA_BlockSound ();
|
||||
}
|
||||
|
||||
void
|
||||
SND_UnblockSound (void)
|
||||
{
|
||||
if (!snd_blocked)
|
||||
return;
|
||||
if (!--snd_blocked)
|
||||
SNDDMA_UnblockSound ();
|
||||
}
|
||||
|
|
|
@ -56,24 +56,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
void SND_Init_Cvars (void);
|
||||
|
||||
void
|
||||
|
@ -215,6 +197,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -80,24 +80,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
qboolean
|
||||
SNDDMA_Init (void)
|
||||
{
|
||||
|
@ -360,6 +342,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -61,26 +61,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
void SND_PaintChannels (int endtime);
|
||||
|
||||
static void
|
||||
paint_audio (void *unused, Uint8 * stream, int len)
|
||||
{
|
||||
|
@ -216,6 +196,9 @@ SNDDMA_Shutdown (void)
|
|||
void
|
||||
SNDDMA_Submit (void)
|
||||
{
|
||||
if (snd_blocked)
|
||||
return;
|
||||
|
||||
SDL_UnlockAudio();
|
||||
SDL_LockAudio();
|
||||
}
|
||||
|
@ -257,6 +240,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -58,24 +58,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
|
||||
qboolean
|
||||
SNDDMA_Init (void)
|
||||
|
@ -311,6 +293,9 @@ SNDDMA_Submit (void)
|
|||
int idx;
|
||||
int stop = paintedtime;
|
||||
|
||||
if (snd_blocked)
|
||||
return;
|
||||
|
||||
if (paintedtime < wbufp)
|
||||
wbufp = 0; // reset
|
||||
|
||||
|
@ -377,6 +362,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -72,24 +72,6 @@ general_funcs_t plugin_info_general_funcs;
|
|||
sound_data_t plugin_info_sound_data;
|
||||
sound_funcs_t plugin_info_sound_funcs;
|
||||
|
||||
void SND_Init (void);
|
||||
void SND_Shutdown (void);
|
||||
void SND_AmbientOff (void);
|
||||
void SND_AmbientOn (void);
|
||||
void SND_TouchSound (char *sample);
|
||||
void SND_ClearBuffer (void);
|
||||
void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void SND_StopSound (int entnum, int entchannel);
|
||||
sfx_t *SND_PrecacheSound (char *sample);
|
||||
void SND_ClearPrecache (void);
|
||||
void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
|
||||
void SND_StopAllSounds (qboolean clear);
|
||||
void SND_BeginPrecaching (void);
|
||||
void SND_EndPrecaching (void);
|
||||
void SND_ExtraUpdate (void);
|
||||
void SND_LocalSound (char *s);
|
||||
|
||||
qboolean
|
||||
SNDDMA_Init (void)
|
||||
{
|
||||
|
@ -225,6 +207,9 @@ SNDDMA_Submit (void)
|
|||
int idx;
|
||||
int stop = paintedtime;
|
||||
|
||||
if (snd_blocked)
|
||||
return;
|
||||
|
||||
if (paintedtime < wbufp)
|
||||
wbufp = 0; // reset
|
||||
|
||||
|
@ -291,6 +276,18 @@ PluginInfo (void) {
|
|||
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
|
||||
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
|
||||
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
|
||||
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
|
||||
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
|
||||
|
||||
return &plugin_info;
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SNDDMA_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include <X11/extensions/XShm.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
# include <X11/extensions/xf86dga.h>
|
||||
#endif
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -64,9 +63,11 @@
|
|||
#include "QF/keys.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "context_x11.h"
|
||||
#include "dga_check.h"
|
||||
|
||||
|
@ -82,7 +83,8 @@ static int p_mouse_x, p_mouse_y;
|
|||
|
||||
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
||||
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||
#define INPUT_MASK (KEY_MASK | MOUSE_MASK)
|
||||
#define FOCUS_MASK (FocusChangeMask)
|
||||
#define INPUT_MASK (KEY_MASK | MOUSE_MASK | FOCUS_MASK)
|
||||
|
||||
static int
|
||||
XLateKey (XKeyEvent * ev, qboolean modified)
|
||||
|
@ -337,6 +339,19 @@ event_button (XEvent * event)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusout (XEvent * event)
|
||||
{
|
||||
XAutoRepeatOn (x_disp);
|
||||
S_BlockSound ();
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusin (XEvent * event)
|
||||
{
|
||||
XAutoRepeatOff (x_disp);
|
||||
S_UnblockSound ();
|
||||
}
|
||||
|
||||
static void
|
||||
center_pointer (void)
|
||||
|
@ -464,22 +479,22 @@ IN_LL_Init (void)
|
|||
XChangeWindowAttributes (x_disp, x_win, attribmask, &attribs_2);
|
||||
}
|
||||
|
||||
if (COM_CheckParm ("-nomouse"))
|
||||
return;
|
||||
|
||||
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
|
||||
if (vid_fullscreen->int_val) {
|
||||
Cvar_Set (_windowed_mouse, "1");
|
||||
_windowed_mouse->flags |= CVAR_ROM;
|
||||
}
|
||||
|
||||
in_mouse_avail = 1;
|
||||
|
||||
X11_AddEvent (KeyPress, &event_key);
|
||||
X11_AddEvent (KeyRelease, &event_key);
|
||||
X11_AddEvent (ButtonPress, &event_button);
|
||||
X11_AddEvent (ButtonRelease, &event_button);
|
||||
X11_AddEvent (MotionNotify, &event_motion);
|
||||
X11_AddEvent (FocusIn, &event_focusin);
|
||||
X11_AddEvent (FocusOut, &event_focusout);
|
||||
|
||||
if (!COM_CheckParm ("-nomouse")) {
|
||||
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
|
||||
if (vid_fullscreen->int_val) {
|
||||
Cvar_Set (_windowed_mouse, "1");
|
||||
_windowed_mouse->flags |= CVAR_ROM;
|
||||
}
|
||||
|
||||
X11_AddEvent (ButtonPress, &event_button);
|
||||
X11_AddEvent (ButtonRelease, &event_button);
|
||||
X11_AddEvent (MotionNotify, &event_motion);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -688,10 +688,10 @@ AppActivate (BOOL fActive, BOOL minimize)
|
|||
|
||||
// enable/disable sound on focus gain/loss
|
||||
if (!ActiveApp && sound_active) {
|
||||
//XXX S_BlockSound ();
|
||||
S_BlockSound ();
|
||||
sound_active = false;
|
||||
} else if (ActiveApp && !sound_active) {
|
||||
//XXX S_UnblockSound ();
|
||||
S_UnblockSound ();
|
||||
sound_active = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
#endif
|
||||
#ifdef HAVE_RPC_TYPES_H
|
||||
# include <rpc/types.h>
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
|
|
Loading…
Reference in a new issue