audio_core.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <memory>
  5. #include "audio_core/audio_manager.h"
  6. #include "audio_core/renderer/adsp/adsp.h"
  7. #include "audio_core/sink/sink.h"
  8. namespace Core {
  9. class System;
  10. }
  11. namespace AudioCore {
  12. class AudioManager;
  13. /**
  14. * Main audio class, stored inside the core, and holding the audio manager, all sinks, and the ADSP.
  15. */
  16. class AudioCore {
  17. public:
  18. explicit AudioCore(Core::System& system);
  19. ~AudioCore();
  20. /**
  21. * Shutdown the audio core.
  22. */
  23. void Shutdown();
  24. /**
  25. * Get a reference to the audio manager.
  26. *
  27. * @return Ref to the audio manager.
  28. */
  29. AudioManager& GetAudioManager();
  30. /**
  31. * Get the audio output sink currently in use.
  32. *
  33. * @return Ref to the sink.
  34. */
  35. Sink::Sink& GetOutputSink();
  36. /**
  37. * Get the audio input sink currently in use.
  38. *
  39. * @return Ref to the sink.
  40. */
  41. Sink::Sink& GetInputSink();
  42. /**
  43. * Get the ADSP.
  44. *
  45. * @return Ref to the ADSP.
  46. */
  47. AudioRenderer::ADSP::ADSP& GetADSP();
  48. private:
  49. /**
  50. * Create the sinks on startup.
  51. */
  52. void CreateSinks();
  53. /// Main audio manager for audio in/out
  54. std::unique_ptr<AudioManager> audio_manager;
  55. /// Sink used for audio renderer and audio out
  56. std::unique_ptr<Sink::Sink> output_sink;
  57. /// Sink used for audio input
  58. std::unique_ptr<Sink::Sink> input_sink;
  59. /// The ADSP in the sysmodule
  60. std::unique_ptr<AudioRenderer::ADSP::ADSP> adsp;
  61. };
  62. } // namespace AudioCore