sink.h 1023 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2016 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <vector>
  6. #include "common/common_types.h"
  7. namespace AudioCore {
  8. /**
  9. * This class is an interface for an audio sink. An audio sink accepts samples in stereo signed PCM16 format to be output.
  10. * Sinks *do not* handle resampling and expect the correct sample rate. They are dumb outputs.
  11. */
  12. class Sink {
  13. public:
  14. virtual ~Sink() = default;
  15. /// The native rate of this sink. The sink expects to be fed samples that respect this. (Units: samples/sec)
  16. virtual unsigned GetNativeSampleRate() const = 0;
  17. /**
  18. * Feed stereo samples to sink.
  19. * @param samples Samples in interleaved stereo PCM16 format. Size of vector must be multiple of two.
  20. */
  21. virtual void EnqueueSamples(const std::vector<s16>& samples) = 0;
  22. /// Samples enqueued that have not been played yet.
  23. virtual std::size_t SamplesInQueue() const = 0;
  24. };
  25. } // namespace