summaryrefslogtreecommitdiff
path: root/src/audio_core/audio_out.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-27 20:25:32 -0700
committerGravatar GitHub2018-07-27 20:25:32 -0700
commite1d66ea7942800d51aff57c44d0e9ab9ffd949dc (patch)
treeaaff4a680cafbd1111baa602af8d0d2d7297f585 /src/audio_core/audio_out.h
parentMerge pull request #696 from DarkLordZach/romfs (diff)
parentaudout: Implement IAudioOut interface with AudioCore. (diff)
downloadyuzu-e1d66ea7942800d51aff57c44d0e9ab9ffd949dc.tar.gz
yuzu-e1d66ea7942800d51aff57c44d0e9ab9ffd949dc.tar.xz
yuzu-e1d66ea7942800d51aff57c44d0e9ab9ffd949dc.zip
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.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