| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifndef _SND_CODEC_H_ |
| 25 |
#define _SND_CODEC_H_ |
| 26 |
|
| 27 |
#include "../qcommon/q_shared.h" |
| 28 |
#include "../qcommon/qcommon.h" |
| 29 |
|
| 30 |
typedef struct snd_info_s |
| 31 |
{ |
| 32 |
int rate; |
| 33 |
int width; |
| 34 |
int channels; |
| 35 |
int samples; |
| 36 |
int size; |
| 37 |
int dataofs; |
| 38 |
} snd_info_t; |
| 39 |
|
| 40 |
typedef struct snd_codec_s snd_codec_t; |
| 41 |
|
| 42 |
typedef struct snd_stream_s |
| 43 |
{ |
| 44 |
snd_codec_t *codec; |
| 45 |
fileHandle_t file; |
| 46 |
snd_info_t info; |
| 47 |
int length; |
| 48 |
int pos; |
| 49 |
void *ptr; |
| 50 |
} snd_stream_t; |
| 51 |
|
| 52 |
|
| 53 |
typedef void *(*CODEC_LOAD)(const char *filename, snd_info_t *info); |
| 54 |
typedef snd_stream_t *(*CODEC_OPEN)(const char *filename); |
| 55 |
typedef int (*CODEC_READ)(snd_stream_t *stream, int bytes, void *buffer); |
| 56 |
typedef void (*CODEC_CLOSE)(snd_stream_t *stream); |
| 57 |
|
| 58 |
|
| 59 |
struct snd_codec_s |
| 60 |
{ |
| 61 |
char *ext; |
| 62 |
CODEC_LOAD load; |
| 63 |
CODEC_OPEN open; |
| 64 |
CODEC_READ read; |
| 65 |
CODEC_CLOSE close; |
| 66 |
snd_codec_t *next; |
| 67 |
}; |
| 68 |
|
| 69 |
|
| 70 |
void S_CodecInit( void ); |
| 71 |
void S_CodecShutdown( void ); |
| 72 |
void S_CodecRegister(snd_codec_t *codec); |
| 73 |
void *S_CodecLoad(const char *filename, snd_info_t *info); |
| 74 |
snd_stream_t *S_CodecOpenStream(const char *filename); |
| 75 |
void S_CodecCloseStream(snd_stream_t *stream); |
| 76 |
int S_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); |
| 77 |
|
| 78 |
|
| 79 |
snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec); |
| 80 |
void S_CodecUtilClose(snd_stream_t **stream); |
| 81 |
|
| 82 |
|
| 83 |
extern snd_codec_t wav_codec; |
| 84 |
void *S_WAV_CodecLoad(const char *filename, snd_info_t *info); |
| 85 |
snd_stream_t *S_WAV_CodecOpenStream(const char *filename); |
| 86 |
void S_WAV_CodecCloseStream(snd_stream_t *stream); |
| 87 |
int S_WAV_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); |
| 88 |
|
| 89 |
|
| 90 |
#ifdef USE_CODEC_VORBIS |
| 91 |
extern snd_codec_t ogg_codec; |
| 92 |
void *S_OGG_CodecLoad(const char *filename, snd_info_t *info); |
| 93 |
snd_stream_t *S_OGG_CodecOpenStream(const char *filename); |
| 94 |
void S_OGG_CodecCloseStream(snd_stream_t *stream); |
| 95 |
int S_OGG_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); |
| 96 |
#endif |
| 97 |
|
| 98 |
|
| 99 |
#ifdef USE_CODEC_OPUS |
| 100 |
extern snd_codec_t opus_codec; |
| 101 |
void *S_OggOpus_CodecLoad(const char *filename, snd_info_t *info); |
| 102 |
snd_stream_t *S_OggOpus_CodecOpenStream(const char *filename); |
| 103 |
void S_OggOpus_CodecCloseStream(snd_stream_t *stream); |
| 104 |
int S_OggOpus_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); |
| 105 |
#endif |
| 106 |
|
| 107 |
#endif |