diff --git a/bochs/iodev/sound/opl.cc b/bochs/iodev/sound/opl.cc index 443548fbe..c51d3b72e 100644 --- a/bochs/iodev/sound/opl.cc +++ b/bochs/iodev/sound/opl.cc @@ -1,3 +1,6 @@ +///////////////////////////////////////////////////////////////////////// +// $Id$ +///////////////////////////////////////////////////////////////////////// /* * Copyright (C) 2002-2013 The DOSBox Team * Copyright (C) 2015 The Bochs Project @@ -39,7 +42,7 @@ #if BX_SUPPORT_SB16 -Bit32u opl_index; +Bit16u opl_index; static fltype recipsamp; // inverse of sampling rate static Bit16s wavtable[WAVEPREC*3]; // wave form table @@ -1504,18 +1507,53 @@ bx_bool adlib_getsample(Bit16s* sndptr, Bits numsamples) void adlib_register_state(bx_list_c *parent) { - char regnum[8]; + int i; + char numstr[8]; bx_list_c *adlib = new bx_list_c(parent, "adlib"); new bx_shadow_num_c(adlib, "opl_index", &opl_index, BASE_HEX); #if defined(OPLTYPE_IS_OPL3) bx_list_c *regs = new bx_list_c(adlib, "regs"); - for (int i = 0; i < 512; i++) { - sprintf(regnum, "0x%03x", i); - new bx_shadow_num_c(regs, regnum, &adlibreg[i], BASE_HEX); + for (i = 0; i < 512; i++) { + sprintf(numstr, "0x%03x", i); + new bx_shadow_num_c(regs, numstr, &adlibreg[i], BASE_HEX); + } + bx_list_c *wavesel = new bx_list_c(adlib, "wave_sel"); + for (i = 0; i < 44; i++) { + sprintf(numstr, "%d", i); + new bx_shadow_num_c(wavesel, numstr, &wave_sel[i]); } #endif - // TODO: add internal settings + new bx_shadow_num_c(adlib, "vibtab_pos", &vibtab_pos); + new bx_shadow_num_c(adlib, "tremtab_pos", &tremtab_pos); + bx_list_c *ops = new bx_list_c(adlib, "op"); + for (i = 0; i < MAXOPERATORS; i++) { + sprintf(numstr, "%d", i); + bx_list_c *opX = new bx_list_c(ops, numstr); + new bx_shadow_num_c(opX, "cval", &op[i].cval); + new bx_shadow_num_c(opX, "lastcval", &op[i].lastcval); + new bx_shadow_num_c(opX, "tcount", &op[i].tcount); + new bx_shadow_num_c(opX, "wfpos", &op[i].wfpos); + new bx_shadow_num_c(opX, "tinc", &op[i].tinc); + new bx_shadow_num_c(opX, "mfbi", &op[i].mfbi); + 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); + new bx_shadow_num_c(opX, "cur_wmask", &op[i].cur_wmask); + 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); + new bx_shadow_bool_c(opX, "tremolo", &op[i].tremolo); + new bx_shadow_num_c(opX, "generator_pos", &op[i].generator_pos); + new bx_shadow_num_c(opX, "step_skip_pos_a", &op[i].step_skip_pos_a); +#if defined(OPLTYPE_IS_OPL3) + new bx_shadow_bool_c(opX, "is_4op", &op[i].is_4op); + new bx_shadow_bool_c(opX, "is_4op_attached", &op[i].is_4op_attached); + new bx_shadow_num_c(opX, "left_pan", &op[i].left_pan); + new bx_shadow_num_c(opX, "right_pan", &op[i].right_pan); +#endif + // TODO: add more internal settings (other variable types) + } } #endif diff --git a/bochs/iodev/sound/opl.h b/bochs/iodev/sound/opl.h index ecf13286d..8e2e1c87b 100644 --- a/bochs/iodev/sound/opl.h +++ b/bochs/iodev/sound/opl.h @@ -1,3 +1,6 @@ +///////////////////////////////////////////////////////////////////////// +// $Id$ +///////////////////////////////////////////////////////////////////////// /* * Copyright (C) 2002-2013 The DOSBox Team * Copyright (C) 2015 The Bochs Project @@ -127,33 +130,33 @@ typedef int8_t Bit8s; channel. */ typedef struct operator_struct { - Bit32s cval, lastcval; // current output/last output (used for feedback) + Bit32s cval, lastcval; // current output/last output (used for feedback) Bit32u tcount, wfpos, tinc; // time (position in waveform) and time increment - fltype amp, step_amp; // and amplification (envelope) - fltype vol; // volume - fltype sustain_level; // sustain level - Bit32s mfbi; // feedback amount - fltype a0, a1, a2, a3; // attack rate function coefficients + fltype amp, step_amp; // and amplification (envelope) + fltype vol; // volume + fltype sustain_level; // sustain level + Bit32s mfbi; // feedback amount + fltype a0, a1, a2, a3; // attack rate function coefficients fltype decaymul, releasemul; // decay/release rate functions - Bit32u op_state; // current state of operator (attack/decay/sustain/release/off) + 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 - Bit16s* cur_wform; // start of selected waveform + Bit16s* cur_wform; // start of selected waveform Bit32u cur_wmask; // mask for selected waveform Bit32u act_state; // activity state (regular, percussion) - bool sus_keep; // keep sustain level when decay finished - bool vibrato,tremolo; // vibrato/tremolo enable bits + bx_bool sus_keep; // keep sustain level when decay finished + bx_bool vibrato,tremolo; // vibrato/tremolo enable bits // variables used to provide non-continuous envelopes - Bit32u generator_pos; // for non-standard sample rates we need to determine how many samples have passed - Bits cur_env_step; // current (standardized) sample position + Bit32u generator_pos; // for non-standard sample rates we need to determine how many samples have passed + Bits cur_env_step; // current (standardized) sample position Bits env_step_a,env_step_d,env_step_r; // number of std samples of one step (for attack/decay/release mode) - Bit8u step_skip_pos_a; // position of 8-cyclic step skipping (always 2^x to check against mask) - Bits env_step_skip_a; // bitmask that determines if a step is skipped (respective bit is zero then) + Bit8u step_skip_pos_a; // position of 8-cyclic step skipping (always 2^x to check against mask) + Bits env_step_skip_a; // bitmask that determines if a step is skipped (respective bit is zero then) #if defined(OPLTYPE_IS_OPL3) - bool is_4op,is_4op_attached; // base of a 4op channel/part of a 4op channel - Bit32s left_pan,right_pan; // opl3 stereo panning amount + bx_bool is_4op,is_4op_attached; // base of a 4op channel/part of a 4op channel + Bit32s left_pan,right_pan; // opl3 stereo panning amount #endif } op_type; @@ -208,6 +211,6 @@ void adlib_write_index(Bitu port, Bit8u val); void adlib_register_state(bx_list_c *parent); -extern Bit32u opl_index; +extern Bit16u opl_index; #endif