mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 23:25:46 -04:00
SPU: Add time stretched audio output
This commit is contained in:
@ -1,34 +1,30 @@
|
||||
#pragma once
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "util/audio_stream.h"
|
||||
#include <cstdint>
|
||||
|
||||
class CubebAudioStream final : public AudioStream
|
||||
struct cubeb;
|
||||
struct cubeb_stream;
|
||||
|
||||
class CubebAudioStream : public AudioStream
|
||||
{
|
||||
public:
|
||||
CubebAudioStream();
|
||||
CubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, AudioStretchMode stretch);
|
||||
~CubebAudioStream();
|
||||
|
||||
static std::unique_ptr<AudioStream> Create();
|
||||
|
||||
protected:
|
||||
bool IsOpen() const { return m_cubeb_stream != nullptr; }
|
||||
|
||||
bool OpenDevice() override;
|
||||
void PauseDevice(bool paused) override;
|
||||
void CloseDevice() override;
|
||||
void FramesAvailable() override;
|
||||
void SetPaused(bool paused) override;
|
||||
void SetOutputVolume(u32 volume) override;
|
||||
|
||||
void DestroyContext();
|
||||
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);
|
||||
static void StateCallback(cubeb_stream* stream, void* user_ptr, cubeb_state state);
|
||||
|
||||
cubeb* m_cubeb_context = nullptr;
|
||||
cubeb_stream* m_cubeb_stream = nullptr;
|
||||
bool m_paused = true;
|
||||
void DestroyContextAndStream();
|
||||
|
||||
cubeb* m_context = nullptr;
|
||||
cubeb_stream* stream = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
bool m_com_initialized_by_us = false;
|
||||
|
Reference in New Issue
Block a user