summaryrefslogtreecommitdiff
path: root/src/audio_core/audio_out.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/audio_out.h')
-rw-r--r--src/audio_core/audio_out.h44
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 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <memory>
8#include <vector>
9
10#include "audio_core/buffer.h"
11#include "audio_core/stream.h"
12#include "common/common_types.h"
13
14namespace AudioCore {
15
16using StreamPtr = std::shared_ptr<Stream>;
17
18/**
19 * Represents an audio playback interface, used to open and play audio streams
20 */
21class AudioOut {
22public:
23 /// Opens a new audio stream
24 StreamPtr OpenStream(int sample_rate, int num_channels,
25 Stream::ReleaseCallback&& release_callback);
26
27 /// Returns a vector of recently released buffers specified by tag for the specified stream
28 std::vector<u64> GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count);
29
30 /// Starts an audio stream for playback
31 void StartStream(StreamPtr stream);
32
33 /// Stops an audio stream that is currently playing
34 void StopStream(StreamPtr stream);
35
36 /// Queues a buffer into the specified audio stream, returns true on success
37 bool QueueBuffer(StreamPtr stream, Buffer::Tag tag, std::vector<u8>&& data);
38
39private:
40 /// Active audio streams on the interface
41 std::vector<StreamPtr> streams;
42};
43
44} // namespace AudioCore