dxd - dynax driver framework 3.0.1d223
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t > Class Template Reference

the consumer twin of a bus's producing group: it owns this group's pins, its io buffers and ring positions, and runs the consumer data path on the group's own clock - one thread per group, so every group of every device streams in parallel More...

#include <dx_stream_engine_group.h>

Inheritance diagram for dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >:
Collaboration diagram for dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >:

Classes

struct  [struct].cache
struct  converter
struct  entry

Public Types

typedef group_t::clock clock
typedef device_t::desc_t desc
typedef group_t::device_t device_t
typedef _io_t io_t
typedef _pin_t pin_t

Public Member Functions

void attach (const std::shared_ptr< pin_t > &pin)
 takes one of this group's pins into the data path, deriving its format conversion and, where the pin's stream says so, the sync reference from it
virtual void detach () noexcept
 releases this group's pins, taking their streams and the clock registration with them: their session ends first, the tick works on its cache to the end
virtual void free () noexcept
void halt () noexcept override
 this group's streaming session ends with its last started stream
void initialize (uint32_t iosize, const std::vector< bool >(&channel_map)[dx::stream::direction::directions])
void run () override
 this group's streaming session begins: the started streams brought it here
uint32_t samplerate () const
void samplerate (uint32_t samplerate)
void take (device_t &device)
 takes a device's audio pins into this engine - the app's consumer beside the bus's own group
 ~group () override

Static Public Member Functions

static group * attach (device_t &device)
 builds the audio pins of a device and hands each to the group of its own stream, returning the group that took them - the app's entry into streaming a device
static void detach (device_t &device) noexcept
 the symmetric teardown: every group of the device releases its pins while the device still stands - a pin destroyed with its group cascades into the device's group map, which is going by then

Public Attributes

dx::stream::clock::monitor asio_monitor {}
 this client's own asio level, in process: every client writes its asio slots (incl. roundtrip), so a shared segment could not attribute them - irq/isr stay in the device's shared segment, written once by the host
struct  cache
dx::stream::cursor cursor [direction::directions] {}
 this engine's own places in the shared rings
uint64_t frame {}
bool hw_clock {}
io_t ** io [direction::directions][2] {}
uint32_t iosize {}
bool kernel_streaming {}
dx::stream::clock::monitor * monitor {&asio_monitor}
std::function< void()> notify_hook = []{}
 a streaming reset this group's clock signals
std::function< void()> overload_hook = []{}
 a tick that came too late for its data
std::shared_ptr< pin_t > pin [direction::directions]
std::function< void(int64_t timestamp)> process_hook = [](int64_t){}
 the app's places in this group's tick, set like every other hook of the control base
listener< dx::listen< std::function< void(const uint32_t &)> > > safety_offset_listener [direction::directions]
 a margin set mid-session reaches the tick: it reads the cursor, never the promoted
std::function< void(uint32_t samplerate)> samplerate_hook = [](uint32_t){}

Protected Member Functions

void notify () noexcept override
virtual void notify (uint32_t samplerate) noexcept
 notify sample rate change from device
virtual void overload () noexcept
virtual void process (int64_t timestamp) noexcept
 the consumer's own processing place, set like every other hook of this group's control base
void sync (const typename clock::clock_t::time_point &now) override
void tick () override
void update () noexcept

Detailed Description

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
class dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >

the consumer twin of a bus's producing group: it owns this group's pins, its io buffers and ring positions, and runs the consumer data path on the group's own clock - one thread per group, so every group of every device streams in parallel

Exceptions
incase of an error returned by the underlaying API the device class throws a dx::exception.

Member Typedef Documentation

◆ clock

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
typedef group_t::clock dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::clock

◆ desc

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
typedef device_t::desc_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::desc

◆ device_t

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
typedef group_t::device_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::device_t

◆ io_t

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
typedef _io_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::io_t

◆ pin_t

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
typedef _pin_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::pin_t

Constructor & Destructor Documentation

◆ ~group()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::~group ( )
inlineoverride

Member Function Documentation

