Add EngineDevice class

This commit is contained in:
Jonas Kvinge
2023-06-01 19:31:19 +02:00
parent a1dbbba1a1
commit 315073f9a7
20 changed files with 170 additions and 111 deletions

View File

@@ -32,11 +32,12 @@
#include <QUuid>
#include "directsounddevicefinder.h"
#include "enginedevice.h"
#include "core/logging.h"
DirectSoundDeviceFinder::DirectSoundDeviceFinder() : DeviceFinder("directsound", { "directsound", "dsound", "directsoundsink", "directx", "directx2" }) {}
DeviceFinder::DeviceList DirectSoundDeviceFinder::ListDevices() {
EngineDeviceList DirectSoundDeviceFinder::ListDevices() {
State state;
DirectSoundEnumerateA(&DirectSoundDeviceFinder::EnumerateCallback, &state);
return state.devices;
@@ -48,11 +49,11 @@ BOOL CALLBACK DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR des
State *state = reinterpret_cast<State*>(state_voidptr);
Device dev;
dev.description = QString::fromLatin1(description);
if (guid) dev.value = QUuid(*guid).toString();
dev.iconname = GuessIconName(dev.description);
state->devices.append(dev);
EngineDevice device;
device.description = QString::fromLatin1(description);
if (guid) device.value = QUuid(*guid).toString();
device.iconname = device.GuessIconName();
state->devices.append(device);
return 1;