#include "sound.h"
-typedef struct
+typedef struct sfxbuffer_s
{
unsigned int length;
unsigned int offset;
- qbyte data[4]; // variable sized
+ unsigned char data[4]; // variable sized
} sfxbuffer_t;
-typedef struct
+typedef struct snd_format_s
{
unsigned int speed;
unsigned int width;
{
char name[MAX_QPATH];
sfx_t *next;
- mempool_t *mempool;
+ size_t memsize; // total memory used (including sfx_t and fetcher data)
int locks; // One lock is automatically granted while the sfx is
// playing (and removed when stopped). Locks can also be
// added by S_PrecacheSound and S_ServerSounds.
void *fetcher_data; // Per-sfx data for the sound fetching functions
};
-typedef struct
+typedef struct dma_s
{
snd_format_t format;
int samples; // mono samples in buffer
int bufferlength; // used only by certain drivers
} dma_t;
-typedef struct
+typedef struct channel_s
{
sfx_t *sfx; // sfx number
unsigned int flags; // cf CHANNELFLAG_* defines
} channel_t;
typedef const sfxbuffer_t* (*snd_fetcher_getsb_t) (channel_t* ch, unsigned int start, unsigned int nbsamples);
-typedef void (*snd_fetcher_end_t) (channel_t* ch);
+typedef void (*snd_fetcher_endsb_t) (channel_t* ch);
+typedef void (*snd_fetcher_free_t) (sfx_t* sfx);
struct snd_fetcher_s
{
snd_fetcher_getsb_t getsb;
- snd_fetcher_end_t end;
+ snd_fetcher_endsb_t endsb;
+ snd_fetcher_free_t free;
};
void S_PaintChannels(int endtime);
void SNDDMA_Shutdown(void);
qboolean S_LoadSound (sfx_t *s, qboolean complain);
-void S_UnloadSound(sfx_t *s);
void S_LockSfx (sfx_t *sfx);
void S_UnlockSfx (sfx_t *sfx);
void *S_LockBuffer(void);
void S_UnlockBuffer(void);
-extern size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* in_format, qbyte *out_data, const char* sfxname);
+extern size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_format_t* in_format, unsigned char *out_data, const char* sfxname);
-// ====================================================================
-// User-setable variables
// ====================================================================
// 0 to NUM_AMBIENTS - 1 = water, etc
extern int snd_blocked;
+extern mempool_t *snd_mempool;
+
#endif