Added save/restore support for the OPL3 waveform selection.
This commit is contained in:
parent
3ab5b052a1
commit
49e265f5f8
@ -420,6 +420,7 @@ void change_waveform(Bitu regbase, op_type* op_pt)
|
||||
if (regbase>=ARC_SECONDSET) regbase -= (ARC_SECONDSET-22); // second set starts at 22
|
||||
#endif
|
||||
// waveform selection
|
||||
op_pt->cur_wvsel = wave_sel[regbase];
|
||||
op_pt->cur_wmask = wavemask[wave_sel[regbase]];
|
||||
op_pt->cur_wform = &wavtable[waveform[wave_sel[regbase]]];
|
||||
// (might need to be adapted to waveform type here...)
|
||||
@ -527,6 +528,7 @@ void adlib_init(Bit32u samplerate)
|
||||
op[i].tcount = 0;
|
||||
op[i].tinc = 0;
|
||||
op[i].toff = 0;
|
||||
op[i].cur_wvsel = 0;
|
||||
op[i].cur_wmask = wavemask[0];
|
||||
op[i].cur_wform = &wavtable[waveform[0]];
|
||||
op[i].freq_high = 0;
|
||||
@ -1553,8 +1555,7 @@ void adlib_register_state(bx_list_c *parent)
|
||||
new bx_shadow_num_c(opX, "op_state", &op[i].op_state);
|
||||
new bx_shadow_num_c(opX, "toff", &op[i].toff);
|
||||
new bx_shadow_num_c(opX, "freq_high", &op[i].freq_high);
|
||||
// TODO: cur_wform
|
||||
new bx_shadow_num_c(opX, "cur_wmask", &op[i].cur_wmask);
|
||||
new bx_shadow_num_c(opX, "cur_wvsel", &op[i].cur_wvsel);
|
||||
new bx_shadow_num_c(opX, "act_state", &op[i].act_state);
|
||||
new bx_shadow_bool_c(opX, "sys_keep", &op[i].sus_keep);
|
||||
new bx_shadow_bool_c(opX, "vibrato", &op[i].vibrato);
|
||||
@ -1575,4 +1576,16 @@ void adlib_register_state(bx_list_c *parent)
|
||||
}
|
||||
}
|
||||
|
||||
void adlib_after_restore_state()
|
||||
{
|
||||
int i;
|
||||
Bit8u wvsel;
|
||||
|
||||
for (i = 0; i < MAXOPERATORS; i++) {
|
||||
wvsel = op[i].cur_wvsel;
|
||||
op[i].cur_wmask = wavemask[wvsel];
|
||||
op[i].cur_wform = &wavtable[waveform[wvsel]];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -141,6 +141,7 @@ typedef struct operator_struct {
|
||||
Bit32u op_state; // current state of operator (attack/decay/sustain/release/off)
|
||||
Bit32u toff;
|
||||
Bit32s freq_high; // highest three bits of the frequency, used for vibrato calculations
|
||||
Bit8u cur_wvsel; // register value of selected waveform
|
||||
Bit16s* cur_wform; // start of selected waveform
|
||||
Bit32u cur_wmask; // mask for selected waveform
|
||||
Bit32u act_state; // activity state (regular, percussion)
|
||||
@ -210,6 +211,7 @@ Bitu adlib_reg_read(Bitu port);
|
||||
void adlib_write_index(Bitu port, Bit8u val);
|
||||
|
||||
void adlib_register_state(bx_list_c *parent);
|
||||
void adlib_after_restore_state();
|
||||
|
||||
extern Bit16u opl_index;
|
||||
|
||||
|
@ -526,6 +526,7 @@ void bx_sb16_c::register_state(void)
|
||||
void bx_sb16_c::after_restore_state(void)
|
||||
{
|
||||
set_irq_dma();
|
||||
adlib_after_restore_state();
|
||||
}
|
||||
|
||||
void bx_sb16_c::runtime_config_handler(void *this_ptr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user