#if defined(TETL_ENABLE_CXX_MODULES)
import etl;
#else
#endif
#include <stdio.h>
template <typename T, unsigned Channels, unsigned Frames>
struct fixed_audio_buffer {
using value_type = T;
fixed_audio_buffer() = default;
[[nodiscard]] auto size_channels() const -> size_type
{
return Channels;
}
[[nodiscard]] auto size_frames() const -> size_type
{
return Frames;
}
[[nodiscard]] auto size_samples() const -> size_type
{
return size_channels() * size_frames();
}
[[nodiscard]] auto frame(size_type index)
{
return make_frame(index);
}
[[nodiscard]] auto frame(size_type index) const
{
return make_frame(index);
}
[[nodiscard]] auto channel(size_type ch)
{
}
[[nodiscard]] auto channel(size_type ch) const
{
}
[[nodiscard]] auto operator()(size_type ch, size_type s) -> value_type&
{
return channel(ch)[s];
}
[[nodiscard]] auto operator()(size_type ch, size_type s) const -> value_type const&
{
return channel(ch)[s];
}
private:
[[nodiscard]] auto make_frame(size_type s) const
{
auto frame = frame_type{};
for (size_type ch{0}; ch < size_channels(); ++ch) {
frame[ch] = (*this)(ch, s);
}
return frame;
}
};
auto main() -> int
{
vec.push_back(2.0);
vec.push_back(3.0);
vec.push_back(4.0);
printf("%f\n", sum);
auto buffer = fixed_audio_buffer<float, 2, 32>{};
printf(
"%zu\n",
etl::size(buffer.channel(0)));
return 0;
}
constexpr auto next(InputIt it, typename iterator_traits< InputIt >::difference_type n=1) -> InputIt
Return the nth successor of iterator it.
Definition next.hpp:15
constexpr auto size(C const &c) noexcept(noexcept(c.size())) -> decltype(c.size())
Returns the size of the given container c or array array. Returns c.size(), converted to the return t...
Definition size.hpp:19
constexpr double pi
Definition constants.hpp:33
constexpr auto accumulate(InputIt first, InputIt last, Type init) noexcept -> Type
Computes the sum of the given value init and the elements in the range [first, last).
Definition accumulate.hpp:14
TETL_BUILTIN_PTRDIFF ptrdiff_t
etl::ptrdiff_t is the signed integer type of the result of subtracting two pointers.
Definition ptrdiff_t.hpp:15
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:15
The class template bitset represents a fixed-size sequence of Bits bits. Bitsets can be manipulated b...
Definition bitset.hpp:23