* OpenAL support, from BlackAura aka Stuart Dalton <badcdev@gmail.com>

+ An abstract codec system, simplifying support for new formats
  + Changes versus BlackAura's patch:
    o Consolidated the OpenAL parts into one file
    o Changed the function naming scheme to more closely resemble Q3
    o Changed the interface to fall back on the "base" sound system
      if loading OpenAL fails
  + This is enabled on Linux and MinGW for now, but should work on the
    other *nixs with appropriate additions to the Makefile
  + NOT enabled on OS X or MSVC Windows builds
  + Probably breaks the Windows build again
* Retabulated sdl_snd.c and made the messages less verbose since
  there do not seem to be many having problems with SDL sound now
This commit is contained in:
Tim Angus 2005-11-13 18:58:14 +00:00
parent 79ceef93cc
commit 84c4f21082
14 changed files with 3813 additions and 703 deletions

View file

@ -117,6 +117,31 @@ typedef struct {
int dataofs; // chunk starts this many bytes from file start
} wavinfo_t;
// Interface between Q3 sound "api" and the sound backend
typedef struct
{
void (*Shutdown)(void);
void (*StartSound)( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx );
void (*StartLocalSound)( sfxHandle_t sfx, int channelNum );
void (*StartBackgroundTrack)( const char *intro, const char *loop );
void (*StopBackgroundTrack)( void );
void (*RawSamples)(int samples, int rate, int width, int channels, const byte *data, float volume);
void (*StopAllSounds)( void );
void (*ClearLoopingSounds)( qboolean killall );
void (*AddLoopingSound)( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
void (*AddRealLoopingSound)( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
void (*StopLoopingSound)(int entityNum );
void (*Respatialize)( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
void (*UpdateEntityPosition)( int entityNum, const vec3_t origin );
void (*Update)( void );
void (*DisableSounds)( void );
void (*BeginRegistration)( void );
sfxHandle_t (*RegisterSound)( const char *sample, qboolean compressed );
void (*ClearSoundBuffer)( void );
void (*SoundInfo)( void );
void (*SoundList)( void );
} soundInterface_t;
/*
====================================================================
@ -157,14 +182,11 @@ extern dma_t dma;
#define MAX_RAW_SAMPLES 16384
extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
extern cvar_t *s_volume;
extern cvar_t *s_nosound;
extern cvar_t *s_khz;
extern cvar_t *s_show;
extern cvar_t *s_mixahead;
extern cvar_t *s_volume;
extern cvar_t *s_musicVolume;
extern cvar_t *s_doppler;
extern cvar_t *s_testsound;
extern cvar_t *s_separation;
extern cvar_t *s_testsound;
qboolean S_LoadSound( sfx_t *sfx );
@ -204,3 +226,18 @@ extern short *sfxScratchBuffer;
extern sfx_t *sfxScratchPointer;
extern int sfxScratchIndex;
qboolean S_Base_Init( soundInterface_t *si );
// OpenAL stuff
typedef enum
{
SRCPRI_AMBIENT = 0, // Ambient sound effects
SRCPRI_ENTITY, // Entity sound effects
SRCPRI_ONESHOT, // One-shot sounds
SRCPRI_LOCAL, // Local sounds
SRCPRI_STREAM // Streams (music, cutscenes)
} alSrcPriority_t;
typedef int srcHandle_t;
qboolean S_AL_Init( soundInterface_t *si );