ymz774: calculate volume table

This commit is contained in:
MetalliC 2019-04-15 13:33:54 +03:00
parent cb274f261a
commit 90b7ccb22b
2 changed files with 9 additions and 12 deletions

View File

@ -468,20 +468,16 @@ void ymz770_device::internal_reg_write(uint8_t reg, uint8_t data)
ymz774_device::ymz774_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ymz770_device(mconfig, YMZ774, tag, owner, clock, 44100)
{
// calculate volume increments, fixed point values, fractions of 0x20000
for (u32 i = 0; i < 256; i++)
{
if (i < 0x20)
volinc[i] = i;
else
volinc[i] = (0x20 | (i & 0x1f)) << ((i >> 5) - 1);
}
}
// volume increments, fractions of 0x20000, likely typical for Yamaha log-linear
static const uint32_t volinc[256] = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,
128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,
256,264,272,280,288,296,304,312,320,328,336,344,351,360,368,376,384,392,400,408,416,424,432,440,448,456,464,471,480,488,495,504,
511,528,543,559,576,592,608,624,639,656,671,688,703,719,736,752,767,783,799,815,831,847,863,879,895,910,928,942,958,975,991,1006,
1023,1054,1087,1119,1149,1181,1215,1247,1277,1312,1340,1373,1404,1436,1469,1504,1534,1566,1598,1626,1661,1691,1721,1753,1786,1820,1856,1883,1912,1951,1981,2013,
2045,2102,2174,2238,2292,2363,2423,2487,2553,2624,2679,2737,2797,2860,2926,2996,3068,3118,3197,3252,3308,3367,3427,3490,3555,3623,3694,3767,3804,3882,3963,4005
};
READ8_MEMBER(ymz774_device::read)
{
if (offset & 1)

View File

@ -122,6 +122,7 @@ protected:
virtual void sequencer() override;
private:
int m_bank;
uint32_t volinc[256];
};
// device type definition