diff options
| author | bunnei <bunneidev@gmail.com> | 2018-07-27 20:25:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-27 20:25:32 -0700 |
| commit | e1d66ea7942800d51aff57c44d0e9ab9ffd949dc (patch) | |
| tree | aaff4a680cafbd1111baa602af8d0d2d7297f585 /src/audio_core/audio_out.h | |
| parent | abb489418834848965f6ccb38d2cd7cf01cedf35 (diff) | |
| parent | f1c519f2cb2d19cbe5756a6db71a3da0f2ec407d (diff) | |
Merge pull request #842 from bunnei/audio-core
Initial implementation of Audio Core
Diffstat (limited to 'src/audio_core/audio_out.h')
| -rw-r--r-- | src/audio_core/audio_out.h | 44 |
1 files changed, 44 insertions, 0 deletions
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 <memory> +#include <vector> + +#include "audio_core/buffer.h" +#include "audio_core/stream.h" +#include "common/common_types.h" + +namespace AudioCore { + +using StreamPtr = std::shared_ptr<Stream>; + +/** + * 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<u64> 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<u8>&& data); + +private: + /// Active audio streams on the interface + std::vector<StreamPtr> streams; +}; + +} // namespace AudioCore |
