buffer.h 823 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <vector>
  7. #include "common/common_types.h"
  8. namespace AudioCore {
  9. /**
  10. * Represents a buffer of audio samples to be played in an audio stream
  11. */
  12. class Buffer {
  13. public:
  14. using Tag = u64;
  15. Buffer(Tag tag, std::vector<u8>&& data) : tag{tag}, data{std::move(data)} {}
  16. /// Returns the raw audio data for the buffer
  17. const std::vector<u8>& GetData() const {
  18. return data;
  19. }
  20. /// Returns the buffer tag, this is provided by the game to the audout service
  21. Tag GetTag() const {
  22. return tag;
  23. }
  24. private:
  25. Tag tag;
  26. std::vector<u8> data;
  27. };
  28. using BufferPtr = std::shared_ptr<Buffer>;
  29. } // namespace AudioCore