output/wasapi: make the Thread a field, not a base class
This commit is contained in:
parent
d6fb07a3e4
commit
6931ce9558
@ -157,8 +157,9 @@ SetDSDFallback(AudioFormat &audio_format) noexcept
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class WasapiOutputThread : public Thread {
|
class WasapiOutputThread {
|
||||||
friend class WasapiOutput;
|
friend class WasapiOutput;
|
||||||
|
Thread thread{BIND_THIS_METHOD(Work)};
|
||||||
WinEvent event;
|
WinEvent event;
|
||||||
WinEvent data_poped;
|
WinEvent data_poped;
|
||||||
IAudioClient &client;
|
IAudioClient &client;
|
||||||
@ -181,18 +182,18 @@ public:
|
|||||||
ComPtr<IAudioRenderClient> &&_render_client,
|
ComPtr<IAudioRenderClient> &&_render_client,
|
||||||
const UINT32 _frame_size, const UINT32 _buffer_size_in_frames,
|
const UINT32 _frame_size, const UINT32 _buffer_size_in_frames,
|
||||||
bool _is_exclusive)
|
bool _is_exclusive)
|
||||||
:Thread(BIND_THIS_METHOD(Work)), client(_client),
|
:client(_client),
|
||||||
render_client(std::move(_render_client)), frame_size(_frame_size),
|
render_client(std::move(_render_client)), frame_size(_frame_size),
|
||||||
buffer_size_in_frames(_buffer_size_in_frames), is_exclusive(_is_exclusive),
|
buffer_size_in_frames(_buffer_size_in_frames), is_exclusive(_is_exclusive),
|
||||||
spsc_buffer(_buffer_size_in_frames * 4 * _frame_size)
|
spsc_buffer(_buffer_size_in_frames * 4 * _frame_size)
|
||||||
{
|
{
|
||||||
SetEventHandle(client, event.handle());
|
SetEventHandle(client, event.handle());
|
||||||
Start();
|
thread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finish() noexcept {
|
void Finish() noexcept {
|
||||||
SetStatus(Status::FINISH);
|
SetStatus(Status::FINISH);
|
||||||
Join();
|
thread.Join();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Play() noexcept { return SetStatus(Status::PLAY); }
|
void Play() noexcept { return SetStatus(Status::PLAY); }
|
||||||
|
Loading…
Reference in New Issue
Block a user