mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Core: Use extra thread for Cubeb on Windows to not disturb the CoInitialize state of whatever thread happens to call a Cubeb function.
This commit is contained in:
@ -4,16 +4,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "AudioCommon/SoundStream.h"
|
||||
#include "Common/WorkQueueThread.h"
|
||||
|
||||
#include <cubeb/cubeb.h>
|
||||
|
||||
class CubebStream final : public SoundStream
|
||||
{
|
||||
public:
|
||||
CubebStream();
|
||||
CubebStream(const CubebStream& other) = delete;
|
||||
CubebStream(CubebStream&& other) = delete;
|
||||
CubebStream& operator=(const CubebStream& other) = delete;
|
||||
CubebStream& operator=(CubebStream&& other) = delete;
|
||||
~CubebStream() override;
|
||||
bool Init() override;
|
||||
bool SetRunning(bool running) override;
|
||||
@ -27,6 +34,11 @@ private:
|
||||
std::vector<short> m_short_buffer;
|
||||
std::vector<float> m_floatstereo_buffer;
|
||||
|
||||
#ifdef _WIN32
|
||||
Common::WorkQueueThread<std::function<void()>> m_work_queue;
|
||||
bool m_coinit_success = false;
|
||||
#endif
|
||||
|
||||
static long DataCallback(cubeb_stream* stream, void* user_data, const void* /*input_buffer*/,
|
||||
void* output_buffer, long num_frames);
|
||||
static void StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state);
|
||||
|
Reference in New Issue
Block a user