mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 10:19:03 +03:00
5e01dde7b1
This allows us to carry the same buffer all the way from the WAV loader to the AudioServer mixer. This alleviates some of the stutter, but there's still a noticeable skip when switching buffers. We're gonna need to do better. :^)
34 lines
721 B
C++
34 lines
721 B
C++
#pragma once
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <AK/WeakPtr.h>
|
|
#include <LibAudio/ABuffer.h>
|
|
#include <LibCore/CFile.h>
|
|
#include <LibCore/CLock.h>
|
|
|
|
class ASClientConnection;
|
|
|
|
class ASMixer : public RefCounted<ASMixer> {
|
|
public:
|
|
ASMixer();
|
|
|
|
void queue(ASClientConnection&, const ABuffer&);
|
|
|
|
private:
|
|
struct ASMixerBuffer {
|
|
ASMixerBuffer(const NonnullRefPtr<ABuffer>&, ASClientConnection&);
|
|
NonnullRefPtr<ABuffer> buffer;
|
|
int pos { 0 };
|
|
bool done { false };
|
|
WeakPtr<ASClientConnection> m_client;
|
|
};
|
|
|
|
Vector<ASMixerBuffer> m_pending_mixing;
|
|
CFile m_device;
|
|
CLock m_lock;
|
|
|
|
void mix();
|
|
};
|