mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
The last of my audiolib changes for now. These change no functionality.
git-svn-id: https://svn.eduke32.com/eduke32@7127 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
890341d3af
commit
28bed56348
7 changed files with 69 additions and 62 deletions
|
@ -110,9 +110,9 @@ typedef struct VoiceNode
|
|||
struct VoiceNode *next;
|
||||
struct VoiceNode *prev;
|
||||
|
||||
playbackstatus (*GetSound)(struct VoiceNode *voice);
|
||||
playbackstatus (*GetSound)(struct VoiceNode *);
|
||||
|
||||
void (*mix)(struct VoiceNode *voice, uint32_t length);
|
||||
void (*mix)(struct VoiceNode const *, uint32_t);
|
||||
|
||||
const char *sound;
|
||||
|
||||
|
@ -215,17 +215,17 @@ void MV_ReleaseXAVoice(VoiceNode *voice);
|
|||
void MV_ReleaseXMPVoice(VoiceNode *voice);
|
||||
|
||||
// implemented in mix.c
|
||||
void MV_Mix16BitMono(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitMono16(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo16(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_16BitReverb( char const *src, char *dest, int16_t *volume, int32_t count );
|
||||
void MV_Mix16BitMono(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitMono16(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo16(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_16BitReverb(char const *src, char *dest, const int16_t *volume, int32_t count);
|
||||
|
||||
// implemented in mixst.c
|
||||
void MV_Mix16BitMono8Stereo(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo8Stereo(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitMono16Stereo(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo16Stereo(struct VoiceNode *voice, uint32_t length);
|
||||
void MV_Mix16BitMono8Stereo(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo8Stereo(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitMono16Stereo(struct VoiceNode const *voice, uint32_t length);
|
||||
void MV_Mix16BitStereo16Stereo(struct VoiceNode const *voice, uint32_t length);
|
||||
|
||||
extern char *MV_MixDestination; // pointer to the next output sample
|
||||
extern uint32_t MV_MixPosition; // return value of where the source pointer got to
|
||||
|
|
|
@ -71,7 +71,7 @@ static playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
|
|||
return KeepPlaying;
|
||||
}
|
||||
|
||||
const uint8_t *ptr = (uint8_t const *)voice->NextBlock;
|
||||
auto *ptr = (uint8_t const *)voice->NextBlock;
|
||||
|
||||
voice->Paused = FALSE;
|
||||
|
||||
|
|
|
@ -21,18 +21,18 @@
|
|||
#include "_multivc.h"
|
||||
|
||||
/*
|
||||
position = offset of starting sample in start
|
||||
rate = resampling increment
|
||||
start = sound data
|
||||
length = count of samples to mix
|
||||
position = offset of starting sample in source
|
||||
rate = resampling increment
|
||||
volume = direct volume adjustment, 1.0 = no change
|
||||
*/
|
||||
|
||||
// 8-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitMono(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (uint8_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (uint8_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -52,10 +52,11 @@ void MV_Mix16BitMono(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 8-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitStereo(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (uint8_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (uint8_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -77,10 +78,11 @@ void MV_Mix16BitStereo(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 16-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono16(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitMono16(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (int16_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (int16_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -104,10 +106,11 @@ void MV_Mix16BitMono16(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 16-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitStereo16(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (int16_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (int16_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -134,10 +137,10 @@ void MV_Mix16BitStereo16(struct VoiceNode *voice, uint32_t length)
|
|||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
|
||||
void MV_16BitReverb(char const *src, char *dest, const int16_t *volume, int32_t count)
|
||||
{
|
||||
auto input = (uint16_t const *)src;
|
||||
int16_t *output = (int16_t *)dest;
|
||||
auto *input = (uint16_t const *)src;
|
||||
auto *output = (int16_t *)dest;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -150,8 +153,8 @@ void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
|
|||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
#endif
|
||||
|
||||
sample0l = ((int16_t *)volume)[sample0l] >> 8;
|
||||
sample0h = ((int16_t *)volume)[sample0h];
|
||||
sample0l = (volume)[sample0l] >> 8;
|
||||
sample0h = (volume)[sample0h];
|
||||
*output++ = (int16_t)(sample0l + sample0h + 128);
|
||||
} while (--count > 0);
|
||||
}
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
*/
|
||||
|
||||
// 8-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono8Stereo(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitMono8Stereo(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (uint8_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (uint8_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -53,10 +54,11 @@ void MV_Mix16BitMono8Stereo(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 8-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo8Stereo(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitStereo8Stereo(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (uint8_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (uint8_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -79,10 +81,11 @@ void MV_Mix16BitStereo8Stereo(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 16-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono16Stereo(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitMono16Stereo(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (int16_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (int16_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
@ -110,10 +113,11 @@ void MV_Mix16BitMono16Stereo(struct VoiceNode *voice, uint32_t length)
|
|||
}
|
||||
|
||||
// 16-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16Stereo(struct VoiceNode *voice, uint32_t length)
|
||||
void MV_Mix16BitStereo16Stereo(struct VoiceNode const * const voice, uint32_t length)
|
||||
{
|
||||
auto const source = (int16_t const *)voice->sound;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
auto *const source = (int16_t const *)voice->sound;
|
||||
auto * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
uint32_t position = voice->position;
|
||||
uint32_t const rate = voice->RateScale;
|
||||
float const volume = voice->volume;
|
||||
|
|
|
@ -136,7 +136,7 @@ static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
|||
|
||||
static size_t read_vorbis(void *ptr, size_t size, size_t nmemb, void *datasource)
|
||||
{
|
||||
vorbis_data *vorb = (vorbis_data *)datasource;
|
||||
auto *vorb = (vorbis_data *)datasource;
|
||||
|
||||
errno = 0;
|
||||
|
||||
|
@ -169,7 +169,7 @@ static size_t read_vorbis(void *ptr, size_t size, size_t nmemb, void *datasource
|
|||
|
||||
static int seek_vorbis(void *datasource, ogg_int64_t offset, int whence)
|
||||
{
|
||||
vorbis_data *vorb = (vorbis_data *)datasource;
|
||||
auto *vorb = (vorbis_data *)datasource;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ static int close_vorbis(void *datasource)
|
|||
|
||||
static long tell_vorbis(void *datasource)
|
||||
{
|
||||
vorbis_data *vorb = (vorbis_data *)datasource;
|
||||
auto *vorb = (vorbis_data *)datasource;
|
||||
|
||||
return vorb->pos;
|
||||
}
|
||||
|
@ -204,14 +204,14 @@ static ov_callbacks vorbis_callbacks = { read_vorbis, seek_vorbis, close_vorbis,
|
|||
|
||||
int32_t MV_GetVorbisPosition(VoiceNode *voice)
|
||||
{
|
||||
vorbis_data * vd = (vorbis_data *) voice->rawdataptr;
|
||||
auto * vd = (vorbis_data *) voice->rawdataptr;
|
||||
|
||||
return ov_pcm_tell(&vd->vf);
|
||||
}
|
||||
|
||||
void MV_SetVorbisPosition(VoiceNode *voice, int32_t position)
|
||||
{
|
||||
vorbis_data * vd = (vorbis_data *) voice->rawdataptr;
|
||||
auto * vd = (vorbis_data *) voice->rawdataptr;
|
||||
|
||||
ov_pcm_seek(&vd->vf, position);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ static playbackstatus MV_GetNextVorbisBlock(VoiceNode *voice)
|
|||
int bitstream;
|
||||
|
||||
int32_t bytesread = 0;
|
||||
vorbis_data *vd = (vorbis_data *)voice->rawdataptr;
|
||||
auto *vd = (vorbis_data *)voice->rawdataptr;
|
||||
do
|
||||
{
|
||||
#ifdef USING_TREMOR
|
||||
|
@ -370,7 +370,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loo
|
|||
return MV_Error;
|
||||
}
|
||||
|
||||
vorbis_data *vd = (vorbis_data *)calloc(1, sizeof(vorbis_data));
|
||||
auto *vd = (vorbis_data *)calloc(1, sizeof(vorbis_data));
|
||||
|
||||
if (!vd)
|
||||
{
|
||||
|
@ -459,7 +459,7 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
|||
if (voice->wavetype != FMT_VORBIS)
|
||||
return;
|
||||
|
||||
vorbis_data *vd = (vorbis_data *)voice->rawdataptr;
|
||||
auto *vd = (vorbis_data *)voice->rawdataptr;
|
||||
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
|
|
|
@ -129,13 +129,13 @@ static int8_t getSoundData(int8_t *buf, int32_t unit, int32_t sample)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int8_t getFilter(int8_t *buf, int32_t unit)
|
||||
static int8_t getFilter(const int8_t *buf, int32_t unit)
|
||||
{
|
||||
return (*(buf + 4 + unit) >> 4) & 0x03;
|
||||
}
|
||||
|
||||
|
||||
static int8_t getRange(int8_t *buf, int32_t unit)
|
||||
static int8_t getRange(const int8_t *buf, int32_t unit)
|
||||
{
|
||||
return *(buf + 4 + unit) & 0x0F;
|
||||
}
|
||||
|
@ -276,13 +276,13 @@ static void decodeSoundSectStereo(XASector *ssct, xa_data * xad)
|
|||
|
||||
int32_t MV_GetXAPosition(VoiceNode *voice)
|
||||
{
|
||||
xa_data * xad = (xa_data *) voice->rawdataptr;
|
||||
auto * xad = (xa_data *) voice->rawdataptr;
|
||||
return xad->pos;
|
||||
}
|
||||
|
||||
void MV_SetXAPosition(VoiceNode *voice, int32_t position)
|
||||
{
|
||||
xa_data * xad = (xa_data *) voice->rawdataptr;
|
||||
auto * xad = (xa_data *) voice->rawdataptr;
|
||||
|
||||
if (position < XA_DATA_START || (size_t)position >= xad->length)
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ static playbackstatus MV_GetNextXABlock
|
|||
VoiceNode *voice
|
||||
)
|
||||
{
|
||||
xa_data * xad = (xa_data *) voice->rawdataptr;
|
||||
auto * xad = (xa_data *) voice->rawdataptr;
|
||||
XASector ssct;
|
||||
int coding;
|
||||
|
||||
|
@ -477,7 +477,7 @@ int32_t MV_PlayXA(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend
|
|||
|
||||
void MV_ReleaseXAVoice( VoiceNode * voice )
|
||||
{
|
||||
xa_data * xad = (xa_data *) voice->rawdataptr;
|
||||
auto * xad = (xa_data *) voice->rawdataptr;
|
||||
|
||||
if (voice->wavetype != FMT_XA) {
|
||||
return;
|
||||
|
|
|
@ -20,19 +20,19 @@ typedef struct {
|
|||
|
||||
int32_t MV_GetXMPPosition(VoiceNode *voice)
|
||||
{
|
||||
xmp_data * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
auto * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
return xmpd->time;
|
||||
}
|
||||
|
||||
void MV_SetXMPPosition(VoiceNode *voice, int32_t position)
|
||||
{
|
||||
xmp_data * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
auto * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
xmp_seek_time(xmpd->context, position);
|
||||
}
|
||||
|
||||
static playbackstatus MV_GetNextXMPBlock(VoiceNode *voice)
|
||||
{
|
||||
xmp_data * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
auto * xmpd = (xmp_data *)voice->rawdataptr;
|
||||
struct xmp_frame_info mi;
|
||||
|
||||
if (xmp_play_frame(xmpd->context) != 0)
|
||||
|
@ -187,7 +187,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopen
|
|||
|
||||
void MV_ReleaseXMPVoice(VoiceNode * voice)
|
||||
{
|
||||
xmp_data * xmpd = (xmp_data *) voice->rawdataptr;
|
||||
auto * xmpd = (xmp_data *) voice->rawdataptr;
|
||||
|
||||
if (voice->wavetype != FMT_XMP)
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue