[Scummvm-cvs-logs] SF.net SVN: scummvm:[47546] scummvm/trunk/sound

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Jan 25 03:48:36 CET 2010


Revision: 47546
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47546&view=rev
Author:   lordhoto
Date:     2010-01-25 02:48:35 +0000 (Mon, 25 Jan 2010)

Log Message:
-----------
- Remove "(experimental)" mark from DOSBox OPL emulator description in GUI
- Merge in some small OPL emulator changes from DOSBox's trunk

Modified Paths:
--------------
    scummvm/trunk/sound/fmopl.cpp
    scummvm/trunk/sound/softsynth/opl/dosbox.cpp
    scummvm/trunk/sound/softsynth/opl/opl_impl.h
    scummvm/trunk/sound/softsynth/opl/opl_inc.h

Modified: scummvm/trunk/sound/fmopl.cpp
===================================================================
--- scummvm/trunk/sound/fmopl.cpp	2010-01-25 02:37:10 UTC (rev 47545)
+++ scummvm/trunk/sound/fmopl.cpp	2010-01-25 02:48:35 UTC (rev 47546)
@@ -43,7 +43,7 @@
 	{ "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 }
 };

Modified: scummvm/trunk/sound/softsynth/opl/dosbox.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/opl/dosbox.cpp	2010-01-25 02:37:10 UTC (rev 47545)
+++ scummvm/trunk/sound/softsynth/opl/dosbox.cpp	2010-01-25 02:48:35 UTC (rev 47546)
@@ -177,7 +177,7 @@
 
 	uint32 writeAddr(uint32 port, uint8 val) {
 		adlib_write_index(port, val);
-		return index;
+		return opl_index;
 	}
 
 	void generate(int16 *chan, uint samples) {

Modified: scummvm/trunk/sound/softsynth/opl/opl_impl.h
===================================================================
--- scummvm/trunk/sound/softsynth/opl/opl_impl.h	2010-01-25 02:37:10 UTC (rev 47545)
+++ scummvm/trunk/sound/softsynth/opl/opl_impl.h	2010-01-25 02:48:35 UTC (rev 47546)
@@ -56,7 +56,7 @@
 	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 @@
 };
 
 // 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 @@
 				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 @@
 		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 @@
 	}
 
 	status = 0;
-	index = 0;
+	opl_index = 0;
 
 
 	// create vibrato table
@@ -552,9 +562,9 @@
 			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 @@
 }
 
 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
 }

Modified: scummvm/trunk/sound/softsynth/opl/opl_inc.h
===================================================================
--- scummvm/trunk/sound/softsynth/opl/opl_inc.h	2010-01-25 02:37:10 UTC (rev 47545)
+++ scummvm/trunk/sound/softsynth/opl/opl_inc.h	2010-01-25 02:48:35 UTC (rev 47546)
@@ -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 @@
 	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 @@
 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list