mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
CubebUtils: Add COM helper class
This commit is contained in:
@ -3,12 +3,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Common/WorkQueueThread.h"
|
||||
#endif
|
||||
|
||||
struct cubeb;
|
||||
|
||||
namespace CubebUtils
|
||||
@ -16,4 +21,23 @@ namespace CubebUtils
|
||||
std::shared_ptr<cubeb> GetContext();
|
||||
std::vector<std::pair<std::string, std::string>> ListInputDevices();
|
||||
const void* GetInputDeviceById(std::string_view id);
|
||||
|
||||
// Helper used to handle Windows COM library for cubeb WASAPI backend
|
||||
class CoInitSyncWorker
|
||||
{
|
||||
public:
|
||||
using FunctionType = std::function<void()>;
|
||||
|
||||
CoInitSyncWorker(std::string worker_name);
|
||||
~CoInitSyncWorker();
|
||||
|
||||
bool Execute(FunctionType f);
|
||||
|
||||
#ifdef _WIN32
|
||||
private:
|
||||
Common::AsyncWorkThread m_work_queue;
|
||||
bool m_coinit_success = false;
|
||||
bool m_should_couninit = false;
|
||||
#endif
|
||||
};
|
||||
} // namespace CubebUtils
|
||||
|
Reference in New Issue
Block a user