VirtualBox

Changeset 56459 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Jun 16, 2015 4:24:14 PM (10 years ago)
Author:
vboxsync
Message:

Main: Added audio codec type property, including recommended type.

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r56096 r56459  
    3939    AudioDriverType_T mAudioDriver;
    4040    AudioControllerType_T mAudioController;
     41    AudioCodecType_T mAudioCodec;
    4142    settings::StringsMap  properties;
    4243};
     
    348349}
    349350
     351HRESULT AudioAdapter::getAudioCodec(AudioCodecType_T *aAudioCodec)
     352{
     353    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     354
     355    *aAudioCodec = mData->m->mAudioCodec;
     356
     357    return S_OK;
     358}
     359
     360HRESULT AudioAdapter::setAudioCodec(AudioCodecType_T aAudioCodec)
     361{
     362    /* the machine needs to be mutable */
     363    AutoMutableStateDependency adep(mParent);
     364    if (FAILED(adep.rc())) return adep.rc();
     365
     366    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     367
     368    HRESULT rc = S_OK;
     369
     370    /*
     371     * which audio hardware type are we supposed to use?
     372     */
     373    switch (mData->m->mAudioController)
     374    {
     375        case AudioControllerType_AC97:
     376        {
     377            if (   (aAudioCodec != AudioCodecType_STAC9700)
     378                && (aAudioCodec != AudioCodecType_AD1980))
     379                rc = E_INVALIDARG;
     380            break;
     381        }
     382
     383        case AudioControllerType_SB16:
     384        {
     385            if (aAudioCodec != AudioCodecType_SB16)
     386                rc = E_INVALIDARG;
     387            break;
     388        }
     389
     390        case AudioControllerType_HDA:
     391        {
     392            if (aAudioCodec != AudioCodecType_STAC9221)
     393                rc = E_INVALIDARG;
     394            break;
     395        }
     396
     397        default:
     398            AssertMsgFailed (("Wrong audio controller type %d\n",
     399                              mData->m->mAudioController));
     400            rc = E_FAIL;
     401    }
     402
     403    if (!SUCCEEDED(rc))
     404        return setError(rc,
     405                        tr ("Invalid audio codec type %d"),
     406                        aAudioCodec);
     407
     408    if (mData->m->mAudioCodec != aAudioCodec)
     409    {
     410        mData->m.backup();
     411        mData->m->mAudioCodec = aAudioCodec;
     412        alock.release();
     413        AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
     414        mParent->i_setModified(Machine::IsModified_AudioAdapter);
     415    }
     416
     417    return rc;
     418}
     419
    350420HRESULT AudioAdapter::getPropertiesList(std::vector<com::Utf8Str>& aProperties)
    351421{
  • trunk/src/VBox/Main/src-server/GuestOSTypeImpl.cpp

    r55401 r56459  
    3838    , mChipsetType(ChipsetType_PIIX3)
    3939    , mAudioControllerType(AudioControllerType_AC97)
     40    , mAudioCodecType(AudioCodecType_STAC9700)
    4041{
    4142}
     
    126127    unconst(mChipsetType)               = ostype.chipsetType;
    127128    unconst(mAudioControllerType)       = ostype.audioControllerType;
     129    unconst(mAudioCodecType)            = ostype.audioCodecType;
    128130
    129131    /* Confirm a successful initialization when it's the case */
     
    371373
    372374
     375HRESULT GuestOSType::getRecommendedAudioCodec(AudioCodecType_T *aAudioCodec)
     376{
     377    *aAudioCodec = mAudioCodecType;
     378
     379    return S_OK;
     380}
     381
     382
    373383HRESULT GuestOSType::getRecommendedFloppy(BOOL *aRecommendedFloppy)
    374384{
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