Changeset 95835 in vbox for trunk/src/VBox
- Timestamp:
- Jul 26, 2022 4:06:37 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r95796 r95835 4742 4742 // settings before 1.3 used lower case so make sure this is case-insensitive 4743 4743 strTemp.toUpper(); 4744 if (strTemp == "DEFAULT") 4744 if (strTemp == "DEFAULT") /* Keep this to be backwards compatible for settings < r152556. */ 4745 4745 aa.driverType = AudioDriverType_Default; 4746 4746 else if (strTemp == "NULL") … … 4766 4766 else 4767 4767 throw ConfigFileError(this, &elmAudioAdapter, N_("Invalid value '%s' in AudioAdapter/@driver attribute"), strTemp.c_str()); 4768 4769 /* When loading settings >= 1.19 (VBox 7.0), the attribute "useDefault" will determine if the VM should use 4770 * the OS' default audio driver or not. This additional attribute is necessary in order to be backwards compatible 4771 * with older VBox versions. */ 4772 bool fUseDefault = false; 4773 if ( elmAudioAdapter.getAttributeValue("useDefault", &fUseDefault) /* Overrides "driver" above (if set). */ 4774 && fUseDefault) 4775 aa.driverType = AudioDriverType_Default; 4768 4776 4769 4777 // now check if this is actually supported on the current host platform; … … 7485 7493 pelmAudio->setAttribute("codec", pcszCodec); 7486 7494 7487 const char *pcszDriver; 7488 switch (hw.audioAdapter.driverType) 7489 { 7490 case AudioDriverType_Default: pcszDriver = "Default"; break; 7491 case AudioDriverType_WinMM: pcszDriver = "WinMM"; break; 7492 case AudioDriverType_DirectSound: pcszDriver = "DirectSound"; break; 7493 case AudioDriverType_WAS: pcszDriver = "WAS"; break; 7494 case AudioDriverType_ALSA: pcszDriver = "ALSA"; break; 7495 case AudioDriverType_OSS: pcszDriver = "OSS"; break; 7496 case AudioDriverType_Pulse: pcszDriver = "Pulse"; break; 7497 case AudioDriverType_CoreAudio: pcszDriver = "CoreAudio"; break; 7498 case AudioDriverType_SolAudio: pcszDriver = "SolAudio"; break; 7499 case AudioDriverType_MMPM: pcszDriver = "MMPM"; break; 7500 default: /*case AudioDriverType_Null:*/ pcszDriver = "Null"; break; 7501 } 7495 /* 7496 * Keep settings >= 1.19 compatible with older VBox versions (on a best effort basis, of course). 7497 * So use a dedicated attribute for the new "Default" audio driver type, which did not exist prior 7498 * settings 1.19 (VBox 7.0) and explicitly set the driver type to something older VBox versions 7499 * know about. 7500 */ 7501 AudioDriverType_T driverType = hw.audioAdapter.driverType; 7502 7503 if (driverType == AudioDriverType_Default) 7504 { 7505 /* Only recognized by VBox >= 7.0. */ 7506 pelmAudio->setAttribute("useDefault", true); 7507 7508 /* Make sure to set the actual driver type to the OS' default driver type. 7509 * This is required for VBox < 7.0. */ 7510 driverType = getHostDefaultAudioDriver(); 7511 } 7512 7513 const char *pcszDriver = NULL; 7514 switch (driverType) 7515 { 7516 case AudioDriverType_Default: /* Handled above. */ break; 7517 case AudioDriverType_WinMM: pcszDriver = "WinMM"; break; 7518 case AudioDriverType_DirectSound: pcszDriver = "DirectSound"; break; 7519 case AudioDriverType_WAS: pcszDriver = "WAS"; break; 7520 case AudioDriverType_ALSA: pcszDriver = "ALSA"; break; 7521 case AudioDriverType_OSS: pcszDriver = "OSS"; break; 7522 case AudioDriverType_Pulse: pcszDriver = "Pulse"; break; 7523 case AudioDriverType_CoreAudio: pcszDriver = "CoreAudio"; break; 7524 case AudioDriverType_SolAudio: pcszDriver = "SolAudio"; break; 7525 case AudioDriverType_MMPM: pcszDriver = "MMPM"; break; 7526 default: /*case AudioDriverType_Null:*/ pcszDriver = "Null"; break; 7527 } 7528 7502 7529 /* Deliberately have the audio driver explicitly in the config file, 7503 7530 * otherwise an unwritten default driver triggers auto-detection. */ 7531 AssertStmt(pcszDriver != NULL, pcszDriver = "Null"); 7504 7532 pelmAudio->setAttribute("driver", pcszDriver); 7505 7533 … … 8561 8589 RT_FALL_THROUGH(); 8562 8590 case AudioDriverType_Null: 8591 return true; /* Default and Null audio are always allowed. */ 8563 8592 #ifdef RT_OS_WINDOWS 8564 8593 case AudioDriverType_WAS:
Note:
See TracChangeset
for help on using the changeset viewer.