dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t > Class Template Reference

WASAPI client streaming device interface class. More...

#include <dx_wasapi_client_device.h>

Inheritance diagram for dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >:
Collaboration diagram for dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >:

Classes

struct  property
 beside the generic settings: the share mode this device's endpoints are opened in, which decides whether a rate other than the engine's mix format is reachable at all More...

Public Types

typedef desc_t desc_t
typedef event event_t
typedef std::conditional_t< std::is_void_v< group_t >, dx::stream::group< device >, group_t > group_t
 bus devices driving their groups' tick pass their own group type
typedef promoted< uint32_t >::template preference< decltype(dx::stream::control< dx::device< std::string, preference_t > >::preference)> source_t

Public Member Functions

 _device (decltype(super::driver)&driver, decltype(super::id)&id)
 the WASAPI stream device class constructor
void attach (channel_t **io[dx::stream::direction::directions][2], const std::vector< bool >(&channel_map)[2])
void conclude () noexcept override
 ends every group's session before the device's resources go; the start counts stay with their holders
void exception (const dx::exception &exception, bool filtered=false) const noexcept override
virtual uint64_t frame () const
virtual bool hw_clock () const noexcept
virtual void hw_clock (abstract::event *hw_clock, uint32_t iosize)
 registers a consumer with the device's clock: it is signalled every iosize samples of the clock's own advance. A bus whose driver owns the clock hands the registration on instead
void info (std::ostream &os) noexcept override
std::shared_ptr< stream_t > open (const typename desc_t::stream::desc &desc)
 the desc's stream: the registered one, else created, registered and launched
group_t & operator[] (const typename desc_t::stream::desc &stream)
 the stream's group, created on first use
_device & reset ()
virtual std::pair< source_t &, bool > source (const struct desc_t::stream &stream)
 the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources
std::string string (uint8_t)
void wake () override
 ~_device () override

Public Attributes

dx::shared::lockfree::list< registration > clock
 the tick walks it without a lock
promoted< uint32_t >::preference< decltype(super::preference)> clocksource
dx::stream::clock::consumer consumer
abstract::event * event
std::map< decltype(desc_t::stream::group), group_t > group
 streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first
struct { 
   struct registration { 
      dx::stream::clock::consumer   consumer 
      abstract::event *   event 
      volatile bool   reset {} 
   } 
   dx::shared::lockfree::list< registration >   clock 
 the tick walks it without a lock More...
   uint32_t   iosize 
 staging value for registration paths without their own iosize argument (macOS CF property bridge) More...
   std::mutex   mutex 
 the registrations' writers More...
   std::map< abstract::event *, std::unique_ptr< registration > >   registrations 
} hw
promoted< std::string >::preference< decltype(super::preference)> icon
promoted< uint32_t >::preference< decltype(super::preference)> iosize
uint32_t iosize
 staging value for registration paths without their own iosize argument (macOS CF property bridge)
dx::stream::device::monitor monitor
std::mutex mutex
 the registrations' writers
std::map< abstract::event *, std::unique_ptr< registration > > registrations
promoted< uint32_t >::preference< decltype(super::preference)> samplerate
std::map< decltype(desc_t::stream::target.idx()), source_t > sources
promoted< uint32_t > start {0}
promoted< bool > started {false}
promoted< structdesc_t::stream * >::template preference< decltype(super::preference), uint32_t > sync_reference
dx::stream::device::monitor version

Static Public Attributes

static constexpr bool hosted
 the transport's settings belong to another process' device: a hosted device mirrors them through its chains, it keeps no store of them

Protected Member Functions

virtual void grouped (group_t &)
 operator[](): a group just came into existence, a host wires its per-group transports here

Protected Attributes

std::function< void()> flush_hook = []{}
std::function< void()> halt_hook = []{}
std::function< void()> run_hook = []{}
decltype(super::samplerate) ::chain samplerate_server
 exclusive: every stream's client is recreated at the aligned rate, paused across it; shared: the engine's mix format rate is the only one

Detailed Description

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
class dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >

WASAPI client streaming device interface class.

One audio adapter: its desc is synthesized from its active endpoints, one stream with one pin, one clock and one group per endpoint. The share mode is the device's property: shared streams in the audio engine's mix format, exclusive streams in the first sample format the endpoint takes, at every standard rate it takes it.

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

Member Typedef Documentation

◆ desc_t

typedef desc_t dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::desc_t
inherited

◆ event_t

typedef event dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::event_t
inherited

◆ group_t

typedef std::conditional_t<std::is_void_v<group_t>, dx::stream::group<device>, group_t> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::group_t
inherited

bus devices driving their groups' tick pass their own group type

◆ source_t

typedef promoted<uint32_t>::template preference<decltype(dx::stream::control< dx::device< std::string, preference_t > >::preference)> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::source_t
inherited

Constructor & Destructor Documentation

◆ _device()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::_device ( decltype(super::driver)& driver,
decltype(super::id)& id )
inline

the WASAPI stream device class constructor

< the endpoints follow the first one's rate; a shared mode engine converts its own mix format to it

< only a rate every endpoint takes can be the domain's - in shared mode the engine converts instead, so the reference's rate stands

◆ ~_device()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::~_device ( )
inlineoverride

Member Function Documentation

◆ attach()

void dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::attach ( channel_t ** io[dx::stream::direction::directions][2],
const std::vector< bool >(&) channel_map[2] )
inlineinherited

◆ conclude()

void dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::conclude ( )
inlineoverridenoexceptinherited

ends every group's session before the device's resources go; the start counts stay with their holders

Here is the caller graph for this function:

◆ exception()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::exception ( const dx::exception & exception,
bool filtered = false ) const
inlineoverridenoexcept

