fallout2-ce/src/sound_decoder.h

49 lines
1.2 KiB
C
Raw Normal View History

2022-05-19 01:51:26 -07:00
#ifndef SOUND_DECODER_H
#define SOUND_DECODER_H
#include <stddef.h>
2022-09-23 05:43:44 -07:00
namespace fallout {
2022-05-19 01:51:26 -07:00
typedef int(SoundDecoderReadProc)(int fileHandle, void* buffer, unsigned int size);
typedef struct SoundDecoder {
SoundDecoderReadProc* readProc;
int fd;
unsigned char* bufferIn;
size_t bufferInSize;
// Next input byte.
unsigned char* nextIn;
// Number of bytes remaining in the input buffer.
int remainingInSize;
// Bit accumulator.
int hold;
// Number of bits in bit accumulator.
int bits;
2022-12-25 11:30:31 -08:00
int levels;
int subbands;
int samples_per_subband;
int total_samples;
unsigned char* prev_samples;
unsigned char* samples;
int block_samples_per_subband;
int block_total_samples;
int channels;
int rate;
int file_cnt;
unsigned char* samp_ptr;
int samp_cnt;
2022-05-19 01:51:26 -07:00
} SoundDecoder;
size_t soundDecoderDecode(SoundDecoder* soundDecoder, void* buffer, size_t size);
void soundDecoderFree(SoundDecoder* soundDecoder);
2022-12-25 11:30:31 -08:00
SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, int* channelsPtr, int* sampleRatePtr, int* sampleCountPtr);
2022-05-19 01:51:26 -07:00
2022-09-23 05:43:44 -07:00
} // namespace fallout
2022-05-19 01:51:26 -07:00
#endif /* SOUND_DECODER_H */