Queue.h 680 B

123456789101112131415161718192021
  1. /*
  2. * Copyright (c) 2018-2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibAudio/Sample.h>
  8. #include <LibCore/SharedCircularQueue.h>
  9. namespace Audio {
  10. static constexpr size_t AUDIO_BUFFERS_COUNT = 128;
  11. // The audio buffer size is specifically chosen to be about 1/1000th of a second (1ms).
  12. // This has the biggest impact on latency and performance.
  13. // The currently chosen value was not put here with much thought and a better choice is surely possible.
  14. static constexpr size_t AUDIO_BUFFER_SIZE = 50;
  15. using AudioQueue = Core::SharedSingleProducerCircularQueue<Array<Sample, AUDIO_BUFFER_SIZE>, AUDIO_BUFFERS_COUNT>;
  16. }