MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::AudioBounceBufferEntry Class Reference

An audio bounce buffer entry is backed by a collection of samples The layout is: AudioEntryHeader, followed by samples. More...

#include <AudioBounceBuffer.hpp>

Public Member Functions

 AudioBounceBufferEntry (std::uint32_t size)
 Construct an AudioBounceBufferEntry with the given size in bytes. The size should be large enough to hold the samples for all channels of a given batch size.
std::uint8_t const * data () const noexcept
 Return a view to the beginning of the bounce buffer entry data.
AudioEntryHeader const * header () const noexcept
 Return a view on the header of the bounce buffer entry.
std::uint8_t const * samples () const noexcept
 Return a view to the samples data of the bounce buffer entry.
std::size_t size () const noexcept
 The total size of the bounce buffer entry in bytes.

Private Attributes

std::vector< std::uint8_t > _data

Detailed Description

An audio bounce buffer entry is backed by a collection of samples The layout is: AudioEntryHeader, followed by samples.

Definition at line 23 of file AudioBounceBuffer.hpp.

Constructor & Destructor Documentation

◆ AudioBounceBufferEntry()

mxl::lib::fabrics::ofi::AudioBounceBufferEntry::AudioBounceBufferEntry ( std::uint32_t size)
explicit

Construct an AudioBounceBufferEntry with the given size in bytes. The size should be large enough to hold the samples for all channels of a given batch size.

Note
The header size is not included in the size parameter, it will be added on top of it. The total size of the bounce buffer entry will be header size + samples size.

Definition at line 34 of file AudioBounceBuffer.cpp.

35 : _data(sizeof(AudioEntryHeader) + size)
36 {}
std::size_t size() const noexcept
The total size of the bounce buffer entry in bytes.

Member Function Documentation

◆ data()

std::uint8_t const * mxl::lib::fabrics::ofi::AudioBounceBufferEntry::data ( ) const
nodiscardnoexcept

Return a view to the beginning of the bounce buffer entry data.

Definition at line 49 of file AudioBounceBuffer.cpp.

50 {
51 return _data.data();
52 }

◆ header()

AudioEntryHeader const * mxl::lib::fabrics::ofi::AudioBounceBufferEntry::header ( ) const
nodiscardnoexcept

Return a view on the header of the bounce buffer entry.

Definition at line 38 of file AudioBounceBuffer.cpp.

39 {
40 // The header is located at the beginning of the buffer, so we can reinterpret the start of the data as an AudioEntryHeader
41 return std::bit_cast<AudioEntryHeader const*>(_data.data());
42 }

◆ samples()

std::uint8_t const * mxl::lib::fabrics::ofi::AudioBounceBufferEntry::samples ( ) const
nodiscardnoexcept

Return a view to the samples data of the bounce buffer entry.

Definition at line 44 of file AudioBounceBuffer.cpp.

45 {
46 return _data.data() + sizeof(AudioEntryHeader); // Offset the pointer by the size of the header to get to the samples
47 }

◆ size()

std::size_t mxl::lib::fabrics::ofi::AudioBounceBufferEntry::size ( ) const
nodiscardnoexcept

The total size of the bounce buffer entry in bytes.

Definition at line 54 of file AudioBounceBuffer.cpp.

55 {
56 return _data.size();
57 }

Member Data Documentation

◆ _data

std::vector<std::uint8_t> mxl::lib::fabrics::ofi::AudioBounceBufferEntry::_data
private

Definition at line 54 of file AudioBounceBuffer.hpp.


The documentation for this class was generated from the following files: