diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/fmopl.cpp | 2 | ||||
-rw-r--r-- | sound/softsynth/opl/dosbox.cpp | 2 | ||||
-rw-r--r-- | sound/softsynth/opl/opl_impl.h | 36 | ||||
-rw-r--r-- | sound/softsynth/opl/opl_inc.h | 11 |
4 files changed, 34 insertions, 17 deletions
diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp index 37b993737c..d97ab48e81 100644 --- a/sound/fmopl.cpp +++ b/sound/fmopl.cpp @@ -43,7 +43,7 @@ const Config::EmulatorDescription Config::_drivers[] = { { "auto", "<default>", kAuto, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, { "mame", "MAME OPL emulator", kMame, kFlagOpl2 }, #ifndef DISABLE_DOSBOX_OPL - { "db", "DOSBox OPL emulator (experimental)", kDOSBox, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, + { "db", "DOSBox OPL emulator", kDOSBox, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, #endif { 0, 0, 0, 0 } }; diff --git a/sound/softsynth/opl/dosbox.cpp b/sound/softsynth/opl/dosbox.cpp index 03c014ecfa..9b3cab57c6 100644 --- a/sound/softsynth/opl/dosbox.cpp +++ b/sound/softsynth/opl/dosbox.cpp @@ -177,7 +177,7 @@ struct Handler : public DOSBox::Handler { uint32 writeAddr(uint32 port, uint8 val) { adlib_write_index(port, val); - return index; + return opl_index; } void generate(int16 *chan, uint samples) { diff --git a/sound/softsynth/opl/opl_impl.h b/sound/softsynth/opl/opl_impl.h index 5b897e12a7..0df8b5f884 100644 --- a/sound/softsynth/opl/opl_impl.h +++ b/sound/softsynth/opl/opl_impl.h @@ -56,7 +56,7 @@ static const fltype frqmul_tab[16] = { 0.5,1,2,3,4,5,6,7,8,9,10,10,12,12,15,15 }; // calculated frequency multiplication values (depend on sampling rate) -static float frqmul[16]; +static fltype frqmul[16]; // key scale levels static Bit8u kslev[8][16]; @@ -125,8 +125,18 @@ static Bit32u wavestart[8] = { }; // envelope generator function constants -static fltype attackconst[4] = {1/2.82624,1/2.25280,1/1.88416,1/1.59744}; -static fltype decrelconst[4] = {1/39.28064,1/31.41608,1/26.17344,1/22.44608}; +static fltype attackconst[4] = { + (fltype)(1/2.82624), + (fltype)(1/2.25280), + (fltype)(1/1.88416), + (fltype)(1/1.59744) +}; +static fltype decrelconst[4] = { + (fltype)(1/39.28064), + (fltype)(1/31.41608), + (fltype)(1/26.17344), + (fltype)(1/22.44608) +}; void operator_advance(op_type* op_pt, Bit32s vib) { @@ -274,9 +284,9 @@ void operator_attack(op_type* op_pt) { op_pt->amp = 1.0; op_pt->step_amp = 1.0; } - op_pt->step_skip_pos <<= 1; - if (op_pt->step_skip_pos==0) op_pt->step_skip_pos = 1; - if (op_pt->step_skip_pos & op_pt->env_step_skip_a) { // check if required to skip next step + op_pt->step_skip_pos_a <<= 1; + if (op_pt->step_skip_pos_a==0) op_pt->step_skip_pos_a = 1; + if (op_pt->step_skip_pos_a & op_pt->env_step_skip_a) { // check if required to skip next step op_pt->step_amp = op_pt->amp; } } @@ -487,7 +497,7 @@ void adlib_init(Bit32u samplerate) { op[i].env_step_a = 0; op[i].env_step_d = 0; op[i].env_step_r = 0; - op[i].step_skip_pos = 0; + op[i].step_skip_pos_a = 0; op[i].env_step_skip_a = 0; #if defined(OPLTYPE_IS_OPL3) @@ -504,7 +514,7 @@ void adlib_init(Bit32u samplerate) { } status = 0; - index = 0; + opl_index = 0; // create vibrato table @@ -552,9 +562,9 @@ void adlib_init(Bit32u samplerate) { wavtable[(i<<1) +WAVEPREC] = (Bit16s)(16384*sin((fltype)((i<<1) )*PI*2/WAVEPREC)); wavtable[(i<<1)+1+WAVEPREC] = (Bit16s)(16384*sin((fltype)((i<<1)+1)*PI*2/WAVEPREC)); wavtable[i] = wavtable[(i<<1) +WAVEPREC]; - // table to be verified, alternative: (zero-less) -/* wavtable[(i<<1) +WAVEPREC] = (Bit16s)(16384*sin((fltype)(((i*2+1)<<1)-1)*PI/WAVEPREC)); - wavtable[(i<<1)+1+WAVEPREC] = (Bit16s)(16384*sin((fltype)(((i*2+1)<<1) )*PI/WAVEPREC)); + // alternative: (zero-less) +/* wavtable[(i<<1) +WAVEPREC] = (Bit16s)(16384*sin((fltype)((i<<2)+1)*PI/WAVEPREC)); + wavtable[(i<<1)+1+WAVEPREC] = (Bit16s)(16384*sin((fltype)((i<<2)+3)*PI/WAVEPREC)); wavtable[i] = wavtable[(i<<1)-1+WAVEPREC]; */ } for (i=0;i<(WAVEPREC>>3);i++) { @@ -901,11 +911,11 @@ Bitu adlib_reg_read(Bitu port) { } void adlib_write_index(Bitu port, Bit8u val) { - index = val; + opl_index = val; #if defined(OPLTYPE_IS_OPL3) if ((port&3)!=0) { // possibly second set - if (((adlibreg[0x105]&1)!=0) || (index==5)) index |= ARC_SECONDSET; + if (((adlibreg[0x105]&1)!=0) || (opl_index==5)) opl_index |= ARC_SECONDSET; } #endif } diff --git a/sound/softsynth/opl/opl_inc.h b/sound/softsynth/opl/opl_inc.h index b7b6ac1d41..bdf7e84547 100644 --- a/sound/softsynth/opl/opl_inc.h +++ b/sound/softsynth/opl/opl_inc.h @@ -39,6 +39,13 @@ #define Bit8u uint8 #define Bit8s int8 + +/* + define attribution that inlines/forces inlining of a function (optional) +*/ +#define OPL_INLINE INLINE + + #undef NUM_CHANNELS #if defined(OPLTYPE_IS_OPL3) #define NUM_CHANNELS 18 @@ -137,7 +144,7 @@ typedef struct operator_struct { 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; // position of 8-cyclic step skipping (always 2^x to check against mask) + 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) @@ -153,7 +160,7 @@ op_type op[MAXOPERATORS]; Bits int_samplerate; Bit8u status; -Bit32u index; +Bit32u opl_index; #if defined(OPLTYPE_IS_OPL3) Bit8u adlibreg[512]; // adlib register set (including second set) Bit8u wave_sel[44]; // waveform selection |