mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
Fix PC-98 FM synthesis not to re-register itself again if you reboot in PC-98 mode. Prior to this fix, rebooting in PC-98 mode resulted in garbled FM music.
This commit is contained in:
parent
645f2cdcc2
commit
d394ec5dae
@ -3981,53 +3981,59 @@ static void pc98_mix_CallBack(Bitu len) {
|
|||||||
pc98_mixer->AddSamples_s32(s, (Bit32s*)MixTemp);
|
pc98_mixer->AddSamples_s32(s, (Bit32s*)MixTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool pc98fm_init = false;
|
||||||
|
|
||||||
void PC98_FM_OnEnterPC98(Section *sec) {
|
void PC98_FM_OnEnterPC98(Section *sec) {
|
||||||
// TODO:
|
if (!pc98fm_init) {
|
||||||
// - Give the user an option in dosbox.conf to enable/disable FM emulation
|
pc98fm_init = true;
|
||||||
// - Give the user a choice which board to emulate (the borrowed code can emulate 10 different cards)
|
|
||||||
// - Give the user a choice which IRQ to attach it to
|
// TODO:
|
||||||
// - Give the user a choice of base I/O address (0x088 or 0x188)
|
// - Give the user an option in dosbox.conf to enable/disable FM emulation
|
||||||
// - Move this code out into it's own file. This is SOUND code. It does not belong in vga.cpp.
|
// - Give the user a choice which board to emulate (the borrowed code can emulate 10 different cards)
|
||||||
// - Register the TMS3631, OPNA, PSG, RHYTHM, etc. outputs as individual mixer channels, where
|
// - Give the user a choice which IRQ to attach it to
|
||||||
// each can then run at their own sample rate, and the user can use DOSBox-X mixer controls to
|
// - Give the user a choice of base I/O address (0x088 or 0x188)
|
||||||
// set volume, record individual tracks with WAV capture, etc.
|
// - Move this code out into it's own file. This is SOUND code. It does not belong in vga.cpp.
|
||||||
// - Cleanup this code, organize it.
|
// - Register the TMS3631, OPNA, PSG, RHYTHM, etc. outputs as individual mixer channels, where
|
||||||
// - Make sure this code clearly indicates that it was borrowed and adapted from Neko Project II and
|
// each can then run at their own sample rate, and the user can use DOSBox-X mixer controls to
|
||||||
// ported to DOSBox-X. I cannot take credit for this code, I can only take credit for porting it
|
// set volume, record individual tracks with WAV capture, etc.
|
||||||
// and future refinements in this project.
|
// - Cleanup this code, organize it.
|
||||||
LOG_MSG("Initializing FM board at base 0x%x",pc98_fm_base);
|
// - Make sure this code clearly indicates that it was borrowed and adapted from Neko Project II and
|
||||||
for (unsigned int i=0;i < 8;i += 2) {
|
// ported to DOSBox-X. I cannot take credit for this code, I can only take credit for porting it
|
||||||
IO_RegisterWriteHandler(pc98_fm_base+i,pc98_fm_write,IO_MB);
|
// and future refinements in this project.
|
||||||
IO_RegisterReadHandler(pc98_fm_base+i,pc98_fm_read,IO_MB);
|
LOG_MSG("Initializing FM board at base 0x%x",pc98_fm_base);
|
||||||
|
for (unsigned int i=0;i < 8;i += 2) {
|
||||||
|
IO_RegisterWriteHandler(pc98_fm_base+i,pc98_fm_write,IO_MB);
|
||||||
|
IO_RegisterReadHandler(pc98_fm_base+i,pc98_fm_read,IO_MB);
|
||||||
|
}
|
||||||
|
|
||||||
|
// WARNING: Some parts of the borrowed code assume 44100, 22050, or 11025 and
|
||||||
|
// will misrender if given any other sample rate (especially the OPNA synth).
|
||||||
|
unsigned int rate = 44100;
|
||||||
|
unsigned char vol14[6] = { 15, 15, 15, 15, 15, 15 };
|
||||||
|
|
||||||
|
pc98_mixer = MIXER_AddChannel(pc98_mix_CallBack, rate, "PC-98");
|
||||||
|
pc98_mixer->Enable(true);
|
||||||
|
|
||||||
|
fmboard_reset(NULL, 0x14);
|
||||||
|
fmboard_extenable(true);
|
||||||
|
|
||||||
|
// fddmtrsnd_initialize(rate);
|
||||||
|
// beep_initialize(rate);
|
||||||
|
// beep_setvol(3);
|
||||||
|
tms3631_initialize(rate);
|
||||||
|
tms3631_setvol(vol14);
|
||||||
|
opngen_initialize(rate);
|
||||||
|
opngen_setvol(128);
|
||||||
|
psggen_initialize(rate);
|
||||||
|
psggen_setvol(128);
|
||||||
|
rhythm_initialize(rate);
|
||||||
|
rhythm_setvol(128);
|
||||||
|
adpcm_initialize(rate);
|
||||||
|
adpcm_setvol(128);
|
||||||
|
pcm86gen_initialize(rate);
|
||||||
|
pcm86gen_setvol(128);
|
||||||
|
|
||||||
|
board86c_bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: Some parts of the borrowed code assume 44100, 22050, or 11025 and
|
|
||||||
// will misrender if given any other sample rate (especially the OPNA synth).
|
|
||||||
unsigned int rate = 44100;
|
|
||||||
unsigned char vol14[6] = { 15, 15, 15, 15, 15, 15 };
|
|
||||||
|
|
||||||
pc98_mixer = MIXER_AddChannel(pc98_mix_CallBack, rate, "PC-98");
|
|
||||||
pc98_mixer->Enable(true);
|
|
||||||
|
|
||||||
fmboard_reset(NULL, 0x14);
|
|
||||||
fmboard_extenable(true);
|
|
||||||
|
|
||||||
// fddmtrsnd_initialize(rate);
|
|
||||||
// beep_initialize(rate);
|
|
||||||
// beep_setvol(3);
|
|
||||||
tms3631_initialize(rate);
|
|
||||||
tms3631_setvol(vol14);
|
|
||||||
opngen_initialize(rate);
|
|
||||||
opngen_setvol(128);
|
|
||||||
psggen_initialize(rate);
|
|
||||||
psggen_setvol(128);
|
|
||||||
rhythm_initialize(rate);
|
|
||||||
rhythm_setvol(128);
|
|
||||||
adpcm_initialize(rate);
|
|
||||||
adpcm_setvol(128);
|
|
||||||
pcm86gen_initialize(rate);
|
|
||||||
pcm86gen_setvol(128);
|
|
||||||
|
|
||||||
board86c_bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user