Skip to content

Commit

Permalink
FastDoom only supports 8-bit audio modes
Browse files Browse the repository at this point in the history
  • Loading branch information
viti95 committed Jan 8, 2025
1 parent 0fc3661 commit e59f61b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 56 deletions.
2 changes: 1 addition & 1 deletion FASTDOOM/dmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 1 addition & 2 deletions FASTDOOM/ns_fxm.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ int FX_Init(
int SoundCard,
int numvoices,
int numchannels,
int samplebits,
unsigned int mixrate)

{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion FASTDOOM/ns_fxm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
30 changes: 4 additions & 26 deletions FASTDOOM/ns_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -673,10 +670,6 @@ int MV_SetMixMode(
{
mode |= STEREO;
}
if (samplebits == 16)
{
mode |= SIXTEEN_BIT;
}

switch (MV_SoundCard)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1207,9 +1187,7 @@ int MV_Init(
int soundcard,
int MixRate,
int Voices,
int numchannels,
int samplebits)

int numchannels)
{
char *ptr;
int status;
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions FASTDOOM/ns_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
26 changes: 3 additions & 23 deletions FASTDOOM/ns_pas16.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,7 @@ void PAS_SetSampleBufferCount(
hertz.
---------------------------------------------------------------------*/

void PAS_SetPlaybackRate(
unsigned rate)

void PAS_SetPlaybackRate(unsigned rate)
{
if (rate < PAS_MinSamplingRate)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit e59f61b

Please sign in to comment.