◆ frame()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
virtual uint64_t dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::frame ( ) const
inlinevirtual

◆ grouped()

virtual void dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::grouped ( group_t & )
inlineprotectedvirtualinherited

operator[](): a group just came into existence, a host wires its per-group transports here

◆ hw_clock() [1/2]

virtual bool dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::hw_clock ( ) const
inlinevirtualnoexceptinherited

◆ hw_clock() [2/2]

virtual void dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::hw_clock ( abstract::event * hw_clock,
uint32_t iosize )
inlinevirtualinherited

registers a consumer with the device's clock: it is signalled every iosize samples of the clock's own advance. A bus whose driver owns the clock hands the registration on instead

◆ info()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::info ( std::ostream & os)
inlineoverridenoexcept

◆ open()

std::shared_ptr< stream_t > dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::open ( const typename desc_t::stream::desc & desc)
inlineinherited

the desc's stream: the registered one, else created, registered and launched

◆ operator[]()

group_t & dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::operator[] ( const typename desc_t::stream::desc & stream)
inlineinherited

the stream's group, created on first use

◆ reset()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
_device & dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::reset ( )
inline

◆ source()

virtual std::pair< source_t &, bool > dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::source ( const struct desc_t::stream & stream)
inlinevirtualinherited

the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources

◆ string()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
std::string dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::string ( uint8_t )
inline

◆ wake()

void dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::wake ( )
inlineoverrideinherited

Member Data Documentation

◆ clock

dx::shared::lockfree::list<registration> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::clock
inherited

the tick walks it without a lock

◆ clocksource

promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::clocksource
inherited

◆ consumer

dx::stream::clock::consumer dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::consumer
inherited

◆ event

abstract::event* dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::event
inherited

◆ flush_hook

template<typename object_t>
std::function<void()> dx::stream::control< object_t >::flush_hook = []{}
protectedinherited

◆ group

std::map<decltype(desc_t::stream::group), group_t> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::group
inherited

streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first

◆ halt_hook

template<typename object_t>
std::function<void()> dx::stream::control< object_t >::halt_hook = []{}
protectedinherited

◆ hosted

bool dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::hosted
staticconstexprinherited

the transport's settings belong to another process' device: a hosted device mirrors them through its chains, it keeps no store of them

◆ [struct]

struct { ... } dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::hw
Todo
migrate hw clock generation/distribution into a dedicated clock class

◆ icon

promoted<std::string>::preference<decltype(super::preference)> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::icon
inherited

◆ iosize [1/2]

promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::iosize
inherited

◆ iosize [2/2]

uint32_t dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::iosize
inherited

staging value for registration paths without their own iosize argument (macOS CF property bridge)

◆ monitor

dx::stream::device::monitor dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::monitor
inherited

◆ mutex

std::mutex dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::mutex
inherited

the registrations' writers

◆ registrations

std::map<abstract::event*, std::unique_ptr<registration> > dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::registrations
inherited

◆ run_hook

template<typename object_t>
std::function<void()> dx::stream::control< object_t >::run_hook = []{}
protectedinherited

◆ samplerate

promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::samplerate
inherited

◆ samplerate_server

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
decltype(super::samplerate) ::chain dx::wasapi::client::_device< desc_t, preference_t, stream_t, group_t >::samplerate_server
protected
Initial value:
{
[this](decltype(super::samplerate)::lock_t&& lock, uint32_t value, uint32_t current){
typename decltype(super::samplerate)::lock_t tmp(std::move(lock));
const uint32_t aligned{this->samplerate.align(value, current)};
if(this->preference[property::mode](0u)== mode::exclusive && (!this->samplerate.initialized || aligned!= current))
for(auto& stream: streams())
if(stream->launched){
typename stream_t::pause pause{*stream};
stream->open(aligned);
}
samplerate_server.server(std::move(tmp), aligned, current);
}}
a session held open across a change that needs it stopped: the counted shares are taken out for the s...
Definition dx_stream_control.h:123
promoted< uint32_t >::preference< decltype(super::preference)> samplerate
Definition dx_stream_device.h:182
decltype(super::samplerate) ::chain samplerate_server
exclusive: every stream's client is recreated at the aligned rate, paused across it; shared: the engi...
Definition dx_wasapi_client_device.h:318
WASAPI client stream: one endpoint's audio client, moved by its group one engine period per tick betw...
Definition dx_wasapi_client_device.h:102
void open(uint32_t samplerate)
(re)creates the endpoint's audio client in the stream's format at the device's rate - shared through ...
Definition dx_wasapi_client_device.h:224
@ exclusive
Definition dx_wasapi_client_device.h:48
key_value_tree< registry > preference
hierarchical preference store over the Windows registry see dx::key_value_tree (dx_key_value_tree....
Definition dx_registry.h:496
static constexpr auto mode
Definition dx_wasapi_client_device.h:312
unsigned int uint32_t
Definition wdk/dxd_platform.h:117

exclusive: every stream's client is recreated at the aligned rate, paused across it; shared: the engine's mix format rate is the only one

◆ sources

std::map<decltype(desc_t::stream::target.idx()), source_t> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::sources
inherited

source selectors by stream target: a stream with sources gets its own on first use

◆ start

template<typename object_t>
promoted<uint32_t> dx::stream::control< object_t >::start {0}
inherited

◆ started

template<typename object_t>
promoted<bool> dx::stream::control< object_t >::started {false}
inherited

◆ sync_reference

promoted<structdesc_t::stream*>::template preference<decltype(super::preference), uint32_t> dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::sync_reference
inherited

◆ version

dx::stream::device::monitor dx::stream::device< dx::stream::control< dx::device< std::string, preference_t > >, desc_t, stream_t, group_t >::version
inherited

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.