mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-22 00:05:38 +00:00
38 lines
896 B
C++
38 lines
896 B
C++
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
#pragma once
|
|
|
|
#include "audio_stream.h"
|
|
|
|
#include <cstdint>
|
|
|
|
struct cubeb;
|
|
struct cubeb_stream;
|
|
|
|
class CubebAudioStream : public AudioStream
|
|
{
|
|
public:
|
|
CubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, AudioStretchMode stretch);
|
|
~CubebAudioStream();
|
|
|
|
void SetPaused(bool paused) override;
|
|
void SetOutputVolume(u32 volume) override;
|
|
|
|
bool Initialize(u32 latency_ms);
|
|
|
|
private:
|
|
static void LogCallback(const char* fmt, ...);
|
|
static long DataCallback(cubeb_stream* stm, void* user_ptr, const void* input_buffer, void* output_buffer,
|
|
long nframes);
|
|
|
|
void DestroyContextAndStream();
|
|
|
|
cubeb* m_context = nullptr;
|
|
cubeb_stream* stream = nullptr;
|
|
|
|
#ifdef _WIN32
|
|
bool m_com_initialized_by_us = false;
|
|
#endif
|
|
};
|