dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::midi::ump::circular Struct Reference

the ring of stamped Universal MIDI Packets: an entry is the stamp in two words, low first, and the words of one packet; a read cuts on whole entries, so a reader never sees a torn one The ring's size is a multiple of the word, so a word never wraps. More...

#include <dx_midi.h>

Inheritance diagram for dx::midi::ump::circular:
Collaboration diagram for dx::midi::ump::circular:

Public Types

typedef dx::circular super

Public Member Functions

void clear (uint64_t position, uint64_t bytes)
 zero a just-consumed region, wrapping around - only safe for a single reader's own rx, never a shared/multi-reader position
uint64_t empty () const
uint64_t empty (uint64_t position) const
template<non_pointer ext_t, typename circular_t = ext_t>
bool force_read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool force_read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<typename ext_t, typename circular_t = ext_t>
bool force_read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 multi channel interleaved bulk read from circular buffer with format conversion if applicable
template<non_pointer ext_t, typename circular_t = ext_t>
bool force_read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<typename ext_t, typename circular_t = ext_t>
bool force_write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool force_write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<typename data_t>
bool force_write (data_t *const *const *src, uint64_t clients, uint64_t channels, uint64_t bulk)
template<typename circular_t, typename src_t>
bool force_write (src_t *const *const *src, uint32_t clients, uint32_t channels=1, uint64_t bulk=1)
 multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample]
template<typename ext_t, typename circular_t = ext_t>
bool force_write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 multi channel interleaved bulk write into circular buffer with format conversion if applicable
template<non_pointer ext_t, typename circular_t = ext_t>
bool force_write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 single channel convenience access templates
void initialize ()
void initialize (uint64_t backingstore_size)
uint64_t loop () const
template<typename ext_t, typename circular_t = ext_t>
bool mix_write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 multi channel interleaved bulk mix into circular buffer at position with format conversion if applicable
template<typename callback_t>
bool move (callback_t &callback, uint64_t max)
template<non_pointer data_t>
bool operator<< (const data_t &src)
template<non_pointer data_t>
bool operator>> (data_t &dst)
template<auto op, typename ext_t, typename circular_t>
void put (uint64_t position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular, uint32_t channels_src, uint32_t circular_offset, uint32_t interleaved, uint64_t src_offset=0)
 multi channel interleaved bulk placement into circular space at position with wrap-around; channel operation (copy/add) selected at compile time
template<non_pointer ext_t, typename circular_t = ext_t>
bool read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
uint64_t read (packet *dst, uint64_t bulk)
uint64_t read (volatile uint64_t &position, packet *dst, uint64_t bulk)
 reads whole packets: as many as fit bulk and stand complete in the ring; the packets read returned
template<typename dst_t = uint8_t>
dst_t * simulate_read (uint64_t bulk=1)
template<typename dst_t = uint8_t>
dst_t * simulate_read (volatile uint64_t &position, uint64_t bulk)
uint8_tsimulate_write (uint64_t bulk)
 simulate write by advancing write idx and take care of wrap write optimization
uint64_t used () const
uint64_t used (uint64_t position) const
template<typename ext_t, typename circular_t = ext_t>
bool write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<non_pointer ext_t, typename circular_t = ext_t>
bool write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
template<typename ext_t, typename circular_t = ext_t>
bool write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 bulk write into circular buffer with format conversion if applicable
template<non_pointer ext_t, typename circular_t = ext_t>
bool write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
bool write (const packet &packet)
bool write (int64_t timestamp, const uint32_t *src, uint64_t words)
 writes a run of whole packets, every one at the same moment: all or nothing

Static Public Member Functions

template<typename position_t>
static position_t advance (volatile position_t &position, position_t value)
 lock-free monotonic publish: advance position to value unless already beyond
template<typename dst_t>
static void atomic_add (dst_t *dst, int64_t added)
 atomic clip-add of one sample: concurrent writers into the same mix target must never plain read-modify-write

Public Attributes

