mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-09 17:49:01 +00: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:
parent
ca10e92ab9
commit
e085bf14f9
6 changed files with 190 additions and 109 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue