Files
86Box/src/sound_speaker.c
OBattler f6ef1f833c Vastly overhauled the UI, there's now a completely new Settings dialog as well as a status bar with disk activity icons and removable drive menus;
Thoroughly clean up the code to vastly reduce the number of compiler warnings and found and fixed several bugs in the process;
Applied all mainline PCem commits;
Added SCSI hard disk emulation;
Commented out all unfinished machines and graphics cards;
Added the AOpen AP53 and ASUS P/I-P55T2 machines as well as another Tyan 440FX machine, all three with AMI WinBIOS (patch from TheCollector1995);
Added the Diamond Stealth 3D 3000 (S3 ViRGE/VX) graphics card (patch from TheCollector1995);
Added the PS/2 XT IDE (AccuLogic) HDD Controller (patch from TheCollector1995);
Added Microsoft/Logitech Bus Mouse emulation (patch from waltje);
Overhauled the makefiles (patch from waltje);
Added the Adaptec AHA-1542CF SCSI controller (patch from waltje);
Added preliminary (but still unfinished) Adaptec AHA-154x SCSI controller BIOS support (patch from waltje);
Added an ISABugger debugging device (patch from waltje);
Added sanity checks to the Direct3D code.
2017-05-05 01:49:42 +02:00

59 lines
1.3 KiB
C

#include "ibm.h"
#include "sound.h"
#include "sound_speaker.h"
int speaker_mute = 0;
static int16_t speaker_buffer[SOUNDBUFLEN];
static int speaker_pos = 0;
int speaker_gated = 0;
int speaker_enable = 0, was_speaker_enable = 0;
void speaker_update()
{
int16_t val;
for (; speaker_pos < sound_pos_global; speaker_pos++)
{
if (speaker_gated && was_speaker_enable)
{
if (!pit.m[2] || pit.m[2]==4)
val = speakval;
else if (pit.l[2] < 0x40)
val = 0xa00;
else
val = speakon ? 0x1400 : 0;
}
else
val = was_speaker_enable ? 0x1400 : 0;
if (!speaker_enable)
was_speaker_enable = 0;
speaker_buffer[speaker_pos] = val;
}
}
static void speaker_get_buffer(int32_t *buffer, int len, void *p)
{
int c;
speaker_update();
if (!speaker_mute)
{
for (c = 0; c < len * 2; c++)
buffer[c] += speaker_buffer[c >> 1];
}
speaker_pos = 0;
}
void speaker_init()
{
sound_add_handler(speaker_get_buffer, NULL);
speaker_mute = 0;
}