mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-21 17:49:58 -05:00
Added Platform checks, Incremented state ID Removed semicolon from PR version comment Riveting change Changed Remote Names and References Updated Wii remote Audio routing to only show enabled when not using passthrough adapter, enabling speaker data, and Cubeb audio backend, and show enable/disable per Remote when supported
65 lines
1.8 KiB
C++
65 lines
1.8 KiB
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "AudioCommon/SoundStream.h"
|
|
#ifdef _WIN32
|
|
#include "Common/WorkQueueThread.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_CUBEB
|
|
#include <cubeb/cubeb.h>
|
|
#endif
|
|
|
|
class CubebStream final : public SoundStream
|
|
{
|
|
#ifdef HAVE_CUBEB
|
|
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;
|
|
void SetVolume(int) override;
|
|
static bool IsValid() { return true; }
|
|
|
|
private:
|
|
struct WiimoteStreamData
|
|
{
|
|
CubebStream* self;
|
|
std::size_t wiimote_index;
|
|
};
|
|
|
|
bool m_stereo = false;
|
|
std::shared_ptr<cubeb> m_ctx;
|
|
cubeb_stream* m_stream = nullptr;
|
|
std::array<WiimoteStreamData, 4> m_wiimote_stream_data{};
|
|
std::array<cubeb_stream*, 4> m_wiimote_streams{};
|
|
|
|
std::vector<short> m_short_buffer;
|
|
std::vector<float> m_floatstereo_buffer;
|
|
|
|
#ifdef _WIN32
|
|
Common::AsyncWorkThread m_work_queue;
|
|
bool m_coinit_success = false;
|
|
bool m_should_couninit = 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);
|
|
static long WiimoteDataCallback(cubeb_stream* stream, void* user_data,
|
|
const void* /*input_buffer*/, void* output_buffer,
|
|
long num_frames);
|
|
static void WiimoteStateCallback(cubeb_stream* stream, void* user_data, cubeb_state state);
|
|
#endif
|
|
};
|