From e59f61bae7aacb547d84d4f6c7357479bca1006f Mon Sep 17 00:00:00 2001 From: viti95 Date: Wed, 8 Jan 2025 17:28:13 +0100 Subject: [PATCH] FastDoom only supports 8-bit audio modes --- FASTDOOM/dmx.c | 2 +- FASTDOOM/ns_fxm.c | 3 +-- FASTDOOM/ns_fxm.h | 2 +- FASTDOOM/ns_multi.c | 30 ++++-------------------------- FASTDOOM/ns_multi.h | 5 ++--- FASTDOOM/ns_pas16.c | 26 +++----------------------- 6 files changed, 12 insertions(+), 56 deletions(-) diff --git a/FASTDOOM/dmx.c b/FASTDOOM/dmx.c index b9353746..e8517aea 100644 --- a/FASTDOOM/dmx.c +++ b/FASTDOOM/dmx.c @@ -664,7 +664,7 @@ void ASS_Init(int rate, int mdev, int sdev) if (mdev = snd_WAV) finalNumChannels += 1; // Extra sound channel for PCM music - status = FX_Init(sound_device, finalNumChannels, 2, 8, sample_rate); + status = FX_Init(sound_device, finalNumChannels, 2, sample_rate); if (status != FX_Ok) { diff --git a/FASTDOOM/ns_fxm.c b/FASTDOOM/ns_fxm.c index 1fadf027..58e70784 100644 --- a/FASTDOOM/ns_fxm.c +++ b/FASTDOOM/ns_fxm.c @@ -270,7 +270,6 @@ int FX_Init( int SoundCard, int numvoices, int numchannels, - int samplebits, unsigned int mixrate) { @@ -304,7 +303,7 @@ int FX_Init( case OPL2LPT: case OPL3LPT: case SoundBlasterDirect: - devicestatus = MV_Init(SoundCard, FX_MixRate, numvoices, numchannels, samplebits); + devicestatus = MV_Init(SoundCard, FX_MixRate, numvoices, numchannels); if (devicestatus != MV_Ok && !ignoreSoundChecks) { status = FX_Error; diff --git a/FASTDOOM/ns_fxm.h b/FASTDOOM/ns_fxm.h index 46fcb7b4..378501c9 100644 --- a/FASTDOOM/ns_fxm.h +++ b/FASTDOOM/ns_fxm.h @@ -51,7 +51,7 @@ extern unsigned int FX_MixRate; int FX_SetupCard(int SoundCard, fx_device *device, int port); int FX_GetBlasterSettings(fx_blaster_config *blaster); int FX_SetupSoundBlaster(fx_blaster_config blaster); -int FX_Init(int SoundCard, int numvoices, int numchannels, int samplebits, unsigned int mixrate); +int FX_Init(int SoundCard, int numvoices, int numchannels, unsigned int mixrate); int FX_Shutdown(void); void FX_SetVolume(int volume); diff --git a/FASTDOOM/ns_multi.c b/FASTDOOM/ns_multi.c index 455b8b7d..30e01a4b 100644 --- a/FASTDOOM/ns_multi.c +++ b/FASTDOOM/ns_multi.c @@ -661,10 +661,7 @@ void MV_SetVoiceVolume( Prepares Multivoc to play stereo of mono digitized sounds. ---------------------------------------------------------------------*/ -int MV_SetMixMode( - int numchannels, - int samplebits) - +int MV_SetMixMode(int numchannels) { int mode; @@ -673,10 +670,6 @@ int MV_SetMixMode( { mode |= STEREO; } - if (samplebits == 16) - { - mode |= SIXTEEN_BIT; - } switch (MV_SoundCard) { @@ -722,24 +715,11 @@ int MV_SetMixMode( } MV_Bits = 8; - if (MV_MixMode & SIXTEEN_BIT) - { - MV_Bits = 16; - } MV_BuffShift = 7 + MV_Channels; MV_SampleSize = sizeof(MONO8) * MV_Channels; - if (MV_Bits == 8) - { - MV_Silence = SILENCE_8BIT; - } - else - { - MV_Silence = SILENCE_16BIT; - MV_BuffShift += 1; - MV_SampleSize *= 2; - } + MV_Silence = SILENCE_8BIT; MV_BufferSize = MixBufferSize * MV_SampleSize; MV_NumberOfBuffers = TotalBufferSize / MV_BufferSize; @@ -1207,9 +1187,7 @@ int MV_Init( int soundcard, int MixRate, int Voices, - int numchannels, - int samplebits) - + int numchannels) { char *ptr; int status; @@ -1334,7 +1312,7 @@ int MV_Init( MV_RequestedMixRate = MixRate; // Set Mixer to play stereo digitized sound - MV_SetMixMode(numchannels, samplebits); + MV_SetMixMode(numchannels); // Make sure we don't cross a physical page if (((unsigned long)ptr & 0xffff) + TotalBufferSize > 0x10000) diff --git a/FASTDOOM/ns_multi.h b/FASTDOOM/ns_multi.h index 4761a48f..f0df96f6 100644 --- a/FASTDOOM/ns_multi.h +++ b/FASTDOOM/ns_multi.h @@ -33,7 +33,7 @@ enum MV_Errors int MV_VoicePlaying(int handle); int MV_KillAllVoices(void); int MV_Kill(int handle); -int MV_SetMixMode(int numchannels, int samplebits); +int MV_SetMixMode(int numchannels); int MV_StartPlayback(void); void MV_StopPlayback(void); int MV_PlayRaw(unsigned char *ptr, unsigned long length, @@ -43,8 +43,7 @@ void MV_CreateVolumeTable(int index, int volume, int MaxVolume); void MV_SetVolume(int volume); void MV_SetReverseStereo(int setting); void MV_ReverseStereo(void); -int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, - int samplebits); +int MV_Init(int soundcard, int MixRate, int Voices, int numchannels); int MV_Shutdown(void); #endif diff --git a/FASTDOOM/ns_pas16.c b/FASTDOOM/ns_pas16.c index 4fe21633..26b79da6 100644 --- a/FASTDOOM/ns_pas16.c +++ b/FASTDOOM/ns_pas16.c @@ -492,9 +492,7 @@ void PAS_SetSampleBufferCount( hertz. ---------------------------------------------------------------------*/ -void PAS_SetPlaybackRate( - unsigned rate) - +void PAS_SetPlaybackRate(unsigned rate) { if (rate < PAS_MinSamplingRate) { @@ -539,19 +537,10 @@ unsigned PAS_GetPlaybackRate( Sets the sound card to play samples in mono or stereo. ---------------------------------------------------------------------*/ -int PAS_SetMixMode( - int mode) - +int PAS_SetMixMode(int mode) { mode &= PAS_MaxMixMode; - // Check board revision. Revision # 0 can't play 16-bit data. - if ((PAS_State->intrctlr & 0xe0) == 0) - { - // Force the mode to 8-bit data. - mode &= ~SIXTEEN_BIT; - } - PAS_MixMode = mode; PAS_SetPlaybackRate(PAS_SampleRate); @@ -966,16 +955,7 @@ int PAS_GetCardInfo( } *MaxChannels = 2; - - // Check board revision. Revision # 0 can't play 16-bit data. - if ((PAS_State->intrctlr & 0xe0) == 0) - { - *MaxSampleBits = 8; - } - else - { - *MaxSampleBits = 16; - } + *MaxSampleBits = 8; return (PAS_Ok); }