git-svn-id: https://svn.eduke32.com/eduke32@354 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2006-11-20 04:55:37 +00:00
parent 20c261babd
commit b6f6873603
5 changed files with 121 additions and 279 deletions

View file

@ -12,6 +12,7 @@ NOASM = 0
# Debugging options # Debugging options
RELEASE?=1 RELEASE?=1
JFAUD?=0 JFAUD?=0
NOSOUND?=0
# build locations # build locations
@ -156,6 +157,10 @@ ifeq ($(RENDERTYPE),WIN)
endif endif
endif endif
ifeq ($(NOSOUND),1)
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_STUB) $(AUDIOLIB_FX_STUB) $(OBJ)/sounds.$o
endif
GAMEOBJS+= $(AUDIOLIBOBJ) GAMEOBJS+= $(AUDIOLIBOBJ)
OURCFLAGS+= $(BUILDCFLAGS) OURCFLAGS+= $(BUILDCFLAGS)
OURCXXFLAGS+= $(BUILDCFLAGS) OURCXXFLAGS+= $(BUILDCFLAGS)

View file

@ -3165,8 +3165,6 @@ void palto(char r,char g,char b,long e)
} }
} }
extern char mdpause;
void displayrest(long smoothratio) void displayrest(long smoothratio)
{ {
long a, i, j; long a, i, j;
@ -3412,7 +3410,12 @@ void displayrest(long smoothratio)
if (ud.coords) if (ud.coords)
coords(screenpeek); coords(screenpeek);
#if defined(POLYMOST) && defined(USE_OPENGL)
{
extern char mdpause;
mdpause = ud.pause_on; mdpause = ud.pause_on;
}
#endif
tics(); tics();

View file

@ -330,7 +330,7 @@ int MUSIC_GetContext
void void
) )
{} { return 0; }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
@ -490,3 +490,5 @@ void MUSIC_RegisterTimbreBank
void MUSIC_Update(void) void MUSIC_Update(void)
{} {}
void PlayMusic(char *_filename)
{}

View file

