Sound (Windows): a small refactor

This commit is contained in:
李通洲
2026-03-25 16:17:20 +08:00
parent a1c5fe2bf2
commit 0521513609
+4 -4
View File
@@ -1,8 +1,9 @@
extern "C" {
#include "sound.h"
#include "common/windows/unicode.h"
}
#include "common/windows/unicode.hpp"
#include "common/windows/com.hpp"
#include "common/windows/variant.hpp"
#include <initguid.h>
#include <mmdeviceapi.h>
@@ -76,10 +77,9 @@ const char* ffDetectSound(FFlist* devices /* List of FFSoundDevice */)
ffStrbufInitStatic(&device->platformApi, "Core Audio APIs");
{
PROPVARIANT __attribute__((__cleanup__(PropVariantClear))) friendlyName;
PropVariantInit(&friendlyName);
FFPropVariant friendlyName;
if (SUCCEEDED(immPropStore->GetValue(PKEY_Device_FriendlyName, &friendlyName)))
ffStrbufSetWS(&device->name, friendlyName.pwszVal);
ffStrbufSetWSV(&device->name, friendlyName.get<std::wstring_view>());
}
IAudioEndpointVolume* FF_AUTO_RELEASE_COM_OBJECT immEndpointVolume;