◆ attach() [1/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::attach ( const std::shared_ptr< pin_t > & pin)
inline

takes one of this group's pins into the data path, deriving its format conversion and, where the pin's stream says so, the sync reference from it

Exceptions
dx::exception
Here is the caller graph for this function:

◆ attach() [2/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
group * dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::attach ( device_t & device)
inlinestatic

builds the audio pins of a device and hands each to the group of its own stream, returning the group that took them - the app's entry into streaming a device

Exceptions
dx::exception

pin creation exception caught here to allow device inspection even if streaming is not possible - most likely due to exclusive access

◆ detach() [1/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
virtual void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::detach ( )
inlinevirtualnoexcept

releases this group's pins, taking their streams and the clock registration with them: their session ends first, the tick works on its cache to the end

◆ detach() [2/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::detach ( device_t & device)
inlinestaticnoexcept

the symmetric teardown: every group of the device releases its pins while the device still stands - a pin destroyed with its group cascades into the device's group map, which is going by then

Here is the caller graph for this function:

◆ free()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
virtual void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::free ( )
inlinevirtualnoexcept
Todo
replace test for valid pin by overwise keeping track of allocated channels

◆ halt()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::halt ( )
inlineoverridenoexcept

this group's streaming session ends with its last started stream

◆ initialize()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::initialize ( uint32_t iosize,
const std::vector< bool >(&) channel_map[dx::stream::direction::directions] )
inline
Todo
clock already runnning with different iosize: check if engine should be initialized with current iosize

◆ notify() [1/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::notify ( )
inlineoverrideprotectednoexcept

◆ notify() [2/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
virtual void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::notify ( uint32_t samplerate)
inlineprotectedvirtualnoexcept

notify sample rate change from device

◆ overload()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
virtual void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::overload ( )
inlineprotectedvirtualnoexcept

◆ process()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
virtual void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::process ( int64_t timestamp)
inlineprotectedvirtualnoexcept

the consumer's own processing place, set like every other hook of this group's control base

◆ run()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::run ( )
inlineoverride

this group's streaming session begins: the started streams brought it here

◆ samplerate() [1/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
uint32_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::samplerate ( ) const
inline

◆ samplerate() [2/2]

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::samplerate ( uint32_t samplerate)
inline

◆ sync()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::sync ( const typename clock::clock_t::time_point & now)
inlineoverrideprotected

◆ take()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::take ( device_t & device)
inline

takes a device's audio pins into this engine - the app's consumer beside the bus's own group

◆ tick()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::tick ( )
inlineoverrideprotected
Todo
enable re-sync with correct rx/tx position dependent clock event time point

◆ update()

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
void dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::update ( )
inlineprotectednoexcept

Member Data Documentation

◆ asio_monitor

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
dx::stream::clock::monitor dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::asio_monitor {}

this client's own asio level, in process: every client writes its asio slots (incl. roundtrip), so a shared segment could not attribute them - irq/isr stay in the device's shared segment, written once by the host

io[directions][double buffer][channel][sample]

◆ cache

struct dx::stream::engine::group::[struct].cache dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::cache

◆ cursor

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
dx::stream::cursor dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::cursor[direction::directions] {}

this engine's own places in the shared rings

◆ frame

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
uint64_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::frame {}

◆ hw_clock

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
bool dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::hw_clock {}

◆ io

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
io_t** dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::io[direction::directions][2] {}

◆ iosize

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
uint32_t dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::iosize {}

◆ kernel_streaming

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
bool dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::kernel_streaming {}

◆ monitor

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
dx::stream::clock::monitor* dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::monitor {&asio_monitor}

◆ notify_hook

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
std::function<void()> dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::notify_hook = []{}

a streaming reset this group's clock signals

◆ overload_hook

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
std::function<void()> dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::overload_hook = []{}

a tick that came too late for its data

◆ pin

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
std::shared_ptr<pin_t> dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::pin[direction::directions]

◆ process_hook

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
std::function<void(int64_t timestamp)> dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::process_hook = [](int64_t){}

the app's places in this group's tick, set like every other hook of the control base

its data path, running on this group's own thread

◆ safety_offset_listener

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
listener<dx::listen<std::function<void(const uint32_t&)> > > dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::safety_offset_listener[direction::directions]
Initial value:
{
{this->client::safety_offset[direction::out].listen, {[this](const uint32_t& ticks){auto& io= cache.sync.io[direction::out]; cursor[direction::out].margin= cursor::bytes(ticks, io.interval, io.linesize);}}},
{this->client::safety_offset[direction::in].listen, {[this](const uint32_t& ticks){auto& io= cache.sync.io[direction::in]; cursor[direction::in].margin= cursor::bytes(ticks, io.interval, io.linesize);}}},
}
struct dx::stream::engine::group::@143265315224041123242103225001101112277051227046 cache
dx::stream::cursor cursor[direction::directions]
this engine's own places in the shared rings
Definition dx_stream_engine_group.h:429
@ in
Definition dx_stream.h:323
@ out
Definition dx_stream.h:323
io - IOKit namespace
Definition io_iterator.h:28
a client's own place in a ring and the margin it keeps to the transport
Definition dx_stream.h:393
uint64_t margin
the client's safety offset to the transport
Definition dx_stream.h:395
static uint64_t bytes(uint32_t ticks, uint32_t interval, uint64_t linesize)
a safety offset in bytes: ticks of the transport's interval (samples), in lines of the ring's format
Definition dx_stream.h:415
unsigned int uint32_t
Definition wdk/dxd_platform.h:117

a margin set mid-session reaches the tick: it reads the cursor, never the promoted

◆ samplerate_hook

template<typename group_t, typename _pin_t, typename _io_t = int32_t, typename circular_t = typename _pin_t::circular_t>
std::function<void(uint32_t samplerate)> dx::stream::engine::group< group_t, _pin_t, _io_t, circular_t >::samplerate_hook = [](uint32_t){}

The documentation for this class 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.