Changeset 89768 in vbox for trunk/src/VBox/Devices/Audio/DevSB16.cpp
- Timestamp:
- Jun 17, 2021 11:03:19 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r89379 r89768 1183 1183 * @param pVol Where to store the master volume information. 1184 1184 */ 1185 static voidsb16GetMasterVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)1185 DECLINLINE(void) sb16GetMasterVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol) 1186 1186 { 1187 1187 /* There's no mute switch, only volume controls. */ 1188 uint8_t lvol = sb16MixRegToVol(pThis, 0x30); 1189 uint8_t rvol = sb16MixRegToVol(pThis, 0x31); 1190 1191 pVol->fMuted = false; 1192 pVol->uLeft = lvol; 1193 pVol->uRight = rvol; 1188 PDMAudioVolumeInitFromStereo(pVol, false /*fMuted*/, sb16MixRegToVol(pThis, 0x30), sb16MixRegToVol(pThis, 0x31)); 1194 1189 } 1195 1190 … … 1200 1195 * @param pVol Where to store the output stream volume information. 1201 1196 */ 1202 static voidsb16GetPcmOutVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)1197 DECLINLINE(void) sb16GetPcmOutVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol) 1203 1198 { 1204 1199 /* There's no mute switch, only volume controls. */ 1205 uint8_t lvol = sb16MixRegToVol(pThis, 0x32); 1206 uint8_t rvol = sb16MixRegToVol(pThis, 0x33); 1207 1208 pVol->fMuted = false; 1209 pVol->uLeft = lvol; 1210 pVol->uRight = rvol; 1200 PDMAudioVolumeInitFromStereo(pVol, false /*fMuted*/, sb16MixRegToVol(pThis, 0x32), sb16MixRegToVol(pThis, 0x33)); 1211 1201 } 1212 1202 … … 1221 1211 /* Combine the master + output stream volume. */ 1222 1212 PDMAUDIOVOLUME VolCombined; 1223 RT_ZERO(VolCombined); 1224 1225 VolCombined.fMuted = VolMaster.fMuted || VolOut.fMuted; 1226 if (!VolCombined.fMuted) 1227 { 1228 VolCombined.uLeft = ( (VolOut.uLeft ? VolOut.uLeft : 1) 1229 * (VolMaster.uLeft ? VolMaster.uLeft : 1)) / PDMAUDIO_VOLUME_MAX; 1230 1231 VolCombined.uRight = ( (VolOut.uRight ? VolOut.uRight : 1) 1232 * (VolMaster.uRight ? VolMaster.uRight : 1)) / PDMAUDIO_VOLUME_MAX; 1233 } 1213 PDMAudioVolumeCombine(&VolCombined, &VolMaster, &VolOut); 1234 1214 1235 1215 int rc2 = AudioMixerSinkSetVolume(pThis->pSinkOut, &VolCombined);
Note:
See TracChangeset
for help on using the changeset viewer.