@ -38,9 +38,9 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#ifdef _WIN32 #ifdef _WIN32
#include "dsoundout.h" #include "dsoundout.h"
#else #else
#include "compat.h"
#include "dsl.h" #include "dsl.h"
#endif #endif
#include "compat.h"
#include "baselayer.h" #include "baselayer.h"
#include "usrhooks.h" #include "usrhooks.h"
#include "linklist.h" #include "linklist.h"
@ -48,11 +48,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include "multivoc.h" #include "multivoc.h"
#include "_multivc.h" #include "_multivc.h"
#ifdef __MINGW32__
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#endif
#define STEREO 1 #define STEREO 1
#define SIXTEEN_BIT 2 #define SIXTEEN_BIT 2
@ -61,13 +56,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#define MONO_16BIT ( SIXTEEN_BIT ) #define MONO_16BIT ( SIXTEEN_BIT )
#define STEREO_16BIT ( STEREO | SIXTEEN_BIT ) #define STEREO_16BIT ( STEREO | SIXTEEN_BIT )
#define RoundFixed( fixedval, bits ) \
( \
( \
(fixedval) + ( 1 << ( (bits) - 1 ) )\
) >> (bits) \
)
#define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] ) #define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] )
static int MV_ReverbLevel; static int MV_ReverbLevel;
@ -146,7 +134,6 @@ int MV_ErrorCode = MV_Ok;
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
char *MV_ErrorString(int ErrorNumber) char *MV_ErrorString(int ErrorNumber)
{ {
char *ErrorString; char *ErrorString;
@ -264,9 +251,7 @@ static unsigned MV_GetBufferSize(unsigned samplerate)
Mixes the sound into the buffer. Mixes the sound into the buffer.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
static void MV_Mix( VoiceNode *voice, static void MV_Mix(VoiceNode *voice, int buffer)
int buffer)
{ {
char *start; char *start;
int length; int length;
@ -355,7 +340,6 @@ static void MV_Mix( VoiceNode *voice,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_PlayVoice(VoiceNode *voice) void MV_PlayVoice(VoiceNode *voice)
{ {
unsigned flags; unsigned flags;
@ -373,7 +357,6 @@ void MV_PlayVoice( VoiceNode *voice)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_StopVoice(VoiceNode *voice) void MV_StopVoice(VoiceNode *voice)
{ {
unsigned flags; unsigned flags;
@ -396,7 +379,6 @@ void MV_StopVoice( VoiceNode *voice)
// static int backcolor = 1; // static int backcolor = 1;
int MV_ServiceVoc(int buffer) int MV_ServiceVoc(int buffer)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *next; VoiceNode *next;
@ -518,7 +500,6 @@ int MV_ServiceVoc( int buffer)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextVOCBlock(VoiceNode *voice) playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
{ {
unsigned char *ptr; unsigned char *ptr;
int blocktype; int blocktype;
@ -547,8 +528,7 @@ playbackstatus MV_GetNextVOCBlock( VoiceNode *voice)
return(KeepPlaying); return(KeepPlaying);
} }
if ((voice->length > 0) && (voice->LoopEnd != NULL) && if ((voice->length > 0) && (voice->LoopEnd != NULL) && (voice->LoopStart != NULL))
(voice->LoopStart != NULL))
{ {
voice->BlockLength = voice->LoopSize; voice->BlockLength = voice->LoopSize;
voice->sound = voice->LoopStart; voice->sound = voice->LoopStart;
@ -703,16 +683,14 @@ playbackstatus MV_GetNextVOCBlock( VoiceNode *voice)
Channels = (unsigned)*(ptr + 5); Channels = (unsigned)*(ptr + 5);
Format = (unsigned)*(unsigned short *)(ptr + 6); Format = (unsigned)*(unsigned short *)(ptr + 6);
if ((BitsPerSample == 8) && (Channels == 1) && if ((BitsPerSample == 8) && (Channels == 1) && (Format == VOC_8BIT))
(Format == VOC_8BIT))
{ {
ptr += 12; ptr += 12;
blocklength -= 12; blocklength -= 12;
voice->bits = 8; voice->bits = 8;
done = TRUE; done = TRUE;
} }
else if ((BitsPerSample == 16) && (Channels == 1) && else if ((BitsPerSample == 16) && (Channels == 1) && (Format == VOC_16BIT))
(Format == VOC_16BIT))
{ {
ptr += 12; ptr += 12;
blocklength -= 12; blocklength -= 12;
@ -789,7 +767,6 @@ playbackstatus MV_GetNextVOCBlock( VoiceNode *voice)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice) playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice)
{ {
if (voice->BlockLength > 0) if (voice->BlockLength > 0)
{ {
@ -828,7 +805,6 @@ playbackstatus MV_GetNextDemandFeedBlock( VoiceNode *voice)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextRawBlock(VoiceNode *voice) playbackstatus MV_GetNextRawBlock(VoiceNode *voice)
{ {
if (voice->BlockLength <= 0) if (voice->BlockLength <= 0)
{ {
@ -866,7 +842,6 @@ playbackstatus MV_GetNextRawBlock( VoiceNode *voice)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
playbackstatus MV_GetNextWAVBlock(VoiceNode *voice) playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
{ {
if (voice->BlockLength <= 0) if (voice->BlockLength <= 0)
{ {
@ -904,12 +879,10 @@ playbackstatus MV_GetNextWAVBlock( VoiceNode *voice)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
#if 0 #if 0
static void MV_ServiceRecord(void) static void MV_ServiceRecord(void)
{ {
if (MV_RecordFunc) if (MV_RecordFunc)
{ {
MV_RecordFunc(MV_MixBuffer[ 0 ] + MV_MixPage * MixBufferSize, MV_RecordFunc(MV_MixBuffer[ 0 ] + MV_MixPage * MixBufferSize, MixBufferSize);
MixBufferSize);
} }
// Toggle which buffer we'll mix next // Toggle which buffer we'll mix next
@ -928,7 +901,6 @@ static void MV_ServiceRecord( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
VoiceNode *MV_GetVoice(int handle) VoiceNode *MV_GetVoice(int handle)
{ {
VoiceNode *voice; VoiceNode *voice;
unsigned flags; unsigned flags;
@ -963,7 +935,6 @@ VoiceNode *MV_GetVoice( int handle)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_VoicePlaying(int handle) int MV_VoicePlaying(int handle)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -991,7 +962,6 @@ int MV_VoicePlaying( int handle)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_KillAllVoices(void) int MV_KillAllVoices(void)
{ {
if (!MV_Installed) if (!MV_Installed)
{ {
@ -1016,7 +986,6 @@ int MV_KillAllVoices( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_Kill(int handle) int MV_Kill(int handle)
{ {
VoiceNode *voice; VoiceNode *voice;
unsigned flags; unsigned flags;
@ -1060,7 +1029,6 @@ int MV_Kill( int handle)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_VoicesPlaying(void) int MV_VoicesPlaying(void)
{ {
VoiceNode *voice; VoiceNode *voice;
int NumVoices = 0; int NumVoices = 0;
@ -1092,7 +1060,6 @@ int MV_VoicesPlaying( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
VoiceNode *MV_AllocVoice(int priority) VoiceNode *MV_AllocVoice(int priority)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *node; VoiceNode *node;
@ -1161,7 +1128,6 @@ VoiceNode *MV_AllocVoice( int priority)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_VoiceAvailable(int priority) int MV_VoiceAvailable(int priority)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *node; VoiceNode *node;
@ -1202,10 +1168,7 @@ int MV_VoiceAvailable( int priority)
Sets the pitch for the specified voice. Sets the pitch for the specified voice.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVoicePitch( VoiceNode *voice, void MV_SetVoicePitch(VoiceNode *voice, unsigned long rate, int pitchoffset)
unsigned long rate,
int pitchoffset)
{ {
voice->SamplingRate = rate; voice->SamplingRate = rate;
voice->PitchScale = PITCH_GetScale(pitchoffset); voice->PitchScale = PITCH_GetScale(pitchoffset);
@ -1223,9 +1186,7 @@ void MV_SetVoicePitch( VoiceNode *voice,
Sets the pitch for the voice associated with the specified handle. Sets the pitch for the voice associated with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_SetPitch( int handle, int MV_SetPitch(int handle, int pitchoffset)
int pitchoffset)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1254,9 +1215,7 @@ int MV_SetPitch( int handle,
Sets the frequency for the voice associated with the specified handle. Sets the frequency for the voice associated with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_SetFrequency( int handle, int MV_SetFrequency(int handle, int frequency)
int frequency)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1287,7 +1246,6 @@ int MV_SetFrequency( int handle,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
static short *MV_GetVolumeTable(int vol) static short *MV_GetVolumeTable(int vol)
{ {
int volume; int volume;
short *table; short *table;
@ -1307,7 +1265,6 @@ static short *MV_GetVolumeTable( int vol)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
static void MV_SetVoiceMixMode(VoiceNode *voice) static void MV_SetVoiceMixMode(VoiceNode *voice)
{ {
unsigned flags; unsigned flags;
int test; int test;
@ -1429,11 +1386,7 @@ static void MV_SetVoiceMixMode( VoiceNode *voice)
with the specified handle. with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVoiceVolume( VoiceNode *voice, void MV_SetVoiceVolume(VoiceNode *voice, int vol, int left, int right)
int vol,
int left,
int right)
{ {
if (MV_Channels == 1) if (MV_Channels == 1)
{ {
@ -1465,7 +1418,6 @@ void MV_SetVoiceVolume( VoiceNode *voice,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_EndLooping(int handle) int MV_EndLooping(int handle)
{ {
VoiceNode *voice; VoiceNode *voice;
unsigned flags; unsigned flags;
@ -1503,11 +1455,7 @@ int MV_EndLooping( int handle)
with the specified handle. with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_SetPan( int handle, int MV_SetPan(int handle, int vol, int left, int right)
int vol,
int left,
int right)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1537,10 +1485,7 @@ int MV_SetPan( int handle,
with the specified handle. with the specified handle.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_Pan3D( int handle, int MV_Pan3D(int handle, int angle, int distance)
int angle,
int distance)
{ {
int left; int left;
int right; int right;
@ -1576,7 +1521,6 @@ int MV_Pan3D( int handle,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverb(int reverb) void MV_SetReverb(int reverb)
{ {
MV_ReverbLevel = MIX_VOLUME(reverb); MV_ReverbLevel = MIX_VOLUME(reverb);
MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ]; MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ];
@ -1590,7 +1534,6 @@ void MV_SetReverb( int reverb)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetFastReverb(int reverb) void MV_SetFastReverb(int reverb)
{ {
MV_ReverbLevel = max(0, min(16, reverb)); MV_ReverbLevel = max(0, min(16, reverb));
MV_ReverbTable = NULL; MV_ReverbTable = NULL;
@ -1604,7 +1547,6 @@ void MV_SetFastReverb( int reverb)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_GetMaxReverbDelay(void) int MV_GetMaxReverbDelay(void)
{ {
int maxdelay; int maxdelay;
@ -1621,7 +1563,6 @@ int MV_GetMaxReverbDelay( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_GetReverbDelay(void) int MV_GetReverbDelay(void)
{ {
return MV_ReverbDelay / MV_SampleSize; return MV_ReverbDelay / MV_SampleSize;
} }
@ -1634,7 +1575,6 @@ int MV_GetReverbDelay( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverbDelay(int delay) void MV_SetReverbDelay(int delay)
{ {
int maxdelay; int maxdelay;
@ -1650,9 +1590,7 @@ void MV_SetReverbDelay( int delay)
Prepares Multivoc to play stereo of mono digitized sounds. Prepares Multivoc to play stereo of mono digitized sounds.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_SetMixMode( int numchannels, int MV_SetMixMode(int numchannels, int samplebits)
int samplebits)
{ {
int mode; int mode;
@ -1721,7 +1659,6 @@ int MV_SetMixMode( int numchannels,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_StartPlayback(void) int MV_StartPlayback(void)
{ {
int status; int status;
int buffer; int buffer;
@ -1749,9 +1686,7 @@ int MV_StartPlayback( void)
return(MV_Error); return(MV_Error);
} }
#else #else
status = DSL_BeginBufferedPlayback(MV_MixBuffer[ 0 ], status = DSL_BeginBufferedPlayback(MV_MixBuffer[ 0 ], TotalBufferSize, MV_NumberOfBuffers, MV_RequestedMixRate, MV_MixMode, (void *)MV_ServiceVoc);
TotalBufferSize, MV_NumberOfBuffers,
MV_RequestedMixRate, MV_MixMode, (void *)MV_ServiceVoc);
if (status != DSL_Ok) if (status != DSL_Ok)
{ {
@ -1772,7 +1707,6 @@ int MV_StartPlayback( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_StopPlayback(void) void MV_StopPlayback(void)
{ {
VoiceNode *voice; VoiceNode *voice;
VoiceNode *next; VoiceNode *next;
@ -1811,9 +1745,7 @@ void MV_StopPlayback( void)
Starts the sound recording engine. Starts the sound recording engine.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_StartRecording( int MixRate, int MV_StartRecording(int MixRate, void(*function)(char *ptr, int length))
void(*function)(char *ptr, int length))
{ {
int status; int status;
@ -1848,9 +1780,7 @@ int MV_StartRecording( int MixRate,
switch (MV_SoundCard) switch (MV_SoundCard)
{ {
case SoundBlaster : case SoundBlaster :
status = BLASTER_BeginBufferedRecord(MV_MixBuffer[ 0 ], status = BLASTER_BeginBufferedRecord(MV_MixBuffer[ 0 ], TotalBufferSize, NumberOfBuffers, MixRate, MONO_8BIT, MV_ServiceRecord);
TotalBufferSize, NumberOfBuffers, MixRate, MONO_8BIT,
MV_ServiceRecord);
if (status != BLASTER_Ok) if (status != BLASTER_Ok)
{ {
@ -1873,7 +1803,6 @@ int MV_StartRecording( int MixRate,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_StopRecord(void) void MV_StopRecord(void)
{ {
// Stop sound playback // Stop sound playback
switch (MV_SoundCard) switch (MV_SoundCard)
@ -1895,15 +1824,7 @@ void MV_StopRecord( void)
Plays a digitized sound from a user controlled buffering system. Plays a digitized sound from a user controlled buffering system.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_StartDemandFeedPlayback( void(*function)(char **ptr, unsigned long *length), int MV_StartDemandFeedPlayback(void(*function)(char **ptr, unsigned long *length), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
int rate,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -1954,21 +1875,11 @@ int MV_StartDemandFeedPlayback( void(*function)(char **ptr, unsigned long *le
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayRaw( char *ptr, int MV_PlayRaw(char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
unsigned long length,
unsigned rate,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
int status; int status;
status = MV_PlayLoopedRaw(ptr, length, NULL, NULL, rate, pitchoffset, status = MV_PlayLoopedRaw(ptr, length, NULL, NULL, rate, pitchoffset, vol, left, right, priority, callbackval);
vol, left, right, priority, callbackval);
return(status); return(status);
} }
@ -1981,18 +1892,7 @@ int MV_PlayRaw( char *ptr,
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayLoopedRaw( char *ptr, int MV_PlayLoopedRaw(char *ptr, long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
long length,
char *loopstart,
char *loopend,
unsigned rate,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
VoiceNode *voice; VoiceNode *voice;
@ -2041,19 +1941,11 @@ int MV_PlayLoopedRaw( char *ptr,
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayWAV( char *ptr, int MV_PlayWAV(char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
int status; int status;
status = MV_PlayLoopedWAV(ptr, -1, -1, pitchoffset, vol, left, right, status = MV_PlayLoopedWAV(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
priority, callbackval);
return(status); return(status);
} }
@ -2066,13 +1958,7 @@ int MV_PlayWAV( char *ptr,
from listener. from listener.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayWAV3D( char *ptr, int MV_PlayWAV3D(char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval)
int pitchoffset,
int angle,
int distance,
int priority,
unsigned long callbackval)
{ {
int left; int left;
int right; int right;
@ -2101,8 +1987,7 @@ int MV_PlayWAV3D( char *ptr,
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max(0, 255 - distance); mid = max(0, 255 - distance);
status = MV_PlayWAV(ptr, pitchoffset, mid, left, right, priority, status = MV_PlayWAV(ptr, pitchoffset, mid, left, right, priority, callbackval);
callbackval);
return(status); return(status);
} }
@ -2115,16 +2000,7 @@ int MV_PlayWAV3D( char *ptr,
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayLoopedWAV( char *ptr, int MV_PlayLoopedWAV(char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
long loopstart,
long loopend,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
riff_header *riff; riff_header *riff;
format_header *format; format_header *format;
@ -2142,9 +2018,7 @@ int MV_PlayLoopedWAV( char *ptr,
riff = (riff_header *)ptr; riff = (riff_header *)ptr;
if ((strncmp(riff->RIFF, "RIFF", 4) != 0) || if ((strncmp(riff->RIFF, "RIFF", 4) != 0) || (strncmp(riff->WAVE, "WAVE", 4) != 0) || (strncmp(riff->fmt, "fmt ", 4) != 0))
(strncmp(riff->WAVE, "WAVE", 4) != 0) ||
(strncmp(riff->fmt, "fmt ", 4) != 0))
{ {
MV_SetErrorCode(MV_InvalidWAVFile); MV_SetErrorCode(MV_InvalidWAVFile);
return(MV_Error); return(MV_Error);
@ -2166,8 +2040,7 @@ int MV_PlayLoopedWAV( char *ptr,
return(MV_Error); return(MV_Error);
} }
if ((format->nBitsPerSample != 8) && if ((format->nBitsPerSample != 8) && (format->nBitsPerSample != 16))
(format->nBitsPerSample != 16))
{ {
MV_SetErrorCode(MV_InvalidWAVFile); MV_SetErrorCode(MV_InvalidWAVFile);
return(MV_Error); return(MV_Error);
@ -2243,13 +2116,7 @@ int MV_PlayLoopedWAV( char *ptr,
from listener. from listener.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayVOC3D( char *ptr, int MV_PlayVOC3D(char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval)
int pitchoffset,
int angle,
int distance,
int priority,
unsigned long callbackval)
{ {
int left; int left;
int right; int right;
@ -2278,8 +2145,7 @@ int MV_PlayVOC3D( char *ptr,
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max(0, 255 - distance); mid = max(0, 255 - distance);
status = MV_PlayVOC(ptr, pitchoffset, mid, left, right, priority, status = MV_PlayVOC(ptr, pitchoffset, mid, left, right, priority, callbackval);
callbackval);
return(status); return(status);
} }
@ -2292,19 +2158,11 @@ int MV_PlayVOC3D( char *ptr,
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayVOC( char *ptr, int MV_PlayVOC(char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
int status; int status;
status = MV_PlayLoopedVOC(ptr, -1, -1, pitchoffset, vol, left, right, status = MV_PlayLoopedVOC(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
priority, callbackval);
return(status); return(status);
} }
@ -2317,16 +2175,7 @@ int MV_PlayVOC( char *ptr,
priority. priority.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_PlayLoopedVOC( char *ptr, int MV_PlayLoopedVOC(char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval)
long loopstart,
long loopend,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned long callbackval)
{ {
VoiceNode *voice; VoiceNode *voice;
int status; int status;
@ -2391,10 +2240,7 @@ int MV_PlayLoopedVOC( char *ptr,
level. level.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CreateVolumeTable( int index, void MV_CreateVolumeTable(int index, int volume, int MaxVolume)
int volume,
int MaxVolume)
{ {
int val; int val;
int level; int level;
@ -2432,7 +2278,6 @@ void MV_CreateVolumeTable( int index,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CalcVolume(int MaxVolume) void MV_CalcVolume(int MaxVolume)
{ {
int volume; int volume;
@ -2463,7 +2308,6 @@ void MV_CalcVolume( int MaxVolume)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_CalcPanTable(void) void MV_CalcPanTable(void)
{ {
int level; int level;
int angle; int angle;
@ -2502,7 +2346,6 @@ void MV_CalcPanTable( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetVolume(int volume) void MV_SetVolume(int volume)
{ {
volume = max(0, volume); volume = max(0, volume);
volume = min(volume, MV_MaxTotalVolume); volume = min(volume, MV_MaxTotalVolume);
@ -2521,7 +2364,6 @@ void MV_SetVolume( int volume)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_GetVolume(void) int MV_GetVolume(void)
{ {
return(MV_TotalVolume); return(MV_TotalVolume);
} }
@ -2534,7 +2376,6 @@ int MV_GetVolume( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetCallBack(void(*function)(unsigned long)) void MV_SetCallBack(void(*function)(unsigned long))
{ {
MV_CallBackFunc = function; MV_CallBackFunc = function;
} }
@ -2547,7 +2388,6 @@ void MV_SetCallBack( void(*function)(unsigned long))
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MV_SetReverseStereo(int setting) void MV_SetReverseStereo(int setting)
{ {
MV_SwapLeftRight = setting; MV_SwapLeftRight = setting;
} }
@ -2560,7 +2400,6 @@ void MV_SetReverseStereo( int setting)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_GetReverseStereo(void) int MV_GetReverseStereo(void)
{ {
return(MV_SwapLeftRight); return(MV_SwapLeftRight);
} }
@ -2573,7 +2412,6 @@ int MV_GetReverseStereo( void)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_TestPlayback(void) int MV_TestPlayback(void)
{ {
unsigned flags; unsigned flags;
long time; long time;
@ -2644,12 +2482,7 @@ int MV_TestPlayback( void)
Multivoc. Multivoc.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_Init( int soundcard, int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int samplebits)
int MixRate,
int Voices,
int numchannels,
int samplebits)
{ {
char *ptr; char *ptr;
int status; int status;
@ -2695,7 +2528,7 @@ int MV_Init( int soundcard,
initprintf(" - Using %d byte mixing buffers\n", MixBufferSize); initprintf(" - Using %d byte mixing buffers\n", MixBufferSize);
// Allocate mix buffer within 1st megabyte // Allocate mix buffer within 1st megabyte
ptr = (char *)malloc(TotalBufferSize + 4); // FIXME: temporarily fixes bounds error somewhere... ptr = (char *)malloc(TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere...
if (!ptr) if (!ptr)
{ {
USRHOOKS_FreeMem(MV_Voices); USRHOOKS_FreeMem(MV_Voices);
@ -2712,8 +2545,7 @@ int MV_Init( int soundcard,
// Initialize the sound card // Initialize the sound card
#if defined(_WIN32) #if defined(_WIN32)
status = DSOUND_Init(soundcard, MixRate, numchannels, samplebits, status = DSOUND_Init(soundcard, MixRate, numchannels, samplebits, TotalBufferSize);
TotalBufferSize);
if (status != DSOUND_Ok) if (status != DSOUND_Ok)
{ {
MV_SetErrorCode(MV_BlasterError); MV_SetErrorCode(MV_BlasterError);
@ -2785,7 +2617,6 @@ int MV_Init( int soundcard,
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MV_Shutdown(void) int MV_Shutdown(void)
{ {
int buffer; int buffer;
unsigned flags; unsigned flags;

View file

@ -227,6 +227,7 @@ void playmusic(char *fn)
MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong); MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong);
#else #else
void PlayMusic(char *_filename); void PlayMusic(char *_filename);
if(MusicToggle == 0) return; if(MusicToggle == 0) return;
if(MusicDevice < 0) return; if(MusicDevice < 0) return;