struct { 
   volatile uint64_t   count 
 cycle counter More...
   volatile uint64_t   reference 
 sample reference of taken timestamp More...
   volatile uint64_t   size 
 cycle length in bytes (each cycle length bytes a new timestamp is generated) More...
   volatile int64_t   timestamp 
 timestamp of current timestamp cycle More...
cycle
uint8_t data [1]
volatile uint64_t dropout
 dropout counter
volatile uint64_t rx
 single consumers current read index
uint64_t size
 size of buffer in bytes
volatile int64_t timestamp
 current rx/tx timestamp
volatile uint64_t tx
 producers current write index

Static Public Attributes

static constexpr uint64_t stamp = sizeof(int64_t)/ sizeof(uint32_t)

Detailed Description

the ring of stamped Universal MIDI Packets: an entry is the stamp in two words, low first, and the words of one packet; a read cuts on whole entries, so a reader never sees a torn one The ring's size is a multiple of the word, so a word never wraps.

Member Typedef Documentation

◆ super

Member Function Documentation

◆ advance()

template<typename position_t>
position_t dx::circular::advance ( volatile position_t & position,
position_t value )
inlinestaticinherited

lock-free monotonic publish: advance position to value unless already beyond

lock-free max-publish; returns the position advanced from (>= value when nothing was advanced), so the winning caller alone owns the span [returned, value)

Here is the caller graph for this function:

◆ atomic_add()

template<typename dst_t>
void dx::circular::atomic_add ( dst_t * dst,
int64_t added )
inlinestaticinherited

atomic clip-add of one sample: concurrent writers into the same mix target must never plain read-modify-write

Todo
packed 24bit: no lock-free CAS on a 3-byte element - plain clip-add, not yet atomic (like the floating-point formats)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void dx::circular::clear ( uint64_t position,
uint64_t bytes )
inlineinherited

zero a just-consumed region, wrapping around - only safe for a single reader's own rx, never a shared/multi-reader position

Here is the caller graph for this function:

◆ empty() [1/2]

uint64_t dx::circular::empty ( ) const
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty() [2/2]

uint64_t dx::circular::empty ( uint64_t position) const
inlineinherited
Here is the call graph for this function:

◆ force_read() [1/4]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::force_read ( ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ force_read() [2/4]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::force_read ( ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ force_read() [3/4]

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::force_read ( volatile uint64_t & position,
ext_t *const * dst,
uint64_t bulk,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited

multi channel interleaved bulk read from circular buffer with format conversion if applicable

return true if enough data is available in circular space

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_read() [4/4]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::force_read ( volatile uint64_t & position,
ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ force_write() [1/6]

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::force_write ( const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ force_write() [2/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::force_write ( const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ force_write() [3/6]

template<typename data_t>
bool dx::circular::force_write ( data_t *const *const * src,
uint64_t clients,
uint64_t channels,
uint64_t bulk )
inlineinherited
Here is the call graph for this function:

◆ force_write() [4/6]

template<typename circular_t, typename src_t>
bool dx::circular::force_write ( src_t *const *const * src,
uint32_t clients,
uint32_t channels = 1,
uint64_t bulk = 1 )
inlineinherited

multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample]

return true if data fit into empty space

◆ force_write() [5/6]

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::force_write ( volatile uint64_t & position,
const ext_t *const * src,
uint64_t bulk,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited

multi channel interleaved bulk write into circular buffer with format conversion if applicable

return true if data fit into circular space false if data fit not or older data had to be overwritten

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_write() [6/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::force_write ( volatile uint64_t & position,
const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited

single channel convenience access templates

Here is the call graph for this function:

◆ initialize() [1/2]

void dx::circular::initialize ( )
inlineinherited

◆ initialize() [2/2]

void dx::circular::initialize ( uint64_t backingstore_size)
inlineinherited
Here is the caller graph for this function:

◆ loop()

uint64_t dx::circular::loop ( ) const
inlineinherited

◆ mix_write()

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::mix_write ( volatile uint64_t & position,
const ext_t *const * src,
uint64_t bulk,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited

multi channel interleaved bulk mix into circular buffer at position with format conversion if applicable

concurrent writers each holding their own position share one circular and always atomically add (never overwrite) into it - the single reader (its own rx, see above) is responsible for zeroing a region once consumed, so every writer finds a clean slate regardless of write order

return true if data fit into circular space false if data fit not or older data had to be overwritten

Here is the call graph for this function:

◆ move()

template<typename callback_t>
bool dx::circular::move ( callback_t & callback,
uint64_t max )
inlineinherited
Here is the call graph for this function:

◆ operator<<()

template<non_pointer data_t>
bool dx::circular::operator<< ( const data_t & src)
inlineinherited
Here is the call graph for this function:

◆ operator>>()

template<non_pointer data_t>
bool dx::circular::operator>> ( data_t & dst)
inlineinherited
Here is the call graph for this function:

◆ put()

template<auto op, typename ext_t, typename circular_t>
void dx::circular::put ( uint64_t position,
const ext_t *const * src,
uint64_t bulk,
uint32_t channels_circular,
uint32_t channels_src,
uint32_t circular_offset,
uint32_t interleaved,
uint64_t src_offset = 0 )
inlineinherited

multi channel interleaved bulk placement into circular space at position with wrap-around; channel operation (copy/add) selected at compile time

Here is the caller graph for this function:

◆ read() [1/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::read ( ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ read() [2/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::read ( ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ read() [3/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::read ( volatile uint64_t & position,
ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read() [4/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::read ( volatile uint64_t & position,
ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ read() [5/6]

uint64_t dx::midi::ump::circular::read ( packet * dst,
uint64_t bulk )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read() [6/6]

uint64_t dx::midi::ump::circular::read ( volatile uint64_t & position,
packet * dst,
uint64_t bulk )
inline

reads whole packets: as many as fit bulk and stand complete in the ring; the packets read returned

Here is the call graph for this function:

◆ simulate_read() [1/2]

template<typename dst_t = uint8_t>
dst_t * dx::circular::simulate_read ( uint64_t bulk = 1)
inlineinherited
Here is the call graph for this function:

◆ simulate_read() [2/2]

template<typename dst_t = uint8_t>
dst_t * dx::circular::simulate_read ( volatile uint64_t & position,
uint64_t bulk )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulate_write()

uint8_t * dx::circular::simulate_write ( uint64_t bulk)
inlineinherited

simulate write by advancing write idx and take care of wrap write optimization

◆ used() [1/2]

uint64_t dx::circular::used ( ) const
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ used() [2/2]

uint64_t dx::circular::used ( uint64_t position) const
inlineinherited
Here is the call graph for this function:

◆ write() [1/6]

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::write ( const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ write() [2/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::write ( const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ write() [3/6]

template<typename ext_t, typename circular_t = ext_t>
bool dx::circular::write ( volatile uint64_t & position,
const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited

bulk write into circular buffer with format conversion if applicable

return true if data fit into empty space

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [4/6]

template<non_pointer ext_t, typename circular_t = ext_t>
bool dx::circular::write ( volatile uint64_t & position,
const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inlineinherited
Here is the call graph for this function:

◆ write() [5/6]

bool dx::midi::ump::circular::write ( const packet & packet)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [6/6]

bool dx::midi::ump::circular::write ( int64_t timestamp,
const uint32_t * src,
uint64_t words )
inline

writes a run of whole packets, every one at the same moment: all or nothing

Here is the call graph for this function:

Member Data Documentation

◆ count

volatile uint64_t dx::circular::count
inherited

cycle counter

◆ [struct]

struct { ... } dx::circular::cycle

◆ data

uint8_t dx::circular::data[1]
inherited

◆ dropout

volatile uint64_t dx::circular::dropout
inherited

dropout counter

◆ reference

volatile uint64_t dx::circular::reference
inherited

sample reference of taken timestamp

◆ rx

volatile uint64_t dx::circular::rx
inherited

single consumers current read index

◆ size [1/2]

volatile uint64_t dx::circular::size
inherited

cycle length in bytes (each cycle length bytes a new timestamp is generated)

◆ size [2/2]

uint64_t dx::circular::size
inherited

size of buffer in bytes

◆ stamp

uint64_t dx::midi::ump::circular::stamp = sizeof(int64_t)/ sizeof(uint32_t)
staticconstexpr

◆ timestamp

volatile int64_t dx::circular::timestamp
inherited

current rx/tx timestamp

timestamp of current timestamp cycle

◆ tx

volatile uint64_t dx::circular::tx
inherited

producers current write index


The documentation for this struct was generated from the following file:

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.