- Timestamp:
- Dec 7, 2018 10:51:32 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHDACommon.h
r76019 r76049 96 96 * a higher Hz rate, as the device emulation otherwise will come into 97 97 * timing trouble, making the output (DMA reads) crackling. */ 98 #define HDA_TIMER_HZ_DEFAULT 20098 #define HDA_TIMER_HZ_DEFAULT 100 99 99 100 100 /** Default position adjustment (in audio samples). -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r76045 r76049 239 239 AssertRCReturn(rc, rc); 240 240 241 /* 242 * Set the stream's timer Hz rate, based on the stream channel count. 243 * Currently this is just a rough guess and we might want to optimize this further. 244 * 245 * In any case, more channels per SDI/SDO means that we have to drive data more frequently. 246 */ 247 if (pThis->uTimerHz == HDA_TIMER_HZ_DEFAULT) /* Make sure that we don't have any custom Hz rate set we want to enforce */ 248 { 249 if (Props.cChannels >= 5) 250 pStream->State.uTimerHz = 300; 251 else if (Props.cChannels == 4) 252 pStream->State.uTimerHz = 150; 253 else 254 pStream->State.uTimerHz = 100; 255 } 256 else 257 pStream->State.uTimerHz = pThis->uTimerHz; 258 241 259 #ifndef VBOX_WITH_AUDIO_HDA_51_SURROUND 242 260 if (Props.cChannels > 2) … … 329 347 { 330 348 /* Make sure that the chosen Hz rate dividable by the stream's rate. */ 331 if (pStream->State.Cfg.Props.uHz % p This->uTimerHz != 0)332 LogRel(("HDA: Device timer(%RU32) does not fit to stream #%RU8 timing (%RU32)\n",333 p This->uTimerHz, pStream->u8SD, pStream->State.Cfg.Props.uHz));349 if (pStream->State.Cfg.Props.uHz % pStream->State.uTimerHz != 0) 350 LogRel(("HDA: Stream timer Hz rate (%RU32) does not fit to stream #%RU8 timing (%RU32)\n", 351 pStream->State.uTimerHz, pStream->u8SD, pStream->State.Cfg.Props.uHz)); 334 352 335 353 /* Figure out how many transfer fragments we're going to use for this stream. */ … … 427 445 /* Calculate the bytes we need to transfer to / from the stream's DMA per iteration. 428 446 * This is bound to the device's Hz rate and thus to the (virtual) timing the device expects. */ 429 pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / p This->uTimerHz) * pStream->State.Mapping.cbFrameSize;447 pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / pStream->State.uTimerHz) * pStream->State.Mapping.cbFrameSize; 430 448 Assert(pStream->State.cbTransferChunk); 431 449 Assert(pStream->State.cbTransferChunk % pStream->State.Mapping.cbFrameSize == 0); … … 435 453 pStream->State.cbTransferChunk = pStream->State.cbTransferSize; 436 454 437 const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / p This->uTimerHz;455 const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pStream->State.uTimerHz; 438 456 439 457 /* Calculate the timer ticks per byte for this stream. */ … … 447 465 LogFunc(("[SD%RU8] Timer %uHz (%RU64 ticks per Hz), cTicksPerByte=%RU64, cbTransferChunk=%RU32, cTransferTicks=%RU64, " \ 448 466 "cbTransferSize=%RU32\n", 449 pStream->u8SD, p This->uTimerHz, cTicksPerHz, pStream->State.cTicksPerByte,467 pStream->u8SD, pStream->State.uTimerHz, cTicksPerHz, pStream->State.cTicksPerByte, 450 468 pStream->State.cbTransferChunk, pStream->State.cTransferTicks, pStream->State.cbTransferSize)); 451 469 -
trunk/src/VBox/Devices/Audio/HDAStream.h
r76018 r76049 150 150 * BDLE interrupt-on-completion (IOC) bits set. */ 151 151 uint8_t cTransferPendingInterrupts; 152 uint8_t Padding2[4]; 152 uint8_t Padding2[2]; 153 /** The stream's timer Hz rate. 154 * This value can can be different from the device's default Hz rate, 155 * depending on the rate the stream expects (e.g. for 5.1 speaker setups). 156 * Set in hdaR3StreamInit(). */ 157 uint16_t uTimerHz; 153 158 /** Number of audio data frames for the position adjustment. 154 159 * 0 if no position adjustment is needed. */
Note:
See TracChangeset
for help on using the changeset viewer.