Fix T62255: Blender defaults to "OpenAL Soft" in sound settings, regardless of saved preferences

- Default device (index 0) was hard coded.
- Also fixing crash with invalid device passed to blender via -setaudio.
This commit is contained in:
Jörg Müller
2019-03-10 23:28:51 +01:00
parent 1cc8f9d463
commit 6fd11a21f5
6 changed files with 10 additions and 8 deletions

View File

@@ -35,7 +35,12 @@ void DeviceManager::registerDevice(std::string name, std::shared_ptr<IDeviceFact
std::shared_ptr<IDeviceFactory> DeviceManager::getDeviceFactory(std::string name)
{
return m_factories[name];
auto it = m_factories.find(name);
if(it == m_factories.end())
return nullptr;
return it->second;
}
std::shared_ptr<IDeviceFactory> DeviceManager::getDefaultDeviceFactory()

View File

@@ -493,9 +493,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->image_draw_method == 0)
userdef->image_draw_method = IMAGE_DRAW_METHOD_2DTEXTURE;
// we default to the first audio device
userdef->audiodevice = 0;
for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) {
do_versions_theme(userdef, btheme);
}