1
0
Fork 0

Always use the volume table

Replace the ultradir char buf with a std::string


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3357
This commit is contained in:
Sjoerd van der Berg 2009-04-26 10:36:16 +00:00
parent caeec288c2
commit 423fe84280

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: gus.cpp,v 1.34 2009-04-11 08:02:23 qbix79 Exp $ */
/* $Id: gus.cpp,v 1.35 2009-04-26 10:36:16 harekiet Exp $ */
#include <string.h>
#include <iomanip>
@ -43,8 +43,6 @@ using namespace std;
#define RAMP_FRACT (10)
#define RAMP_FRACT_MASK ((1 << RAMP_FRACT)-1)
#define USEVOLTABLE 1
#define GUS_BASE myGUS.portbase
#define GUS_RATE myGUS.rate
#define LOG_GUS 0
@ -54,10 +52,8 @@ static MixerChannel * gus_chan;
static Bit8u irqtable[8] = { 0, 2, 5, 3, 7, 11, 12, 15 };
static Bit8u dmatable[8] = { 0, 1, 3, 5, 6, 7, 0, 0 };
static Bit8u GUSRam[1024*1024]; // 1024K of GUS Ram
static Bit32s AutoAmp=512;
#if USEVOLTABLE
static Bit32s AutoAmp = 512;
static Bit16u vol16bit[4096];
#endif
static Bit32u pantable[16];
class GUSChannels;
@ -93,7 +89,7 @@ struct GFGus {
Bit8u irq1;
Bit8u irq2;
char ultradir[512];
std::string ultradir;
bool irqenabled;
bool ChangeIRQDMA;
// IRQ status register values
@ -272,12 +268,8 @@ public:
templeft&=~(templeft >> 31);
Bit32s tempright=RampVol - PanRight;
tempright&=~(tempright >> 31);
#if USEVOLTABLE
VolLeft=vol16bit[templeft >> RAMP_FRACT];
VolRight=vol16bit[tempright >> RAMP_FRACT];
#else
#endif
}
INLINE void RampUpdate(void) {
/* Check if ramping enabled */
@ -772,13 +764,11 @@ static void GUS_CallBack(Bitu len) {
// Generate logarithmic to linear volume conversion tables
static void MakeTables(void) {
int i;
#if USEVOLTABLE
double out = (double)(1 << 13);
for (i=4095;i>=0;i--) {
vol16bit[i]=(Bit16s)out;
out/=1.002709201; /* 0.0235 dB Steps */
}
#endif
pantable[0]=0;
for (i=1;i<16;i++) {
pantable[i]=(Bit32u)(-128.0*(log((double)i/15.0)/log(2.0))*(double)(1 << RAMP_FRACT));
@ -812,7 +802,7 @@ public:
myGUS.irq1 = (Bit8u)irq_val;
myGUS.irq2 = (Bit8u)irq_val;
strcpy(&myGUS.ultradir[0], section->Get_string("ultradir"));
myGUS.ultradir = section->Get_string("ultradir");
// We'll leave the MIDI interface to the MPU-401
// Ditto for the Joystick