multivoc.c: trivial stylistic changes, make some functions static

git-svn-id: https://svn.eduke32.com/eduke32@2098 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-11-01 22:01:54 +00:00
parent 3713e3db9b
commit 2da13064c1
2 changed files with 40 additions and 111 deletions

View file

@ -86,14 +86,14 @@ static inline uint32_t SWAP32(uint32_t s)
#ifndef max #ifndef max
#define max(x,y) ((x) > (y) ? (x) : (y)) #define max(x,y) ((x) > (y) ? (x) : (y))
#endif #endif
/*
#define RoundFixed( fixedval, bits ) \ #define RoundFixed( fixedval, bits ) \
( \ ( \
( \ ( \
(fixedval) + ( 1 << ( (bits) - 1 ) )\ (fixedval) + ( 1 << ( (bits) - 1 ) )\
) >> (bits) \ ) >> (bits) \
) )
*/
#define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] ) #define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] )
static int32_t MV_ReverbLevel; static int32_t MV_ReverbLevel;
@ -244,8 +244,8 @@ static void MV_Mix(VoiceNode *voice,int32_t buffer)
uint32_t rate; uint32_t rate;
uint32_t FixedPointBufferSize; uint32_t FixedPointBufferSize;
/* cheap fix for a crash under 64-bit linux --\ /* cheap fix for a crash under 64-bit linux */
v */ /* v v v v */
if (voice->length == 0 && (!voice->GetSound || voice->GetSound(voice) != KeepPlaying)) if (voice->length == 0 && (!voice->GetSound || voice->GetSound(voice) != KeepPlaying))
return; return;
@ -329,7 +329,7 @@ void MV_PlayVoice(VoiceNode *voice)
Removes the voice from the play list and adds it to the free list. Removes the voice from the play list and adds it to the free list.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_StopVoice(VoiceNode *voice) static void MV_StopVoice(VoiceNode *voice)
{ {
DisableInterrupts(); DisableInterrupts();
@ -363,7 +363,7 @@ void MV_StopVoice(VoiceNode *voice)
MV_GetNextWAVBlock MV_GetNextWAVBlock
MV_SetVoiceMixMode MV_SetVoiceMixMode
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_ServiceVoc(void) static void MV_ServiceVoc(void)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *next; VoiceNode *next;
@ -394,7 +394,7 @@ void MV_ServiceVoc(void)
int32_t count; int32_t count;
int32_t length; int32_t length;
end = MV_MixBuffer[ 0 ] + MV_BufferLength;; end = MV_MixBuffer[ 0 ] + MV_BufferLength;
dest = MV_MixBuffer[ MV_MixPage ]; dest = MV_MixBuffer[ MV_MixPage ];
source = MV_MixBuffer[ MV_MixPage ] - MV_ReverbDelay; source = MV_MixBuffer[ MV_MixPage ] - MV_ReverbDelay;
@ -453,6 +453,7 @@ void MV_ServiceVoc(void)
MV_MixFunction(voice, MV_MixPage); MV_MixFunction(voice, MV_MixPage);
// Is this voice done? // Is this voice done?
if (!voice->Playing) if (!voice->Playing)
{ {
@ -482,7 +483,7 @@ void MV_ServiceVoc(void)
Interpret the information of a VOC format sound file. Interpret the information of a VOC format sound file.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextVOCBlock(VoiceNode *voice) static playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
{ {
uint8_t *ptr; uint8_t *ptr;
int32_t blocktype; int32_t blocktype;
@ -738,7 +739,7 @@ playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
Controls playback of demand fed data. Controls playback of demand fed data.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice) static playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice)
{ {
if (voice->BlockLength > 0) if (voice->BlockLength > 0)
{ {
@ -770,7 +771,7 @@ playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice)
Controls playback of demand fed data. Controls playback of demand fed data.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextRawBlock(VoiceNode *voice) static playbackstatus MV_GetNextRawBlock(VoiceNode *voice)
{ {
if (voice->BlockLength <= 0) if (voice->BlockLength <= 0)
{ {
@ -803,7 +804,7 @@ playbackstatus MV_GetNextRawBlock(VoiceNode *voice)
Controls playback of demand fed data. Controls playback of demand fed data.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextWAVBlock(VoiceNode *voice) static playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
{ {
if (voice->BlockLength <= 0) if (voice->BlockLength <= 0)
{ {
@ -836,7 +837,7 @@ playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
Locates the voice with the specified handle. Locates the voice with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
VoiceNode *MV_GetVoice(int32_t handle) static VoiceNode *MV_GetVoice(int32_t handle)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1090,7 +1091,7 @@ int32_t MV_VoiceAvailable(int32_t priority)
Sets the pitch for the specified voice. Sets the pitch for the specified voice.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVoicePitch static void MV_SetVoicePitch
( (
VoiceNode *voice, VoiceNode *voice,
uint32_t rate, uint32_t rate,
@ -1183,11 +1184,7 @@ int32_t MV_SetFrequency
volume. volume.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
static int16_t *MV_GetVolumeTable static int16_t *MV_GetVolumeTable(int32_t vol)
(
int32_t vol
)
{ {
int32_t volume; int32_t volume;
int16_t *table; int16_t *table;
@ -1229,11 +1226,7 @@ static int16_t *MV_GetVolumeTable
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVoiceMixMode void MV_SetVoiceMixMode(VoiceNode *voice)
(
VoiceNode *voice
)
{ {
//int32_t flags; //int32_t flags;
int32_t test; int32_t test;
@ -1467,11 +1460,7 @@ int32_t MV_PauseVoice
without stoping the sound. without stoping the sound.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_EndLooping int32_t MV_EndLooping(int32_t handle)
(
int32_t handle
)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1586,11 +1575,7 @@ int32_t MV_Pan3D
Sets the level of reverb to add to mix. Sets the level of reverb to add to mix.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverb void MV_SetReverb(int32_t reverb)
(
int32_t reverb
)
{ {
MV_ReverbLevel = MIX_VOLUME(reverb); MV_ReverbLevel = MIX_VOLUME(reverb);
MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ]; MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ];
@ -1603,11 +1588,7 @@ void MV_SetReverb
Sets the level of reverb to add to mix. Sets the level of reverb to add to mix.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetFastReverb void MV_SetFastReverb(int32_t reverb)
(
int32_t reverb
)
{ {
MV_ReverbLevel = max(0, min(16, reverb)); MV_ReverbLevel = max(0, min(16, reverb));
MV_ReverbTable = NULL; MV_ReverbTable = NULL;
@ -1620,11 +1601,7 @@ void MV_SetFastReverb
Returns the maximum delay time for reverb. Returns the maximum delay time for reverb.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_GetMaxReverbDelay int32_t MV_GetMaxReverbDelay(void)
(
void
)
{ {
int32_t maxdelay; int32_t maxdelay;
@ -1640,11 +1617,7 @@ int32_t MV_GetMaxReverbDelay
Returns the current delay time for reverb. Returns the current delay time for reverb.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_GetReverbDelay int32_t MV_GetReverbDelay(void)
(
void
)
{ {
return MV_ReverbDelay / MV_SampleSize; return MV_ReverbDelay / MV_SampleSize;
} }
@ -1656,11 +1629,7 @@ int32_t MV_GetReverbDelay
Sets the delay level of reverb to add to mix. Sets the delay level of reverb to add to mix.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverbDelay void MV_SetReverbDelay(int32_t delay)
(
int32_t delay
)
{ {
int32_t maxdelay; int32_t maxdelay;
@ -1676,7 +1645,7 @@ void MV_SetReverbDelay
Prepares Multivoc to play stereo of mono digitized sounds. Prepares Multivoc to play stereo of mono digitized sounds.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_SetMixMode static int32_t MV_SetMixMode
( (
int32_t numchannels, int32_t numchannels,
int32_t samplebits int32_t samplebits
@ -1745,11 +1714,7 @@ int32_t MV_SetMixMode
Starts the sound playback engine. Starts the sound playback engine.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_StartPlayback static int32_t MV_StartPlayback(void)
(
void
)
{ {
int32_t status; int32_t status;
int32_t buffer; int32_t buffer;
@ -1791,11 +1756,7 @@ int32_t MV_StartPlayback
Stops the sound playback engine. Stops the sound playback engine.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_StopPlayback static void MV_StopPlayback(void)
(
void
)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *next; VoiceNode *next;
@ -2364,7 +2325,7 @@ int32_t MV_PlayLoopedVOC
level. level.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CreateVolumeTable static void MV_CreateVolumeTable
( (
int32_t index, int32_t index,
int32_t volume, int32_t volume,
@ -2407,11 +2368,7 @@ void MV_CreateVolumeTable
level. level.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CalcVolume static void MV_CalcVolume(int32_t MaxVolume)
(
int32_t MaxVolume
)
{ {
int32_t volume; int32_t volume;
@ -2441,11 +2398,7 @@ void MV_CalcVolume
a sound located at a specific angle and distance from the listener. a sound located at a specific angle and distance from the listener.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CalcPanTable static void MV_CalcPanTable(void)
(
void
)
{ {
int32_t level; int32_t level;
int32_t angle; int32_t angle;
@ -2483,11 +2436,7 @@ void MV_CalcPanTable
Sets the volume of digitized sound playback. Sets the volume of digitized sound playback.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVolume void MV_SetVolume(int32_t volume)
(
int32_t volume
)
{ {
volume = max(0, volume); volume = max(0, volume);
volume = min(volume, MV_MaxTotalVolume); volume = min(volume, MV_MaxTotalVolume);
@ -2505,11 +2454,7 @@ void MV_SetVolume
Returns the volume of digitized sound playback. Returns the volume of digitized sound playback.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_GetVolume int32_t MV_GetVolume(void)
(
void
)
{ {
return(MV_TotalVolume); return(MV_TotalVolume);
} }
@ -2521,11 +2466,7 @@ int32_t MV_GetVolume
Set the function to call when a voice stops. Set the function to call when a voice stops.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetCallBack void MV_SetCallBack(void (*function)(uint32_t))
(
void (*function)(uint32_t)
)
{ {
MV_CallBackFunc = function; MV_CallBackFunc = function;
} }
@ -2537,11 +2478,7 @@ void MV_SetCallBack
Set the orientation of the left and right channels. Set the orientation of the left and right channels.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverseStereo void MV_SetReverseStereo(int32_t setting)
(
int32_t setting
)
{ {
MV_SwapLeftRight = setting; MV_SwapLeftRight = setting;
} }
@ -2553,11 +2490,7 @@ void MV_SetReverseStereo
Returns the orientation of the left and right channels. Returns the orientation of the left and right channels.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_GetReverseStereo int32_t MV_GetReverseStereo(void)
(
void
)
{ {
return(MV_SwapLeftRight); return(MV_SwapLeftRight);
} }
@ -2688,11 +2621,7 @@ int32_t MV_Init
Restore any resources allocated by Multivoc back to the system. Restore any resources allocated by Multivoc back to the system.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t MV_Shutdown int32_t MV_Shutdown(void)
(
void
)
{ {
int32_t buffer; int32_t buffer;

View file

@ -75,9 +75,9 @@ void MV_SetFastReverb( int32_t reverb );
int32_t MV_GetMaxReverbDelay( void ); int32_t MV_GetMaxReverbDelay( void );
int32_t MV_GetReverbDelay( void ); int32_t MV_GetReverbDelay( void );
void MV_SetReverbDelay( int32_t delay ); void MV_SetReverbDelay( int32_t delay );
int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits ); //int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits );
int32_t MV_StartPlayback( void ); //int32_t MV_StartPlayback( void );
void MV_StopPlayback( void ); //void MV_StopPlayback( void );
int32_t MV_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ), int32_t MV_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ),
int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
@ -109,7 +109,7 @@ int32_t MV_PlayVorbis( char *ptr, uint32_t length, int32_t pitchoffset, int32_
int32_t MV_PlayLoopedVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t MV_PlayLoopedVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
void MV_CreateVolumeTable( int32_t index, int32_t volume, int32_t MaxVolume ); //void MV_CreateVolumeTable( int32_t index, int32_t volume, int32_t MaxVolume );
void MV_SetVolume( int32_t volume ); void MV_SetVolume( int32_t volume );
int32_t MV_GetVolume( void ); int32_t MV_GetVolume( void );
void MV_SetCallBack( void ( *function )( uint32_t ) ); void MV_SetCallBack( void ( *function )( uint32_t ) );