Changeset 73258 in vbox for trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
- Timestamp:
- Jul 20, 2018 9:29:47 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r73239 r73258 3428 3428 } 3429 3429 3430 /** 3431 * Retrieves an uint32_t value from audio's extra data branch and returns a default value 3432 * if not found or an invalid value is found. 3433 * 3434 * @return VBox status code. 3435 * @param pVirtualBox Pointer to IVirtualBox instance. 3436 * @param pMachine Pointer to IMachine instance. 3437 * @param pszDriverName Audio driver name to retrieve value for. 3438 * @param pszValue Value name to retrieve. 3439 * @param uDefault Default value to return if value not found / invalid. 3440 */ 3441 uint32_t Console::i_getAudioDriverValU32(IVirtualBox *pVirtualBox, IMachine *pMachine, 3442 const char *pszDriverName, const char *pszValue, uint32_t uDefault) 3443 { 3444 Utf8StrFmt strPath("VBoxInternal2/Audio/%s/%s", pszDriverName, pszValue); 3445 3446 Utf8Str strTmp; 3447 GetExtraDataBoth(pVirtualBox, pMachine, strPath.c_str(), &strTmp); 3448 3449 if (strTmp.isNotEmpty()) 3450 return strTmp.toUInt32(); 3451 3452 return uDefault; 3453 } 3454 3455 /** 3456 * Configures an audio driver via CFGM by getting (optional) values from extra data. 3457 * 3458 * @return VBox status code. 3459 * @param pAudioAdapter Pointer to audio adapter instance. Needed for the driver's input / output configuration. 3460 * @param pVirtualBox Pointer to IVirtualBox instance. 3461 * @param pMachine Pointer to IMachine instance. 3462 * @param pLUN Pointer to CFGM node of LUN (the driver) to configure. 3463 * @param pszDrvName Name of the driver to configure. 3464 */ 3430 3465 int Console::i_configAudioDriver(IAudioAdapter *pAudioAdapter, IVirtualBox *pVirtualBox, IMachine *pMachine, 3431 PCFGMNODE pLUN, const char *pszDr iverName)3466 PCFGMNODE pLUN, const char *pszDrvName) 3432 3467 { 3433 3468 #define H() AssertLogRelMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_MAIN_CONFIG_CONSTRUCTOR_COM_ERROR) … … 3438 3473 GetExtraDataBoth(pVirtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp); 3439 3474 const uint64_t fDebugEnabled = (strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1")) ? 1 : 0; 3440 3441 Utf8Str strDebugPathOut;3442 GetExtraDataBoth(pVirtualBox, pMachine, "VBoxInternal2/Audio/Debug/PathOut", &strDebugPathOut);3443 3475 3444 3476 BOOL fAudioEnabledIn = FALSE; … … 3451 3483 PCFGMNODE pCfg; 3452 3484 InsertConfigNode(pLUN, "Config", &pCfg); 3453 InsertConfigString (pCfg, "DriverName", pszDr iverName);3485 InsertConfigString (pCfg, "DriverName", pszDrvName); 3454 3486 InsertConfigInteger(pCfg, "InputEnabled", fAudioEnabledIn); 3455 3487 InsertConfigInteger(pCfg, "OutputEnabled", fAudioEnabledOut); 3456 InsertConfigInteger(pCfg, "DebugEnabled", fDebugEnabled); 3457 InsertConfigString (pCfg, "DebugPathOut", strDebugPathOut.c_str()); 3488 3489 if (fDebugEnabled) 3490 { 3491 InsertConfigInteger(pCfg, "DebugEnabled", fDebugEnabled); 3492 3493 Utf8Str strDebugPathOut; 3494 GetExtraDataBoth(pVirtualBox, pMachine, "VBoxInternal2/Audio/Debug/PathOut", &strDebugPathOut); 3495 InsertConfigString(pCfg, "DebugPathOut", strDebugPathOut.c_str()); 3496 } 3497 3498 InsertConfigInteger(pCfg, "PeriodMs", 3499 i_getAudioDriverValU32(pVirtualBox, pMachine, pszDrvName, "PeriodMs", 0 /* Default */)); 3500 InsertConfigInteger(pCfg, "BufferSizeMs", 3501 i_getAudioDriverValU32(pVirtualBox, pMachine, pszDrvName, "BufferSizeMs", 0 /* Default */)); 3502 InsertConfigInteger(pCfg, "PreBufferMs", 3503 i_getAudioDriverValU32(pVirtualBox, pMachine, pszDrvName, "PreBufferMs", UINT32_MAX /* Default */)); 3458 3504 3459 3505 PCFGMNODE pLunL1; … … 3466 3512 InsertConfigString(pCfg, "StreamName", bstrTmp); 3467 3513 3468 InsertConfigString(pLunL1, "Driver", pszDr iverName);3469 3470 LogFlowFunc(("szDrivName=%s, hrc=%Rhrc\n", pszDr iverName, hrc));3514 InsertConfigString(pLunL1, "Driver", pszDrvName); 3515 3516 LogFlowFunc(("szDrivName=%s, hrc=%Rhrc\n", pszDrvName, hrc)); 3471 3517 return hrc; 3472 3518
Note:
See TracChangeset
for help on using the changeset viewer.