From ab756fd068c45fd1b3e3d0216b78c39a741214ae Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 26 Jul 2018 20:01:37 -0400 Subject: audio_core: Add initial code for keeping track of audout state. --- src/audio_core/audio_out.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/audio_core/audio_out.h (limited to 'src/audio_core/audio_out.h') diff --git a/src/audio_core/audio_out.h b/src/audio_core/audio_out.h new file mode 100644 index 000000000..a86499d10 --- /dev/null +++ b/src/audio_core/audio_out.h @@ -0,0 +1,44 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#include "audio_core/buffer.h" +#include "audio_core/stream.h" +#include "common/common_types.h" + +namespace AudioCore { + +using StreamPtr = std::shared_ptr; + +/** + * Represents an audio playback interface, used to open and play audio streams + */ +class AudioOut { +public: + /// Opens a new audio stream + StreamPtr OpenStream(int sample_rate, int num_channels, + Stream::ReleaseCallback&& release_callback); + + /// Returns a vector of recently released buffers specified by tag for the specified stream + std::vector GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count); + + /// Starts an audio stream for playback + void StartStream(StreamPtr stream); + + /// Stops an audio stream that is currently playing + void StopStream(StreamPtr stream); + + /// Queues a buffer into the specified audio stream, returns true on success + bool QueueBuffer(StreamPtr stream, Buffer::Tag tag, std::vector&& data); + +private: + /// Active audio streams on the interface + std::vector streams; +}; + +} // namespace AudioCore -- cgit v1.2.3