VirtualBox

Changeset 20260 in vbox


Ignore:
Timestamp:
Jun 4, 2009 10:12:12 AM (16 years ago)
Author:
vboxsync
Message:

Main: added default audio driver method to ISystemProperties

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/AudioAdapterImpl.cpp

    r19058 r20260  
    6363    AssertReturn (autoInitSpan.isOk(), E_FAIL);
    6464
     65    /* Get the default audio driver out of the system properties */
     66    ComPtr<IVirtualBox> VBox;
     67    HRESULT rc = aParent->COMGETTER(Parent)(VBox.asOutParam());
     68    if (FAILED(rc)) return rc;
     69    ComPtr<ISystemProperties> sysProps;
     70    rc = VBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
     71    if (FAILED(rc)) return rc;
     72    AudioDriverType_T defaultAudioDriver;
     73    rc = sysProps->COMGETTER(DefaultAudioDriver)(&defaultAudioDriver);
     74    if (FAILED(rc)) return rc;
     75
    6576    unconst (mParent) = aParent;
    6677    /* mPeer is left null */
    6778
    6879    mData.allocate();
     80    mData->mAudioDriver = defaultAudioDriver;
    6981
    7082    /* Confirm a successful initialization */
     
    339351    mEnabled = false;
    340352    mAudioController = AudioControllerType_AC97;
    341     /* Driver defaults which are OS specific */
    342 #if defined (RT_OS_WINDOWS)
    343 # ifdef VBOX_WITH_WINMM
    344     mAudioDriver = AudioDriverType_WinMM;
    345 # else /* VBOX_WITH_WINMM */
    346     mAudioDriver = AudioDriverType_DirectSound;
    347 # endif /* !VBOX_WITH_WINMM */
    348 #elif defined (RT_OS_SOLARIS)
    349     mAudioDriver = AudioDriverType_SolAudio;
    350 #elif defined (RT_OS_LINUX)
    351 # if defined (VBOX_WITH_PULSE)
    352     /* Check for the pulse library & that the pulse audio daemon is running. */
    353     if (RTProcIsRunningByName ("pulseaudio") &&
    354         RTLdrIsLoadable ("libpulse.so.0"))
    355         mAudioDriver = AudioDriverType_Pulse;
    356     else
    357 # endif /* VBOX_WITH_PULSE */
    358 # if defined (VBOX_WITH_ALSA)
    359         /* Check if we can load the ALSA library */
    360         if (RTLdrIsLoadable ("libasound.so.2"))
    361             mAudioDriver = AudioDriverType_ALSA;
    362         else
    363 # endif /* VBOX_WITH_ALSA */
    364             mAudioDriver = AudioDriverType_OSS;
    365 #elif defined (RT_OS_DARWIN)
    366     mAudioDriver = AudioDriverType_CoreAudio;
    367 #elif defined (RT_OS_OS2)
    368     mAudioDriver = AudioDriverType_MMP;
    369 #elif defined (RT_OS_FREEBSD)
    370     mAudioDriver = AudioDriverType_OSS;
    371 #else
     353    /* Driver defaults to the null audio driver */
    372354    mAudioDriver = AudioDriverType_Null;
    373 #endif
    374355}
    375356
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r19727 r20260  
    3232#include <iprt/path.h>
    3333#include <iprt/dir.h>
     34#include <iprt/process.h>
    3435
    3536#include <VBox/err.h>
     
    113114    }
    114115
     116    /* Driver defaults which are OS specific */
     117#if defined (RT_OS_WINDOWS)
     118# ifdef VBOX_WITH_WINMM
     119    mDefaultAudioDriver = AudioDriverType_WinMM;
     120# else /* VBOX_WITH_WINMM */
     121    mDefaultAudioDriver = AudioDriverType_DirectSound;
     122# endif /* !VBOX_WITH_WINMM */
     123#elif defined (RT_OS_SOLARIS)
     124    mDefaultAudioDriver = AudioDriverType_SolAudio;
     125#elif defined (RT_OS_LINUX)
     126# if defined (VBOX_WITH_PULSE)
     127    /* Check for the pulse library & that the pulse audio daemon is running. */
     128    if (RTProcIsRunningByName ("pulseaudio") &&
     129        RTLdrIsLoadable ("libpulse.so.0"))
     130        mDefaultAudioDriver = AudioDriverType_Pulse;
     131    else
     132# endif /* VBOX_WITH_PULSE */
     133# if defined (VBOX_WITH_ALSA)
     134        /* Check if we can load the ALSA library */
     135        if (RTLdrIsLoadable ("libasound.so.2"))
     136            mDefaultAudioDriver = AudioDriverType_ALSA;
     137        else
     138# endif /* VBOX_WITH_ALSA */
     139            mDefaultAudioDriver = AudioDriverType_OSS;
     140#elif defined (RT_OS_DARWIN)
     141    mDefaultAudioDriver = AudioDriverType_CoreAudio;
     142#elif defined (RT_OS_OS2)
     143    mDefaultAudioDriver = AudioDriverType_MMP;
     144#elif defined (RT_OS_FREEBSD)
     145    mDefaultAudioDriver = AudioDriverType_OSS;
     146#else
     147    mDefaultAudioDriver = AudioDriverType_Null;
     148#endif
     149
    115150    /* Confirm a successful initialization */
    116151    if (SUCCEEDED (rc))
     
    540575}
    541576
     577STDMETHODIMP SystemProperties::COMGETTER(DefaultAudioDriver) (AudioDriverType_T *aAudioDriver)
     578{
     579    if (!aAudioDriver)
     580        return E_POINTER;
     581
     582    AutoCaller autoCaller (this);
     583    CheckComRCReturnRC (autoCaller.rc());
     584
     585    AutoReadLock alock (this);
     586
     587    *aAudioDriver = mDefaultAudioDriver;
     588
     589    return S_OK;
     590}
     591
    542592// public methods only for internal purposes
    543593/////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r20220 r20260  
    74917491     name="ISystemProperties"
    74927492     extends="$unknown"
    7493      uuid="0760e03f-06d0-481e-9f81-be43fef092ba"
     7493     uuid="63bfd184-df69-4949-9159-a923cf7b1207"
    74947494     wsmap="managed"
    74957495     >
     
    77567756        This value specifies how many old release log files are kept.
    77577757       </desc>
     7758    </attribute>
     7759
     7760    <attribute name="defaultAudioDriver" type="AudioDriverType" readonly="yes">
     7761      <desc>This value hold the default audio driver for the current
     7762      system.</desc>
    77587763    </attribute>
    77597764  </interface>
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r19239 r20260  
    9393    STDMETHOD(COMGETTER(LogHistoryCount)) (ULONG *count);
    9494    STDMETHOD(COMSETTER(LogHistoryCount)) (ULONG count);
     95    STDMETHOD(COMGETTER(DefaultAudioDriver)) (AudioDriverType_T *aAudioDriver);
    9596
    9697    // public methods only for internal purposes
     
    144145    BOOL mHWVirtExEnabled;
    145146    ULONG mLogHistoryCount;
     147    AudioDriverType_T mDefaultAudioDriver;
    146148};
    147149
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