Files
TeslaRel410/emulator/vpx-device/emu8k_shim.h
T
CydandClaude Fable 5 a0a4260fd4 Sound: dual-AWE32 EMU8000 emulation -- the pod has audio
Vendored 86Box EMU8000 core (GPL-2, emu8k.cpp/.h + shim) plus vweawe.cpp:
two cards at the production addresses (0x620/0x640 register triplets),
rear-card DSP/mixer stub at 0x240, synthesis on an autonomous render
thread with direct winmm output so sustained voices ride through
emulation-thread stalls (RIO staging retries) like the real silicon did.
WC sample-counter interpolation between render chunks keeps HMI SOS
busy-waits fast. VWE_AWE32/VWE_AWE_ROM/VWE_AWE_RAM_KB/VWE_AWE_SHIFT/
VWE_AWE_LEAD_MS/VWE_AWE_DUMP/VWE_AWE_LOG env knobs.

emulator/roms: the AWE32 1MGM GM ROM dumped from our own pod card (SF2)
plus the reconstructed raw image the emulated EMU8000 loads. The HMI
driver refuses the AUDIO*.RES SoundFont upload without it (banks declare
irom=1MGM) -- that was the root cause of the first silent runs; full
debug chain in SOUND-NOTES.md. Repo serves the pod-owner community only.

.gitignore: drop the ROM excludes and un-ignore ALPHA_1/ and sda4/
(committed separately).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 19:40:15 -05:00

49 lines
2.1 KiB
C

/* Minimal 86Box environment shim for the vendored EMU8000 core (emu8k.cpp).
* Supplies exactly what snd_emu8k.c pulled from 86Box headers:
* - io_sethandler/io_removehandler (implemented in vweawe.cpp on top of
* DOSBox-X IO_Register*Handler, with the 86Box handler signatures)
* - wavetable_pos_global (the render-target sample clock; vweawe.cpp sets
* it per mixer block instead of 86Box's per-frame sound clock)
* - pclog/pclog_ex/fatal logging and the UNUSED() parameter marker
* - emu8k_shim_rom_fopen(): optional AWE32 GM ROM via $VWE_AWE_ROM
*/
#ifndef VWE_EMU8K_SHIM_H
#define VWE_EMU8K_SHIM_H
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* 86Box io.h handler signatures (priv-pointer style) */
typedef uint8_t (*emu8k_io_inb_t)(uint16_t addr, void *priv);
typedef uint16_t (*emu8k_io_inw_t)(uint16_t addr, void *priv);
typedef uint32_t (*emu8k_io_inl_t)(uint16_t addr, void *priv);
typedef void (*emu8k_io_outb_t)(uint16_t addr, uint8_t val, void *priv);
typedef void (*emu8k_io_outw_t)(uint16_t addr, uint16_t val, void *priv);
typedef void (*emu8k_io_outl_t)(uint16_t addr, uint32_t val, void *priv);
void io_sethandler(uint16_t base, int size,
emu8k_io_inb_t inb, emu8k_io_inw_t inw, emu8k_io_inl_t inl,
emu8k_io_outb_t outb, emu8k_io_outw_t outw,
emu8k_io_outl_t outl, void *priv);
void io_removehandler(uint16_t base, int size,
emu8k_io_inb_t inb, emu8k_io_inw_t inw,
emu8k_io_inl_t inl, emu8k_io_outb_t outb,
emu8k_io_outw_t outw, emu8k_io_outl_t outl, void *priv);
/* render-target sample position for emu8k_update() (86Box sound.h) */
extern int wavetable_pos_global;
FILE *emu8k_shim_rom_fopen(void);
/* samples elapsed since the last mixer render (WC interpolation) */
unsigned emu8k_shim_wc_extra(void);
#define pclog(...) fprintf(stderr, __VA_ARGS__)
#define pclog_ex(fmt, ap) vfprintf(stderr, fmt, ap)
#define fatal(...) fprintf(stderr, __VA_ARGS__)
#define UNUSED(arg) arg
#endif