2018-07-27 01:01:37 +01:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2018-08-02 23:27:22 +01:00
|
|
|
#include <string>
|
2018-07-27 01:01:37 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "audio_core/buffer.h"
|
2018-07-28 18:44:50 +01:00
|
|
|
#include "audio_core/sink.h"
|
2018-07-27 01:01:37 +01:00
|
|
|
#include "audio_core/stream.h"
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace AudioCore {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an audio playback interface, used to open and play audio streams
|
|
|
|
*/
|
|
|
|
class AudioOut {
|
|
|
|
public:
|
|
|
|
/// Opens a new audio stream
|
2018-08-02 23:27:22 +01:00
|
|
|
StreamPtr OpenStream(u32 sample_rate, u32 num_channels, std::string&& name,
|
2018-07-27 01:01:37 +01:00
|
|
|
Stream::ReleaseCallback&& release_callback);
|
|
|
|
|
|
|
|
/// Returns a vector of recently released buffers specified by tag for the specified stream
|
2018-08-02 05:10:21 +01:00
|
|
|
std::vector<Buffer::Tag> GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count);
|
2018-07-27 01:01:37 +01:00
|
|
|
|
|
|
|
/// 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:
|
2018-07-28 18:35:22 +01:00
|
|
|
SinkPtr sink;
|
2018-07-27 01:01:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace AudioCore
|