2017-05-30 03:38:38 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Sound emulation core.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2017-06-05 01:20:51 -04:00
|
|
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
2017-05-30 03:38:38 +02:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2017-10-11 05:40:44 -04:00
|
|
|
*
|
2020-01-19 05:45:05 +01:00
|
|
|
* Copyright 2008-2020 Sarah Walker.
|
|
|
|
|
* Copyright 2016-2020 Miran Grca.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2020-10-19 01:02:40 +02:00
|
|
|
#include <math.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdint.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <stdio.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <string.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdlib.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <wchar.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/cdrom.h>
|
|
|
|
|
#include <86box/hdc_ide.h>
|
|
|
|
|
#include <86box/plat.h>
|
2020-05-19 21:15:25 -03:00
|
|
|
#include <86box/machine.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/sound.h>
|
|
|
|
|
#include <86box/midi.h>
|
|
|
|
|
#include <86box/snd_opl.h>
|
|
|
|
|
#include <86box/snd_mpu401.h>
|
|
|
|
|
#include <86box/snd_sb_dsp.h>
|
|
|
|
|
#include <86box/snd_azt2316a.h>
|
|
|
|
|
#include <86box/filters.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
|
|
|
|
|
|
2017-11-05 01:57:04 -05:00
|
|
|
typedef struct {
|
2018-02-18 10:32:51 +01:00
|
|
|
const char *internal_name;
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t *device;
|
2016-06-26 00:34:39 +02:00
|
|
|
} SOUND_CARD;
|
|
|
|
|
|
2018-02-15 23:14:44 +01:00
|
|
|
typedef struct {
|
|
|
|
|
void (*get_buffer)(int32_t *buffer, int len, void *p);
|
|
|
|
|
void *priv;
|
|
|
|
|
} sound_handler_t;
|
|
|
|
|
|
2017-11-05 01:57:04 -05:00
|
|
|
|
|
|
|
|
int sound_card_current = 0;
|
|
|
|
|
int sound_pos_global = 0;
|
2018-02-11 20:51:42 +01:00
|
|
|
int sound_gain = 0;
|
2017-11-05 01:57:04 -05:00
|
|
|
|
|
|
|
|
|
2018-02-15 23:14:44 +01:00
|
|
|
static sound_handler_t sound_handlers[8];
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
static thread_t *sound_cd_thread_h;
|
|
|
|
|
static event_t *sound_cd_event;
|
|
|
|
|
static event_t *sound_cd_start_event;
|
|
|
|
|
static int32_t *outbuffer;
|
|
|
|
|
static float *outbuffer_ex;
|
|
|
|
|
static int16_t *outbuffer_ex_int16;
|
2017-11-05 01:57:04 -05:00
|
|
|
static int sound_handlers_num;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
static pc_timer_t sound_poll_timer;
|
|
|
|
|
static uint64_t sound_poll_latch;
|
2018-10-26 04:05:29 +02:00
|
|
|
|
2017-11-05 01:57:04 -05:00
|
|
|
static int16_t cd_buffer[CDROM_NUM][CD_BUFLEN * 2];
|
|
|
|
|
static float cd_out_buffer[CD_BUFLEN * 2];
|
|
|
|
|
static int16_t cd_out_buffer_int16[CD_BUFLEN * 2];
|
|
|
|
|
static unsigned int cd_vol_l, cd_vol_r;
|
|
|
|
|
static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
|
2017-12-05 20:19:19 +01:00
|
|
|
static volatile int cdaudioon = 0;
|
2018-10-26 04:05:29 +02:00
|
|
|
static int cd_thread_enable = 0;
|
2017-11-05 01:57:04 -05:00
|
|
|
|
2020-10-21 02:46:50 +02:00
|
|
|
static void (*filter_cd_audio)(int channel, double *buffer, void *p) = NULL;
|
2020-10-19 01:02:40 +02:00
|
|
|
static void *filter_cd_audio_p = NULL;
|
|
|
|
|
|
2017-11-05 01:57:04 -05:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
static const SOUND_CARD sound_cards[] =
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2020-11-16 00:01:21 +01:00
|
|
|
{ "none", NULL },
|
|
|
|
|
{ "internal", NULL },
|
|
|
|
|
{ "adlib", &adlib_device },
|
|
|
|
|
{ "adlibgold", &adgold_device },
|
|
|
|
|
{ "azt2316a", &azt2316a_device },
|
|
|
|
|
{ "azt1605", &azt1605_device },
|
2021-05-22 22:29:25 -03:00
|
|
|
{ "cs4236b", &cs4236b_device },
|
2020-11-16 00:01:21 +01:00
|
|
|
{ "sb", &sb_1_device },
|
|
|
|
|
{ "sb1.5", &sb_15_device },
|
|
|
|
|
{ "sb2.0", &sb_2_device },
|
|
|
|
|
{ "sbprov1", &sb_pro_v1_device },
|
|
|
|
|
{ "sbprov2", &sb_pro_v2_device },
|
|
|
|
|
{ "sb16", &sb_16_device },
|
2021-03-20 01:21:42 -03:00
|
|
|
{ "sb16_pnp", &sb_16_pnp_device },
|
2021-03-22 23:16:08 -03:00
|
|
|
{ "sb32_pnp", &sb_32_pnp_device },
|
2020-11-16 00:01:21 +01:00
|
|
|
{ "sbawe32", &sb_awe32_device },
|
2021-03-20 01:21:42 -03:00
|
|
|
{ "sbawe32_pnp", &sb_awe32_pnp_device },
|
2021-07-25 20:49:27 +05:00
|
|
|
{ "sbawe64_gold", &sb_awe64_gold_device },
|
2017-10-11 05:40:44 -04:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_PAS16)
|
2020-11-16 00:01:21 +01:00
|
|
|
{ "pas16", &pas16_device },
|
2017-06-04 02:14:27 +02:00
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
{ "wss", &wss_device },
|
|
|
|
|
{ "adlib_mca", &adlib_mca_device },
|
|
|
|
|
{ "ncraudio", &ncr_business_audio_device },
|
|
|
|
|
{ "sbmcv", &sb_mcv_device },
|
|
|
|
|
{ "sbpromcv", &sb_pro_mcv_device },
|
|
|
|
|
{ "es1371", &es1371_device },
|
|
|
|
|
{ "", NULL }
|
2016-06-26 00:34:39 +02:00
|
|
|
};
|
|
|
|
|
|
2017-06-05 01:20:51 -04:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef ENABLE_SOUND_LOG
|
|
|
|
|
int sound_do_log = ENABLE_SOUND_LOG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sound_log(const char *fmt, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
if (sound_do_log) {
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-17 05:29:48 +02:00
|
|
|
#else
|
|
|
|
|
#define sound_log(fmt, ...)
|
|
|
|
|
#endif
|
2018-05-21 19:04:05 +02:00
|
|
|
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
int
|
|
|
|
|
sound_card_available(int card)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_cards[card].device)
|
|
|
|
|
return device_available(sound_cards[card].device);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
return 1;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
const device_t *
|
|
|
|
|
sound_card_getdevice(int card)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
return sound_cards[card].device;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
sound_card_has_config(int card)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
if (!sound_cards[card].device)
|
|
|
|
|
return 0;
|
|
|
|
|
return sound_cards[card].device->config ? 1 : 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
sound_card_get_internal_name(int card)
|
2017-03-14 00:38:25 +01:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
return (char *) sound_cards[card].internal_name;
|
2017-03-14 00:38:25 +01:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
sound_card_get_from_internal_name(char *s)
|
2017-03-14 00:38:25 +01:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
int c = 0;
|
|
|
|
|
|
|
|
|
|
while (strlen((char *) sound_cards[c].internal_name)) {
|
|
|
|
|
if (!strcmp((char *) sound_cards[c].internal_name, s))
|
|
|
|
|
return c;
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2017-03-14 00:38:25 +01:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_card_init(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2020-05-19 21:23:25 -03:00
|
|
|
if (sound_cards[sound_card_current].device)
|
2018-10-26 04:05:29 +02:00
|
|
|
device_add(sound_cards[sound_card_current].device);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
cd_vol_l = vol_l;
|
|
|
|
|
cd_vol_r = vol_r;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sound_cd_clean_buffers(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_is_float)
|
2018-10-30 13:32:25 +01:00
|
|
|
memset(cd_out_buffer, 0, (CD_BUFLEN * 2) * sizeof(float));
|
2018-10-26 04:05:29 +02:00
|
|
|
else
|
2018-10-30 13:32:25 +01:00
|
|
|
memset(cd_out_buffer_int16, 0, (CD_BUFLEN * 2) * sizeof(int16_t));
|
2018-10-26 04:05:29 +02:00
|
|
|
}
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
static void
|
|
|
|
|
sound_cd_thread(void *param)
|
|
|
|
|
{
|
|
|
|
|
int c, r, i, channel_select[2];
|
2020-10-21 02:46:50 +02:00
|
|
|
double audio_vol_l, audio_vol_r;
|
|
|
|
|
double cd_buffer_temp[2] = {0.0, 0.0};
|
2017-06-14 07:21:01 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
thread_set_event(sound_cd_start_event);
|
2018-02-15 23:14:44 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
while (cdaudioon) {
|
|
|
|
|
thread_wait_event(sound_cd_event, -1);
|
|
|
|
|
thread_reset_event(sound_cd_event);
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (!cdaudioon)
|
|
|
|
|
return;
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_clean_buffers();
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (i = 0; i < CDROM_NUM; i++) {
|
2018-10-30 13:32:25 +01:00
|
|
|
if ((cdrom[i].bus_type == CDROM_BUS_DISABLED) ||
|
|
|
|
|
(cdrom[i].cd_status == CD_STATUS_EMPTY))
|
2018-10-26 04:05:29 +02:00
|
|
|
continue;
|
2018-10-30 13:32:25 +01:00
|
|
|
r = cdrom_audio_callback(&(cdrom[i]), cd_buffer[i], CD_BUFLEN * 2);
|
|
|
|
|
if (!cdrom[i].bus_type || !cdrom[i].sound_on || !r)
|
2018-10-26 04:05:29 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (cdrom[i].get_volume) {
|
2018-10-26 04:54:04 +02:00
|
|
|
audio_vol_l = (float) (cdrom[i].get_volume(cdrom[i].priv, 0));
|
|
|
|
|
audio_vol_r = (float) (cdrom[i].get_volume(cdrom[i].priv, 1));
|
2018-10-26 04:05:29 +02:00
|
|
|
} else {
|
|
|
|
|
audio_vol_l = 255.0;
|
|
|
|
|
audio_vol_r = 255.0;
|
2017-01-16 01:49:19 +01:00
|
|
|
}
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2020-10-19 01:02:40 +02:00
|
|
|
/* Calculate attenuation per the specification. */
|
|
|
|
|
if (audio_vol_l >= 255.0)
|
|
|
|
|
audio_vol_l = 1.0;
|
|
|
|
|
else if (audio_vol_l > 0.0)
|
|
|
|
|
audio_vol_l = (48.0 + (20.0 * log(audio_vol_l / 256.0))) / 48.0;
|
|
|
|
|
else
|
|
|
|
|
audio_vol_l = 0.0;
|
|
|
|
|
|
|
|
|
|
if (audio_vol_r >= 255.0)
|
|
|
|
|
audio_vol_r = 1.0;
|
|
|
|
|
else if (audio_vol_r > 0.0)
|
|
|
|
|
audio_vol_r = (48.0 + (20.0 * log(audio_vol_r / 256.0))) / 48.0;
|
|
|
|
|
else
|
|
|
|
|
audio_vol_r = 0.0;
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (cdrom[i].get_channel) {
|
2018-10-26 04:54:04 +02:00
|
|
|
channel_select[0] = cdrom[i].get_channel(cdrom[i].priv, 0);
|
|
|
|
|
channel_select[1] = cdrom[i].get_channel(cdrom[i].priv, 1);
|
2018-10-26 04:05:29 +02:00
|
|
|
} else {
|
|
|
|
|
channel_select[0] = 1;
|
|
|
|
|
channel_select[1] = 2;
|
2017-01-16 01:49:19 +01:00
|
|
|
}
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (c = 0; c < CD_BUFLEN*2; c += 2) {
|
|
|
|
|
/*Apply ATAPI channel select*/
|
|
|
|
|
cd_buffer_temp[0] = cd_buffer_temp[1] = 0.0;
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((audio_vol_l != 0.0) && (channel_select[0] != 0)) {
|
|
|
|
|
if (channel_select[0] & 1)
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_buffer_temp[0] += ((double) cd_buffer[i][c]); /* Channel 0 => Port 0 */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (channel_select[0] & 2)
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_buffer_temp[0] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 0 */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
|
|
|
|
cd_buffer_temp[0] *= audio_vol_l; /* Multiply Port 0 by Port 0 volume */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((audio_vol_r != 0.0) && (channel_select[1] != 0)) {
|
|
|
|
|
if (channel_select[1] & 1)
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_buffer_temp[1] += ((double) cd_buffer[i][c]); /* Channel 0 => Port 1 */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (channel_select[1] & 2)
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_buffer_temp[1] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 1 */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
|
|
|
|
cd_buffer_temp[1] *= audio_vol_r; /* Multiply Port 1 by Port 1 volume */
|
|
|
|
|
}
|
2018-10-26 04:05:29 +02:00
|
|
|
|
2020-10-19 01:02:40 +02:00
|
|
|
/* Apply sound card CD volume and filters */
|
|
|
|
|
if (filter_cd_audio != NULL) {
|
|
|
|
|
filter_cd_audio(0, &(cd_buffer_temp[0]), filter_cd_audio_p);
|
2020-10-19 02:30:16 +02:00
|
|
|
filter_cd_audio(1, &(cd_buffer_temp[1]), filter_cd_audio_p);
|
2020-10-19 01:02:40 +02:00
|
|
|
}
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
if (sound_is_float) {
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_out_buffer[c] += (float) (cd_buffer_temp[0] / 32768.0);
|
|
|
|
|
cd_out_buffer[c+1] += (float) (cd_buffer_temp[1] / 32768.0);
|
2018-10-26 04:05:29 +02:00
|
|
|
} else {
|
|
|
|
|
if (cd_buffer_temp[0] > 32767)
|
|
|
|
|
cd_buffer_temp[0] = 32767;
|
|
|
|
|
if (cd_buffer_temp[0] < -32768)
|
|
|
|
|
cd_buffer_temp[0] = -32768;
|
|
|
|
|
if (cd_buffer_temp[1] > 32767)
|
|
|
|
|
cd_buffer_temp[1] = 32767;
|
|
|
|
|
if (cd_buffer_temp[1] < -32768)
|
|
|
|
|
cd_buffer_temp[1] = -32768;
|
|
|
|
|
|
2020-10-21 02:46:50 +02:00
|
|
|
cd_out_buffer_int16[c] += (int16_t) cd_buffer_temp[0];
|
|
|
|
|
cd_out_buffer_int16[c+1] += (int16_t) cd_buffer_temp[1];
|
2018-10-26 04:05:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
2017-01-27 23:03:20 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_is_float)
|
|
|
|
|
givealbuffer_cd(cd_out_buffer);
|
|
|
|
|
else
|
|
|
|
|
givealbuffer_cd(cd_out_buffer_int16);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
static void
|
|
|
|
|
sound_realloc_buffers(void)
|
2017-06-14 07:21:01 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
if (outbuffer_ex != NULL)
|
|
|
|
|
free(outbuffer_ex);
|
2017-06-14 07:21:01 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (outbuffer_ex_int16 != NULL)
|
|
|
|
|
free(outbuffer_ex_int16);
|
2017-06-14 07:21:01 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_is_float)
|
|
|
|
|
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
|
|
|
|
|
else
|
|
|
|
|
outbuffer_ex_int16 = malloc(SOUNDBUFLEN * 2 * sizeof(int16_t));
|
2017-06-14 07:21:01 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_init(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
int i = 0;
|
|
|
|
|
int available_cdrom_drives = 0;
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
outbuffer_ex = NULL;
|
|
|
|
|
outbuffer_ex_int16 = NULL;
|
2017-06-14 07:21:01 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t));
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (i = 0; i < CDROM_NUM; i++) {
|
|
|
|
|
if (cdrom[i].bus_type != CDROM_BUS_DISABLED)
|
|
|
|
|
available_cdrom_drives++;
|
|
|
|
|
}
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (available_cdrom_drives) {
|
|
|
|
|
cdaudioon = 1;
|
2018-02-15 23:14:44 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_start_event = thread_create_event();
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_event = thread_create_event();
|
|
|
|
|
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_log("Waiting for CD start event...\n");
|
|
|
|
|
thread_wait_event(sound_cd_start_event, -1);
|
|
|
|
|
thread_reset_event(sound_cd_start_event);
|
|
|
|
|
sound_log("Done!\n");
|
|
|
|
|
} else
|
|
|
|
|
cdaudioon = 0;
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
cd_thread_enable = available_cdrom_drives ? 1 : 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
void
|
|
|
|
|
sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
|
2018-02-15 23:14:44 +01:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_handlers[sound_handlers_num].get_buffer = get_buffer;
|
|
|
|
|
sound_handlers[sound_handlers_num].priv = p;
|
|
|
|
|
sound_handlers_num++;
|
2018-02-15 23:14:44 +01:00
|
|
|
}
|
|
|
|
|
|
2017-06-19 06:46:08 +02:00
|
|
|
|
2020-10-19 01:02:40 +02:00
|
|
|
void
|
2020-10-21 02:46:50 +02:00
|
|
|
sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *p), void *p)
|
2020-10-19 01:02:40 +02:00
|
|
|
{
|
2020-10-19 02:32:28 +02:00
|
|
|
if ((filter_cd_audio == NULL) || (filter == NULL)) {
|
2020-10-19 01:02:40 +02:00
|
|
|
filter_cd_audio = filter;
|
|
|
|
|
filter_cd_audio_p = p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
void
|
|
|
|
|
sound_poll(void *priv)
|
|
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_advance_u64(&sound_poll_timer, sound_poll_latch);
|
2017-06-19 06:46:08 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
midi_poll();
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_pos_global++;
|
|
|
|
|
if (sound_pos_global == SOUNDBUFLEN) {
|
|
|
|
|
int c;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
memset(outbuffer, 0, SOUNDBUFLEN * 2 * sizeof(int32_t));
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (c = 0; c < sound_handlers_num; c++)
|
|
|
|
|
sound_handlers[c].get_buffer(outbuffer, SOUNDBUFLEN, sound_handlers[c].priv);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (c = 0; c < SOUNDBUFLEN * 2; c++) {
|
|
|
|
|
if (sound_is_float)
|
|
|
|
|
outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0;
|
|
|
|
|
else {
|
|
|
|
|
if (outbuffer[c] > 32767)
|
|
|
|
|
outbuffer[c] = 32767;
|
|
|
|
|
if (outbuffer[c] < -32768)
|
|
|
|
|
outbuffer[c] = -32768;
|
|
|
|
|
|
|
|
|
|
outbuffer_ex_int16[c] = outbuffer[c];
|
2017-02-02 02:55:08 +01:00
|
|
|
}
|
2018-10-26 04:05:29 +02:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_is_float)
|
|
|
|
|
givealbuffer(outbuffer_ex);
|
|
|
|
|
else
|
|
|
|
|
givealbuffer(outbuffer_ex_int16);
|
|
|
|
|
|
|
|
|
|
if (cd_thread_enable) {
|
|
|
|
|
cd_buf_update--;
|
|
|
|
|
if (!cd_buf_update) {
|
|
|
|
|
cd_buf_update = (48000 / SOUNDBUFLEN) / (CD_FREQ / CD_BUFLEN);
|
|
|
|
|
thread_set_event(sound_cd_event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sound_pos_global = 0;
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_speed_changed(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sound_poll_latch = (uint64_t)((double)TIMER_USEC * (1000000.0 / 48000.0));
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_reset(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_realloc_buffers();
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
midi_device_init();
|
2020-01-19 05:45:05 +01:00
|
|
|
midi_in_device_init();
|
2018-10-26 04:05:29 +02:00
|
|
|
inital();
|
2017-01-16 01:49:19 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_add(&sound_poll_timer, sound_poll, NULL, 1);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_handlers_num = 0;
|
2020-10-19 01:02:40 +02:00
|
|
|
memset(sound_handlers, 0x00, 8 * sizeof(sound_handler_t));
|
|
|
|
|
|
|
|
|
|
filter_cd_audio = NULL;
|
|
|
|
|
filter_cd_audio_p = NULL;
|
2018-02-15 23:14:44 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_set_cd_volume(65535, 65535);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_card_reset(void)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
2020-01-19 05:45:05 +01:00
|
|
|
/* Reset the MPU-401 already loaded flag and the chain of input/output handlers. */
|
|
|
|
|
midi_in_handlers_clear();
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
sound_card_init();
|
2020-01-19 05:45:05 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (mpu401_standalone_enable)
|
|
|
|
|
mpu401_device_add();
|
2020-01-19 05:45:05 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (GUS)
|
|
|
|
|
device_add(&gus_device);
|
2020-01-19 05:45:05 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (GAMEBLASTER)
|
|
|
|
|
device_add(&cms_device);
|
2020-01-19 05:45:05 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (SSI2001)
|
|
|
|
|
device_add(&ssi2001_device);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_cd_thread_end(void)
|
2017-10-19 23:55:51 +02:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
if (cdaudioon) {
|
|
|
|
|
cdaudioon = 0;
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_log("Waiting for CD Audio thread to terminate...\n");
|
|
|
|
|
thread_set_event(sound_cd_event);
|
|
|
|
|
thread_wait(sound_cd_thread_h, -1);
|
|
|
|
|
sound_log("CD Audio thread terminated...\n");
|
2017-10-19 23:55:51 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_cd_event) {
|
|
|
|
|
thread_destroy_event(sound_cd_event);
|
|
|
|
|
sound_cd_event = NULL;
|
|
|
|
|
}
|
2017-10-19 23:55:51 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_thread_h = NULL;
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (sound_cd_start_event) {
|
|
|
|
|
thread_destroy_event(sound_cd_start_event);
|
|
|
|
|
sound_cd_event = NULL;
|
2017-10-19 23:55:51 +02:00
|
|
|
}
|
2018-10-26 04:05:29 +02:00
|
|
|
}
|
2017-10-19 23:55:51 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sound_cd_thread_reset(void)
|
2017-02-02 02:55:08 +01:00
|
|
|
{
|
2018-10-26 04:05:29 +02:00
|
|
|
int i = 0;
|
|
|
|
|
int available_cdrom_drives = 0;
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
for (i = 0; i < CDROM_NUM; i++) {
|
2018-10-30 13:32:25 +01:00
|
|
|
cdrom_stop(&(cdrom[i]));
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (cdrom[i].bus_type != CDROM_BUS_DISABLED)
|
|
|
|
|
available_cdrom_drives++;
|
|
|
|
|
}
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
if (available_cdrom_drives && !cd_thread_enable) {
|
|
|
|
|
cdaudioon = 1;
|
2018-02-15 23:14:44 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_start_event = thread_create_event();
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
sound_cd_event = thread_create_event();
|
|
|
|
|
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
2017-12-05 20:19:19 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
thread_wait_event(sound_cd_start_event, -1);
|
|
|
|
|
thread_reset_event(sound_cd_start_event);
|
|
|
|
|
} else if (!available_cdrom_drives && cd_thread_enable)
|
|
|
|
|
sound_cd_thread_end();
|
2017-02-02 02:55:08 +01:00
|
|
|
|
2018-10-26 04:05:29 +02:00
|
|
|
cd_thread_enable = available_cdrom_drives ? 1 : 0;
|
2017-02-02 02:55:08 +01:00
|
|
|
}
|