mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
More beauty tinkering: decorate the 'start' pointer of the mixing functions
and some VoiceNode struct members with a const, commit forgotten vorbis.c changes. git-svn-id: https://svn.eduke32.com/eduke32@2100 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a9278e1977
commit
fdd84d1870
5 changed files with 63 additions and 71 deletions
|
@ -120,11 +120,11 @@ typedef struct VoiceNode
|
|||
playbackstatus ( *GetSound )( struct VoiceNode *voice );
|
||||
|
||||
void ( *mix )( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length );
|
||||
const char *start, uint32_t length );
|
||||
|
||||
char *NextBlock;
|
||||
char *LoopStart;
|
||||
char *LoopEnd;
|
||||
const char *NextBlock;
|
||||
const char *LoopStart;
|
||||
const char *LoopEnd;
|
||||
unsigned LoopCount;
|
||||
uint32_t LoopSize;
|
||||
uint32_t BlockLength;
|
||||
|
@ -132,7 +132,7 @@ typedef struct VoiceNode
|
|||
uint32_t PitchScale;
|
||||
uint32_t FixedPointBufferSize;
|
||||
|
||||
char *sound;
|
||||
const char *sound;
|
||||
uint32_t length;
|
||||
uint32_t SamplingRate;
|
||||
uint32_t RateScale;
|
||||
|
@ -146,8 +146,8 @@ typedef struct VoiceNode
|
|||
void ( *DemandFeed )( char **ptr, uint32_t *length );
|
||||
void *extra;
|
||||
|
||||
int16_t *LeftVolume;
|
||||
int16_t *RightVolume;
|
||||
const int16_t *LeftVolume;
|
||||
const int16_t *RightVolume;
|
||||
|
||||
uint32_t callbackval;
|
||||
|
||||
|
@ -240,28 +240,28 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice );
|
|||
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length );
|
||||
|
||||
void MV_Mix8BitMono( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length );
|
||||
const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitStereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitMono( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitStereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitMono16( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitMono16( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length );
|
||||
const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitStereo16( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitStereo16( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int32_t count );
|
||||
|
||||
|
@ -275,27 +275,40 @@ void MV_8BitReverbFast( int8_t *src, int8_t *dest, int32_t count, int32_t shift
|
|||
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length );
|
||||
|
||||
void MV_Mix8BitMono8Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length );
|
||||
const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitStereo8Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitMono8Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitStereo8Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitMono16Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitMono16Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length );
|
||||
const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix8BitStereo16Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
void MV_Mix16BitStereo16Stereo( uint32_t position,
|
||||
uint32_t rate, char *start, uint32_t length );
|
||||
uint32_t rate, const char *start, uint32_t length );
|
||||
|
||||
|
||||
extern char *MV_HarshClipTable;
|
||||
extern char *MV_MixDestination; // pointer to the next output sample
|
||||
extern uint32_t MV_MixPosition; // return value of where the source pointer got to
|
||||
extern const int16_t *MV_LeftVolume;
|
||||
extern const int16_t *MV_RightVolume;
|
||||
extern int32_t MV_SampleSize;
|
||||
extern int32_t MV_RightChannelOffset;
|
||||
|
||||
#ifdef __POWERPC__
|
||||
# define BIGENDIAN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,17 +20,6 @@
|
|||
|
||||
#include "_multivc.h"
|
||||
|
||||
extern char *MV_HarshClipTable;
|
||||
extern char *MV_MixDestination; // pointer to the next output sample
|
||||
extern uint32_t MV_MixPosition; // return value of where the source pointer got to
|
||||
extern int16_t *MV_LeftVolume;
|
||||
extern int16_t *MV_RightVolume;
|
||||
extern int32_t MV_SampleSize;
|
||||
extern int32_t MV_RightChannelOffset;
|
||||
|
||||
#ifdef __POWERPC__
|
||||
# define BIGENDIAN
|
||||
#endif
|
||||
|
||||
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length )
|
||||
{
|
||||
|
@ -51,7 +40,7 @@ void ClearBuffer_DW( void *ptr, unsigned data, int32_t length )
|
|||
|
||||
// 8-bit mono source, 8-bit mono output
|
||||
void MV_Mix8BitMono( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -75,7 +64,7 @@ void MV_Mix8BitMono( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit mono source, 8-bit stereo output
|
||||
void MV_Mix8BitStereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -103,7 +92,7 @@ void MV_Mix8BitStereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -128,7 +117,7 @@ void MV_Mix16BitMono( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -158,7 +147,7 @@ void MV_Mix16BitStereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono16( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint16_t *source = (uint16_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -192,7 +181,7 @@ void MV_Mix16BitMono16( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit mono source, 8-bit mono output
|
||||
void MV_Mix8BitMono16( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
int8_t *source = (int8_t *) start + 1;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -216,7 +205,7 @@ void MV_Mix8BitMono16( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit mono source, 8-bit stereo output
|
||||
void MV_Mix8BitStereo16( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
int8_t *source = (int8_t *) start + 1;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -244,7 +233,7 @@ void MV_Mix8BitStereo16( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint16_t *source = (uint16_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
|
|
@ -20,17 +20,6 @@
|
|||
|
||||
#include "_multivc.h"
|
||||
|
||||
extern char *MV_HarshClipTable;
|
||||
extern char *MV_MixDestination; // pointer to the next output sample
|
||||
extern uint32_t MV_MixPosition; // return value of where the source pointer got to
|
||||
extern int16_t *MV_LeftVolume;
|
||||
extern int16_t *MV_RightVolume;
|
||||
extern int32_t MV_SampleSize;
|
||||
extern int32_t MV_RightChannelOffset;
|
||||
|
||||
#ifdef __POWERPC__
|
||||
# define BIGENDIAN
|
||||
#endif
|
||||
|
||||
/*
|
||||
JBF:
|
||||
|
@ -43,7 +32,7 @@ extern int32_t MV_RightChannelOffset;
|
|||
|
||||
// 8-bit stereo source, 8-bit mono output
|
||||
void MV_Mix8BitMono8Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -68,7 +57,7 @@ void MV_Mix8BitMono8Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit stereo source, 8-bit stereo output
|
||||
void MV_Mix8BitStereo8Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -96,7 +85,7 @@ void MV_Mix8BitStereo8Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono8Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -122,7 +111,7 @@ void MV_Mix16BitMono8Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 8-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo8Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint8_t *source = (uint8_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -152,7 +141,7 @@ void MV_Mix16BitStereo8Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono16Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint16_t *source = (uint16_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
@ -197,7 +186,7 @@ void MV_Mix16BitMono16Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit stereo source, 8-bit mono output
|
||||
void MV_Mix8BitMono16Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
int8_t *source = (int8_t *) start + 1;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -224,7 +213,7 @@ void MV_Mix8BitMono16Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit stereo source, 8-bit stereo output
|
||||
void MV_Mix8BitStereo16Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
int8_t *source = (int8_t *) start + 1;
|
||||
uint8_t *dest = (uint8_t *) MV_MixDestination;
|
||||
|
@ -252,7 +241,7 @@ void MV_Mix8BitStereo16Stereo( uint32_t position, uint32_t rate,
|
|||
|
||||
// 16-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16Stereo( uint32_t position, uint32_t rate,
|
||||
char *start, uint32_t length )
|
||||
const char *start, uint32_t length )
|
||||
{
|
||||
uint16_t *source = (uint16_t *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
|
|
|
@ -143,8 +143,8 @@ static void (*MV_MixFunction)(VoiceNode *voice, int32_t buffer);
|
|||
|
||||
char *MV_HarshClipTable;
|
||||
char *MV_MixDestination;
|
||||
int16_t *MV_LeftVolume;
|
||||
int16_t *MV_RightVolume;
|
||||
const int16_t *MV_LeftVolume;
|
||||
const int16_t *MV_RightVolume;
|
||||
int32_t MV_SampleSize = 1;
|
||||
int32_t MV_RightChannelOffset;
|
||||
|
||||
|
@ -232,7 +232,7 @@ const char *MV_ErrorString(int32_t ErrorNumber)
|
|||
|
||||
static void MV_Mix(VoiceNode *voice,int32_t buffer)
|
||||
{
|
||||
char *start;
|
||||
const char *start;
|
||||
int32_t length;
|
||||
int32_t voclength;
|
||||
uint32_t position;
|
||||
|
@ -751,7 +751,8 @@ static playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice)
|
|||
return(NoMoreData);
|
||||
|
||||
voice->position = 0;
|
||||
(voice->DemandFeed)(&voice->sound, &voice->BlockLength);
|
||||
// TODO: learn how to properly attach the 'const' in pointer-pointers :O
|
||||
(voice->DemandFeed)((char **)&voice->sound, &voice->BlockLength);
|
||||
voice->length = min(voice->BlockLength, 0x8000);
|
||||
voice->BlockLength -= voice->length;
|
||||
voice->length <<= 16;
|
||||
|
@ -2189,7 +2190,7 @@ int32_t MV_PlayVOC3D
|
|||
|
||||
volume = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 31
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[ angle ][ volume ].left;
|
||||
|
|
|
@ -195,7 +195,7 @@ static playbackstatus MV_GetNextVorbisBlock
|
|||
voice->channels = vi->channels;
|
||||
voice->SamplingRate = vi->rate;
|
||||
voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) - voice->RateScale;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MV_MIXBUFFERSIZE ) - voice->RateScale;
|
||||
MV_SetVoiceMixMode( voice );
|
||||
vd->lastbitstream = bitstream;
|
||||
}
|
||||
|
@ -245,13 +245,13 @@ int32_t MV_PlayVorbis3D
|
|||
if ( distance < 0 )
|
||||
{
|
||||
distance = -distance;
|
||||
angle += MV_NumPanPositions / 2;
|
||||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
volume = MIX_VOLUME( distance );
|
||||
|
||||
// Ensure angle is within 0 - 31
|
||||
angle &= MV_MaxPanPosition;
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[ angle ][ volume ].left;
|
||||
right = MV_PanTable[ angle ][ volume ].right;
|
||||
|
@ -395,7 +395,7 @@ int32_t MV_PlayLoopedVorbis
|
|||
|
||||
voice->SamplingRate = vi->rate;
|
||||
voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) -
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MV_MIXBUFFERSIZE ) -
|
||||
voice->RateScale;
|
||||
MV_SetVoiceMixMode( voice );
|
||||
|
||||
|
|
Loading…
Reference in a new issue