mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-27 23:42:23 -05:00
Reduce audio delay by reducing audio buffer size in router operation. Audio streams are now created directly in the operations, not in the audio service, which gives more flexibility. Audio Buffer size is calculated based on endpoints (source, sink) and operation capabilities. This commit also enables allocations in a non-cacheable region of OCRAM for endpoints that use DMA for data transport. Introduce power-of-two operations that use built-in functions and possibly dedicated hardware instructions of an MCU. These operations are required by the audio stream buffer size calculation algorithm. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
30 lines
788 B
C++
30 lines
788 B
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#pragma once
|
|
|
|
#include "Endpoint.hpp"
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace audio
|
|
{
|
|
|
|
class StreamFactory
|
|
{
|
|
public:
|
|
explicit StreamFactory(Endpoint::Capabilities factoryCaps);
|
|
auto makeStream(const Source &source, const Sink &sink) -> std::unique_ptr<Stream>;
|
|
|
|
private:
|
|
auto negotiateCaps(std::vector<std::reference_wrapper<const Endpoint>> v) -> Endpoint::Capabilities;
|
|
auto getAllocator(bool usesDMA) -> Stream::Allocator &;
|
|
|
|
Endpoint::Capabilities caps;
|
|
StandardStreamAllocator stdAlloc;
|
|
NonCacheableStreamAllocator nonCacheableAlloc;
|
|
};
|
|
|
|
} // namespace audio
|