VirtualBox

Changeset 65022 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 29, 2016 9:42:39 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112517
Message:

Audio/DevHDA.cpp: Split out the device timer's main code into hdaTimerMain().

File:
1 edited

Legend:

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

    r65018 r65022  
    10651065static void          hdaTimerMaybeStart(PHDASTATE pThis);
    10661066static void          hdaTimerMaybeStop(PHDASTATE pThis);
     1067static void          hdaTimerMain(PHDASTATE pThis);
    10671068#endif
    10681069/** @} */
     
    38963897
    38973898#ifndef VBOX_WITH_AUDIO_HDA_CALLBACKS
     3899/**
     3900 * Starts the internal audio device timer (if not started yet).
     3901 *
     3902 * @param   pThis               HDA state.
     3903 */
    38983904static void hdaTimerMaybeStart(PHDASTATE pThis)
    38993905{
     
    39173923
    39183924        /* Start transfers. */
    3919         hdaDoTransfers(pThis);
    3920     }
    3921 }
    3922 
     3925        hdaTimerMain(pThis);
     3926    }
     3927}
     3928
     3929/**
     3930 * Stops the internal audio device timer (if not stopped yet).
     3931 *
     3932 * @param   pThis               HDA state.
     3933 */
    39233934static void hdaTimerStop(PHDASTATE pThis)
    39243935{
     
    39433954}
    39443955
    3945 static void hdaDoTransfers(PHDASTATE pThis)
     3956/**
     3957 * Main routine for the device timer.
     3958 *
     3959 * @returns IPRT status code.
     3960 * @param   pThis               HDA state.
     3961 */
     3962static void hdaTimerMain(PHDASTATE pThis)
    39463963{
    39473964    AssertPtrReturnVoid(pThis);
     
    39603977    bool fKickTimer = false;
    39613978
    3962     PHDASTREAM pStreamLineIn  = hdaSinkGetStream(pThis, &pThis->SinkLineIn);
    3963 #ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    3964     PHDASTREAM pStreamMicIn   = hdaSinkGetStream(pThis, &pThis->SinkMicIn);
    3965 #endif
    3966     PHDASTREAM pStreamFront   = hdaSinkGetStream(pThis, &pThis->SinkFront);
    3967 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    3968     /** @todo See note below. */
    3969 #endif
    3970 
    3971     hdaStreamUpdate(pThis, pStreamLineIn);
    3972 #ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    3973     hdaStreamUpdate(pThis, pStreamMicIn);
    3974 #endif
    3975     hdaStreamUpdate(pThis, pStreamFront);
    3976 
    3977 
    3978 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    3979     int rc2 = AudioMixerSinkUpdate(pThis->SinkCenterLFE.pMixSink);
    3980     AssertRC(rc2);
    3981 
    3982     rc2 = AudioMixerSinkUpdate(pThis->SinkRear.pMixSink);
    3983     AssertRC(rc2);
    3984     /** @todo Check for stream interleaving and only call hdaStreamDoDMA() if required! */
    3985 
    3986     /*
    3987      * Only call hdaTransfer if CenterLFE and/or Rear are on different SDs,
    3988      * otherwise we have to use the interleaved streams support for getting the data
    3989      * out of the Front sink (depending on the mapping layout).
    3990      */
    3991 #endif
     3979    hdaDoTransfers(pThis);
    39923980
    39933981    /* Do we need to kick the timer again? */
     
    40224010}
    40234011
     4012/**
     4013 * Timer callback which handles the audio data transfers on a periodic basis.
     4014 *
     4015 * @param   pDevIns             Device instance.
     4016 * @param   pTimer              Timer which was used when calling this.
     4017 * @param   pvUser              User argument as PHDASTATE.
     4018 */
    40244019static DECLCALLBACK(void) hdaTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    40254020{
     
    40304025    AssertPtr(pThis);
    40314026
    4032     hdaDoTransfers(pThis);
     4027    hdaTimerMain(pThis);
    40334028}
    40344029
     
    40824077}
    40834078#endif /* VBOX_WITH_AUDIO_HDA_CALLBACKS */
     4079
     4080/**
     4081 * Main routine to perform the actual audio data transfers from the HDA streams
     4082 * to the backend(s) and vice versa.
     4083 *
     4084 * @param   pThis               HDA state.
     4085 */
     4086static void hdaDoTransfers(PHDASTATE pThis)
     4087{
     4088    PHDASTREAM pStreamLineIn  = hdaSinkGetStream(pThis, &pThis->SinkLineIn);
     4089#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
     4090    PHDASTREAM pStreamMicIn   = hdaSinkGetStream(pThis, &pThis->SinkMicIn);
     4091#endif
     4092    PHDASTREAM pStreamFront   = hdaSinkGetStream(pThis, &pThis->SinkFront);
     4093#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     4094    /** @todo See note below. */
     4095#endif
     4096
     4097    hdaStreamUpdate(pThis, pStreamLineIn);
     4098#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
     4099    hdaStreamUpdate(pThis, pStreamMicIn);
     4100#endif
     4101    hdaStreamUpdate(pThis, pStreamFront);
     4102
     4103
     4104#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     4105    int rc2 = AudioMixerSinkUpdate(pThis->SinkCenterLFE.pMixSink);
     4106    AssertRC(rc2);
     4107
     4108    rc2 = AudioMixerSinkUpdate(pThis->SinkRear.pMixSink);
     4109    AssertRC(rc2);
     4110    /** @todo Check for stream interleaving and only call hdaStreamDoDMA() if required! */
     4111
     4112    /*
     4113     * Only call hdaTransfer if CenterLFE and/or Rear are on different SDs,
     4114     * otherwise we have to use the interleaved streams support for getting the data
     4115     * out of the Front sink (depending on the mapping layout).
     4116     */
     4117#endif
     4118}
    40844119
    40854120#ifdef DEBUG_andy
     
    47634798            RTCircBufReleaseReadBlock(pCircBuf, cbDMA);
    47644799
     4800            /* All DMA transfers done for now? */
    47654801            if (!cbDMA)
    47664802                fDone = true;
Note: See TracChangeset for help on using the changeset viewer.

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