VirtualBox

Changeset 56278 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 8, 2015 5:21:10 PM (9 years ago)
Author:
vboxsync
Message:

SB16: Corrected SBP->SB16 volume conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r56085 r56278  
    13351335}
    13361336
     1337/* Convert SB Pro to SB16 mixer volume (left + right). */
     1338static inline void sb16ConvVolumeOldToNew(PSB16STATE pThis, unsigned reg, uint8_t val)
     1339{
     1340    /* Left channel. */
     1341    pThis->mixer_regs[reg + 0] = (val & 0xf0) | RT_BIT(3);
     1342    /* Right channel (the register immediately following). */
     1343    pThis->mixer_regs[reg + 1] = (val << 4)   | RT_BIT(3);
     1344}
     1345
    13371346static IO_WRITE_PROTO(mixer_write_datab)
    13381347{
     
    13531362            break;
    13541363
    1355         case 0x04:
    1356             /* Translate from old style stream volume (L/R). */
    1357             pThis->mixer_regs[0x32] = (val & 0xf0) >> 3;
    1358             pThis->mixer_regs[0x33] = (val & 0x0f) << 1;
     1364        case 0x04:  /* Translate from old style voice volume (L/R). */
     1365            sb16ConvVolumeOldToNew(pThis, 0x32, val);
    13591366            fUpdateStream = true;
    13601367            break;
    13611368
    1362         case 0x22:
    1363             /* Translate from old style master volume (L/R). */
    1364             pThis->mixer_regs[0x30] = (val & 0xf0) >> 3;
    1365             pThis->mixer_regs[0x31] = (val & 0x0f) << 1;
     1369        case 0x22:  /* Translate from old style master volume (L/R). */
     1370            sb16ConvVolumeOldToNew(pThis, 0x30, val);
    13661371            fUpdateMaster = true;
    13671372            break;
    13681373
    1369         case 0x26:
    1370             /* Translate from old style MIDI volume (L/R). */
    1371             pThis->mixer_regs[0x34] = (val & 0xf0) >> 3;
    1372             pThis->mixer_regs[0x35] = (val & 0x0f) << 1;
    1373             break;
    1374 
    1375         case 0x28:
    1376             /* Translate from old style CD volume (L/R). */
    1377             pThis->mixer_regs[0x36] = (val & 0xf0) >> 3;
    1378             pThis->mixer_regs[0x37] = (val & 0x0f) << 1;
    1379             break;
    1380 
    1381         case 0x2E:
    1382             /* Translate from old style line volume (L/R). */
    1383             pThis->mixer_regs[0x38] = (val & 0xf0) >> 3;
    1384             pThis->mixer_regs[0x39] = (val & 0x0f) << 1;
     1374        case 0x26:  /* Translate from old style MIDI volume (L/R). */
     1375            sb16ConvVolumeOldToNew(pThis, 0x34, val);
     1376            break;
     1377
     1378        case 0x28:  /* Translate from old style CD volume (L/R). */
     1379            sb16ConvVolumeOldToNew(pThis, 0x36, val);
     1380            break;
     1381
     1382        case 0x2E:  /* Translate from old style line volume (L/R). */
     1383            sb16ConvVolumeOldToNew(pThis, 0x38, val);
    13851384            break;
    13861385
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette