VirtualBox

Changeset 3214 in vbox


Ignore:
Timestamp:
Jun 21, 2007 3:00:08 PM (17 years ago)
Author:
vboxsync
Message:

if no audio voice could be opened choose the NULL audio backend

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

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

    r2981 r3214  
    15861586{
    15871587    PCIAC97LinkState *pData = PDMINS2DATA(pDevIns, PCIAC97LinkState *);
     1588    AC97LinkState    *s     = &pData->ac97;
    15881589    int               rc;
    15891590
     
    15931594     * Initialize data (most of it anyway).
    15941595     */
    1595     pData->ac97.pDevIns                      = pDevIns;
     1596    s->pDevIns                  = pDevIns;
    15961597    /* IBase */
    1597     pData->ac97.IBase.pfnQueryInterface      = ichac97QueryInterface;
     1598    s->IBase.pfnQueryInterface  = ichac97QueryInterface;
    15981599
    15991600    /* PCI Device */
     
    16651666     * Attach driver.
    16661667     */
    1667     rc = PDMDevHlpDriverAttach (pDevIns, 0, &pData->ac97.IBase,
    1668                                 &pData->ac97.pDrvBase, "Audio Driver Port");
     1668    rc = PDMDevHlpDriverAttach (pDevIns, 0, &s->IBase,
     1669                                &s->pDrvBase, "Audio Driver Port");
    16691670    if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    16701671        Log (("ac97: No attached driver!\n"));
     
    16751676    }
    16761677
    1677     AUD_register_card ("ICH0", &pData->ac97.card);
     1678    AUD_register_card ("ICH0", &s->card);
    16781679
    16791680    ac97Reset(pDevIns);
    16801681
    1681     /**
    1682      * @todo We should probably display a message box. And perhaps we should
    1683      *       select the noaudio driver instead.
    1684      */
    16851682#ifndef __DARWIN__ /* coreaudio doesn't supply these. */
    1686     if (!pData->ac97.voice_pi)
     1683    if (!s->voice_pi)
    16871684        LogRel(("AC97: WARNING: Unable to open PCM IN!\n"));
    1688     if (!pData->ac97.voice_mc)
     1685    if (!s->voice_mc)
    16891686        LogRel(("AC97: WARNING: Unable to open PCM MC!\n"));
    16901687#endif
    1691     if (!pData->ac97.voice_po)
     1688    if (!s->voice_po)
    16921689        LogRel(("AC97: WARNING: Unable to open PCM OUT!\n"));
    16931690
    1694 #ifdef __DARWIN__ /* coreaudio doesn't supply all, only bitch if we don't get anything. */
    1695     if (!pData->ac97.voice_pi && !pData->ac97.voice_po && !pData->ac97.voice_mc)
    1696 #else
    1697     if (!pData->ac97.voice_pi || !pData->ac97.voice_po || !pData->ac97.voice_mc)
    1698 #endif
    1699         VMSetRuntimeError(PDMDevHlpGetVM(pDevIns), false,
    1700                           "HostAudioNotResponding",
    1701                           N_("Some audio devices could not be opened. Guest applications "
    1702                              "generating audio output or depending on audio input may hang. "
    1703                              "Make sure your host audio device is working properly. Check "
    1704                              "the logfile for error messages of the audio subsystem."));
     1691    if (!s->voice_pi && !s->voice_po && !s->voice_mc)
     1692    {
     1693        /* Was not able initialize *any* voice. Select the NULL audio driver instead */
     1694        AUD_close_in  (&s->card, s->voice_pi);
     1695        AUD_close_out (&s->card, s->voice_po);
     1696        AUD_close_in  (&s->card, s->voice_mc);
     1697        s->voice_po = NULL;
     1698        s->voice_pi = NULL;
     1699        s->voice_mc = NULL;
     1700        AUD_init_null();
     1701        ac97Reset(pDevIns);
     1702
     1703        PDMDevHlpVMSetRuntimeError(pDevIns, false, "HostAudioNotResponding",
     1704             N_("No audio devices could not be opened. Selecting the NULL audio backend "
     1705                "with the consequence that no sound is audible."));
     1706    }
     1707#ifndef __DARWIN__
     1708    else if (!s->voice_pi || !s->voice_po || !s->voice_mc)
     1709    {
     1710        char   szMissingVoices[128];
     1711        size_t len = 0;
     1712        bool   fComma = false;
     1713        if (!s->voice_pi)
     1714        {
     1715            len = RTStrPrintf(szMissingVoices, sizeof(szMissingVoices), "PCM_in");
     1716            fComma = true;
     1717        }
     1718        if (!s->voice_po)
     1719        {
     1720            len = RTStrPrintf(szMissingVoices + len, sizeof(szMissingVoices)-len, "%sPCM_out",
     1721                              fComma ? ", " : "");
     1722            fComma = true;
     1723        }
     1724        if (!s->voice_mc)
     1725        {
     1726            len = RTStrPrintf(szMissingVoices + len, sizeof(szMissingVoices)-len, "%sPCM_mic",
     1727                              fComma ? ", " : "");
     1728        }
     1729
     1730        PDMDevHlpVMSetRuntimeError(pDevIns, false, "HostAudioNotResponding",
     1731             N_("Some audio devices (%s) could not be opened. Guest applications generating audio "
     1732                "output or depending on audio input may hang. Make sure your host audio device "
     1733                "is working properly. Check the logfile for error messages of the audio "
     1734                "subsystem."), szMissingVoices);
     1735    }
     1736#endif
    17051737
    17061738    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Audio/audio.c

    r2980 r3214  
    15991599    TMTimerSet (s->ts, TMTimerGet (s->ts) + conf.period.ticks);
    16001600    return VINF_SUCCESS;
     1601}
     1602
     1603int AUD_init_null(void)
     1604{
     1605    AudioState *s = &glob_audio_state;
     1606
     1607    return audio_driver_init (s, &no_audio_driver);
    16011608}
    16021609
  • trunk/src/VBox/Devices/Audio/audio.h

    r1636 r3214  
    162162void AUD_set_record_source (audrecsource_t *ars, audrecsource_t *als);
    163163
     164int  AUD_init_null(void);
     165
    164166static inline void *advance (void *p, int incr)
    165167{
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