VirtualBox

Changeset 56516 in vbox


Ignore:
Timestamp:
Jun 18, 2015 12:34:47 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101136
Message:

Main: Save audio codec settings (see #7902).

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r56477 r56516  
    696696        : fEnabled(true),
    697697          controllerType(AudioControllerType_AC97),
     698          codecType(AudioCodecType_STAC9700),
    698699          driverType(AudioDriverType_Null)
    699700    {}
     
    704705                || (    (fEnabled        == a.fEnabled)
    705706                     && (controllerType  == a.controllerType)
     707                     && (codecType       == a.codecType)
    706708                     && (driverType      == a.driverType)
    707709                     && (properties      == a.properties)
     
    711713    bool                    fEnabled;
    712714    AudioControllerType_T   controllerType;
     715    AudioCodecType_T        codecType;
    713716    AudioDriverType_T       driverType;
    714717    settings::StringsMap properties;
  • trunk/src/VBox/Main/src-server/AudioAdapterImpl.cpp

    r56459 r56516  
    3333        mEnabled(false),
    3434        mAudioDriver(AudioDriverType_Null),
    35         mAudioController(AudioControllerType_AC97)
     35        mAudioController(AudioControllerType_AC97),
     36        mAudioCodec(AudioCodecType_STAC9700)
    3637    {}
    3738
     
    507508    mData->m->mEnabled = data.fEnabled;
    508509    mData->m->mAudioController = data.controllerType;
     510    mData->m->mAudioCodec = data.codecType;
    509511    mData->m->mAudioDriver = data.driverType;
    510512
     
    535537    data.fEnabled = !!mData->m->mEnabled;
    536538    data.controllerType = mData->m->mAudioController;
     539    data.codecType = mData->m->mAudioCodec;
    537540    data.driverType = mData->m->mAudioDriver;
    538541
  • trunk/src/VBox/Main/xml/Settings.cpp

    r56477 r56516  
    26512651    }
    26522652
     2653    if (elmAudioAdapter.getAttributeValue("codec", strTemp))
     2654    {
     2655        if (strTemp == "SB16")
     2656            aa.codecType = AudioCodecType_SB16;
     2657        else if (strTemp == "STAC9700")
     2658            aa.codecType = AudioCodecType_STAC9700;
     2659        else if (strTemp == "AD1980")
     2660            aa.codecType = AudioCodecType_AD1980;
     2661        else if (strTemp == "STAC9221")
     2662            aa.codecType = AudioCodecType_STAC9221;
     2663        else
     2664            throw ConfigFileError(this, &elmAudioAdapter, N_("Invalid value '%s' in AudioAdapter/@codec attribute"), strTemp.c_str());
     2665    }
     2666    else
     2667    {
     2668        /* No codec attribute provided; use defaults. */
     2669        switch (aa.controllerType)
     2670        {
     2671            case AudioControllerType_AC97:
     2672                aa.codecType = AudioCodecType_STAC9700;
     2673                break;
     2674            case AudioControllerType_SB16:
     2675                aa.codecType = AudioCodecType_SB16;
     2676                break;
     2677            case AudioControllerType_HDA:
     2678                aa.codecType = AudioCodecType_STAC9221;
     2679                break;
     2680            default:
     2681                Assert(false);  /* We just checked the controller type above. */
     2682        }
     2683    }
     2684
    26532685    if (elmAudioAdapter.getAttributeValue("driver", strTemp))
    26542686    {
     
    47164748    }
    47174749    pelmAudio->setAttribute("controller", pcszController);
     4750
     4751    const char *pcszCodec;
     4752    switch (hw.audioAdapter.codecType)
     4753    {
     4754        /* Only write out the setting for non-default AC'97 codec
     4755         * and leave the rest alone.
     4756         */
     4757#if 0
     4758        case AudioCodecType_SB16:
     4759            pcszCodec = "SB16";
     4760            break;
     4761        case AudioCodecType_STAC9221:
     4762            pcszCodec = "STAC9221";
     4763            break;
     4764        case AudioCodecType_STAC9700:
     4765            pcszCodec = "STAC9700";
     4766            break;
     4767#endif
     4768        case AudioCodecType_AD1980:
     4769            pcszCodec = "AD1980";
     4770            break;
     4771        default:
     4772            /* Don't write out anything if unknown. */
     4773            pcszCodec = NULL;
     4774    }
     4775    if (pcszCodec)
     4776        pelmAudio->setAttribute("codec", pcszCodec);
    47184777
    47194778    if (m->sv >= SettingsVersion_v1_10)
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