dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::coreaudio::driver< device_t > Class Template Referenceabstract

coreaudio driver interface class More...

#include <dx_coreaudio_driver.h>

Inheritance diagram for dx::coreaudio::driver< device_t >:
Collaboration diagram for dx::coreaudio::driver< device_t >:

Classes

struct  property
 this bus's name in the device tree and the preference store More...

Public Types

typedef std::conditional_t< held, typename view::template iterator< typename holders::const_iterator >, typename holders::const_iterator > const_iterator
typedef std::conditional_t< held, typename view::template iterator< typename holders::iterator >, typename holders::iterator > iterator
typedef driver map
typedef decltype(matching_idsmatch
typedef driver_settings< dx::promoted< dx::log >::preference< preference_t > > settings
typedef std::conditional_t< held, typename view::value_type, typename holders::value_type > value_type

Public Member Functions

const_iterator begin () const noexcept
iterator begin () noexcept
bool boot () override
void conclude () noexcept override
 conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.
bool contains (const std::string &id) noexcept
supercreate (const std::string &id, const typename device_t::desc_t &desc) override
virtual drivercreate (const std::string &id, const typename super::device_t::desc_t &)
superdestroy (const std::string &id) override
 driver (const char *product_id, dx::log log={})
 driver (const match &matching_ids, const char *product_id, decltype(super::preference)&&preference, dx::log log={})
 the driver interface class constructor
 driver (const match &matching_ids, const char *product_id, dx::log log={})
const_iterator end () const noexcept
iterator end () noexcept
void exception (const class exception &exception, bool filtered=false) const noexcept override
 notification exception handler
virtual void exception (const exception &exception, bool filtered=false) const noexcept=0
 notification exception handler
iterator find (const device_id_t &device_id)
const_iterator find (const device_id_t &device_id) const
void info (std::ostream &os) noexcept override
 log object class information
void launch () override
 launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.
 operator bool () const noexcept override
superoperator<< (const char *file) override
superoperator<< (std::ifstream &ifstream) override
 restores device tree
superoperator>> (std::ostream &ostream) const override
 saves device tree
virtual driveroperator>> (const char *file) const
bool shutdown () override
 client driver::shutdown/boot(): override to shutdown/boot host driver
bool try_conclude () noexcept
 atomically conclude()s if currently launched; returns whether this call did it
bool try_launch ()
 atomically launch()es if not already launched; returns whether this call did it
std::shared_ptr< typename super::device_twait (const std::string &id) noexcept

Public Attributes

promoted::property<::AudioObjectID > connection_id
elements
 STL member.
dx::driver_settings host
 the plugin's settings mirrored: born with the plugin's property as their server (dx_value.h: no promoted is born empty)
keys
 STL member.
std::atomic< bool > launched {}
dx::log log {}
 cached local log level, mirrors settings::log
preference_t preference
const char * product_id
promoted< os_resultstatus {driver_not_connected}
 the driver's condition, promoted so a host follows it without polling
uint32_t version {DX_VERSION32}

Protected Types

typedef decltype(device_t::id) device_id_t
typedef std::map< device_id_t, std::shared_ptr< device_t > > holders

Protected Member Functions

virtual void add (const device_id_t &)=0
 adds a new device to the device list
void add (const device_id_t &device_id) override
 adds a new device to the device list
virtual void arrived ()
 notify device arrivals completed stub
void arrived (super::device_t &device) override
virtual void clear () noexcept
 replaces std::map::clear to call virtual notification methods
virtual void notify (::AudioObjectID id, const coreaudio::property::addresses &addresses)
virtual void remove (const device_id_t &)=0
 finds and removes a device from the device list
void remove (const device_id_t &device_id) override
 finds and removes a device from the device list
virtual void removed () noexcept
 notify device removals completed stub
virtual void removed (device_t &) noexcept
 notify specific device removal stub
virtual void scan ()
void sleep () override
 < notify system will sleep
void wake () override

Protected Attributes

std::map<::AudioObjectPropertySelector, coreaudio::property::listenlisten
std::vector< coreaudio::property::dictionarymatching_ids

Detailed Description

template<class device_t>
class dx::coreaudio::driver< device_t >

coreaudio driver interface class

This is the coreaudio interface to a driver identified by a set of matching dictionaries. The driver class is a helper to create device objects and to bind the device to the driver identified by the set of matching dictionaries.

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

Member Typedef Documentation

◆ const_iterator

typedef std::conditional_t<held, typename view::template iterator<typename holders::const_iterator>, typename holders::const_iterator> dx::map::driver< device_t, device_t >::const_iterator
inherited

◆ device_id_t

typedef decltype(device_t::id) dx::map::driver< device_t, device_t >::device_id_t
protectedinherited

◆ holders

typedef std::map<device_id_t, std::shared_ptr<device_t> > dx::map::driver< device_t, device_t >::holders
protectedinherited

◆ iterator

typedef std::conditional_t<held, typename view::template iterator<typename holders::iterator>, typename holders::iterator> dx::map::driver< device_t, device_t >::iterator
inherited

◆ map

typedef driver dx::map::driver< device_t, device_t >::map
inherited

◆ match

template<class device_t>
typedef decltype(matching_ids) dx::coreaudio::driver< device_t >::match

◆ settings

template<typename device_id_t, typename preference_t>
typedef driver_settings<dx::promoted<dx::log>::preference<preference_t> > dx::driver< device_id_t, preference_t >::settings
inherited

the driver's own settings: the log a promoted::preference on the store's dx::log::id node, resolved like a stream desc (dx::log's DX_TREE_SERIALIZE), the constructor's log its default - stored as no entry, reloaded on the store's change

◆ value_type

typedef std::conditional_t<held, typename view::value_type, typename holders::value_type> dx::map::driver< device_t, device_t >::value_type
inherited

Constructor & Destructor Documentation

◆ driver() [1/3]

template<class device_t>
dx::coreaudio::driver< device_t >::driver ( const match & matching_ids,
const char * product_id,
decltype(super::preference)&& preference,
dx::log log = {} )
inline

the driver interface class constructor

Todo
handle kext blocking https://developer.apple.com/library/content/technotes/tn2459/_index.html
Parameters
matching_idsthe matching dictionaries identifying the driver interface
product_iddrivers bundle ID
preferencepreference

◆ driver() [2/3]

template<class device_t>
dx::coreaudio::driver< device_t >::driver ( const match & matching_ids,
const char * product_id,
dx::log log = {} )
inline

◆ driver() [3/3]

template<class device_t>
dx::coreaudio::driver< device_t >::driver ( const char * product_id,
dx::log log = {} )
inline

Member Function Documentation

◆ add() [1/2]

template<typename device_id_t, typename preference_t>
virtual void dx::driver< device_id_t, preference_t >::add ( const device_id_t & )
protectedpure virtualinherited

adds a new device to the device list

Exceptions
dx::exception

◆ add() [2/2]

void dx::map::driver< device_t, device_t >::add ( const device_id_t & device_id)
inlineoverrideprotectedinherited

adds a new device to the device list

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

◆ arrived() [1/2]

( )
protectedvirtualinherited

notify device arrivals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

Here is the caller graph for this function:

◆ arrived() [2/2]

void dx::stream::driver< map::driver< device_t > >::arrived ( super::device_t & )
inlineoverrideprotectedvirtualinherited

Reimplemented from dx::map::driver< device_t >.

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

◆ begin() [1/2]

const_iterator dx::map::driver< device_t, device_t >::begin ( ) const
inlinenoexceptinherited

◆ begin() [2/2]

iterator dx::map::driver< device_t, device_t >::begin ( )
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boot()

template<class device_t>
bool dx::coreaudio::driver< device_t >::boot ( )
inlineoverridevirtual

Reimplemented from dx::driver< device_id_t, preference_t >.

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

◆ clear()

virtual void dx::map::driver< device_t, device_t >::clear ( )
inlineprotectedvirtualnoexceptinherited

replaces std::map::clear to call virtual notification methods

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

◆ conclude()

void dx::map::driver< device_t, device_t >::conclude ( )
inlineoverridevirtualnoexceptinherited

conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

Reimplemented in dx::midi::services::driver< device_t >, dx::service::client::driver< device_t >, and dx::wasapi::client::driver< device_t >.

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

◆ contains()

bool dx::stream::driver< map::driver< device_t > >::contains ( const std::string & id)
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [1/2]

template<class device_t>
super & dx::coreaudio::driver< device_t >::create ( const std::string & id,
const typename device_t::desc_t & desc )
inlineoverride
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [2/2]

virtual driver & dx::stream::driver< map::driver< device_t > >::create ( const std::string & id,
const typename super::device_t::desc_t &  )
inlinevirtualinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

template<class device_t>
super & dx::coreaudio::driver< device_t >::destroy ( const std::string & id)
inlineoverridevirtual

Reimplemented from dx::stream::driver< map::driver< device_t > >.

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

◆ end() [1/2]

const_iterator dx::map::driver< device_t, device_t >::end ( ) const
inlinenoexceptinherited

◆ end() [2/2]

iterator dx::map::driver< device_t, device_t >::end ( )
inlinenoexceptinherited
Here is the caller graph for this function:

◆ exception() [1/2]

template<typename device_id_t, typename preference_t>
void dx::driver< device_id_t, preference_t >::exception ( const class exception & exception,
bool filtered = false ) const
inlineoverridenoexceptinherited

notification exception handler

Here is the caller graph for this function:

◆ exception() [2/2]

virtual void dx::object::exception ( const exception & exception,
bool filtered = false ) const
pure virtualnoexceptinherited

notification exception handler

Implemented in dx::asio::client::_device< desc_t, preference_t, stream_t, group_t >, dx::asio::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::asio::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::device< id_t, preference_t >, dx::device< dx::guid, preference >, dx::device< std::string, dx::preference >, dx::device< std::string, preference >, dx::device< std::string, preference_t >, dx::device<::AudioObjectID, cf::preference >, dx::device<::io_service_t, dx::preference >, dx::device<::io_service_t, preference_t >, dx::device<::MIDIDeviceRef, cf::preference >, dx::device<>, dx::proxy::device< preference_t >, dx::proxy::device< preference_t >, dx::proxy::device< dx::preference >, dx::proxy::device<>, dx::service::app, dx::service::client::_device< desc_t, preference_t, stream_t, group_t >, dx::service::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::service::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::service::device< preference_t >, dx::service::device< dx::preference >, dx::service::device< super_device_t >, dx::stream::object< _device_t >, dx::stream::object< device<> >, dx::stream::pin< device_t, _circular_t >, dx::usb::device< preference_t >, dx::usb::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::stream::pipe< device_t, circular_t, stream_t >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t, group_t >, dx::virtuel::stream::_device< desc, dx::preference, dx::stream::shared::stream< device< desc, dx::preference, dx::stream::shared::stream, group > >, group< device< desc, dx::preference, dx::stream::shared::stream, group > > >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, and dx::wasapi::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >.

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

◆ find() [1/2]

iterator dx::map::driver< device_t, device_t >::find ( const device_id_t & device_id)
inlineinherited
Here is the caller graph for this function:

◆ find() [2/2]

const_iterator dx::map::driver< device_t, device_t >::find ( const device_id_t & device_id) const
inlineinherited

◆ info()

template<class device_t>
void dx::coreaudio::driver< device_t >::info ( std::ostream & os)
inlineoverridevirtualnoexcept

log object class information

Reimplemented from dx::object.

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

◆ launch()

template<class device_t>
void dx::coreaudio::driver< device_t >::launch ( )
inlineoverridevirtual

launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

Here is the call graph for this function:

◆ notify()

template<class device_t>
virtual void dx::coreaudio::driver< device_t >::notify ( ::AudioObjectID id,
const coreaudio::property::addresses & addresses )
inlineprotectedvirtual
Todo
coreaudio::driver::notify(): evaluate other synchronization options
Here is the call graph for this function:

◆ operator bool()

template<class device_t>
dx::coreaudio::driver< device_t >::operator bool ( ) const
inlineoverridenoexcept

◆ operator<<() [1/2]

template<class device_t>
super & dx::coreaudio::driver< device_t >::operator<< ( const char * file)
inlineoverridevirtual

Reimplemented from dx::map::driver< device_t >.

Here is the call graph for this function:

◆ operator<<() [2/2]

template<class device_t>
super & dx::coreaudio::driver< device_t >::operator<< ( std::ifstream & ifstream)
inlineoverridevirtual

restores device tree

Reimplemented from dx::map::driver< device_t >.

Here is the call graph for this function:

◆ operator>>() [1/2]

template<class device_t>
super & dx::coreaudio::driver< device_t >::operator>> ( std::ostream & ostream) const
inlineoverridevirtual

saves device tree

Reimplemented from dx::map::driver< device_t >.

Here is the call graph for this function:

◆ operator>>() [2/2]

virtual driver & dx::map::driver< device_t, device_t >::operator>> ( const char * file) const
inlinevirtualinherited

◆ remove() [1/2]

template<typename device_id_t, typename preference_t>
virtual void dx::driver< device_id_t, preference_t >::remove ( const device_id_t & )
protectedpure virtualinherited

finds and removes a device from the device list

◆ remove() [2/2]

void dx::map::driver< device_t, device_t >::remove ( const device_id_t & device_id)
inlineoverrideprotectedinherited

finds and removes a device from the device list

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

◆ removed() [1/2]

( )
protectedvirtualinherited

notify device removals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

Here is the caller graph for this function:

◆ removed() [2/2]

virtual void dx::map::driver< device_t, device_t >::removed ( device_t & )
inlineprotectedvirtualnoexceptinherited

notify specific device removal stub

Here is the caller graph for this function:

◆ scan()

template<class device_t>
virtual void dx::coreaudio::driver< device_t >::scan ( )
inlineprotectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

template<class device_t>
bool dx::coreaudio::driver< device_t >::shutdown ( )
inlineoverridevirtual

client driver::shutdown/boot(): override to shutdown/boot host driver

Reimplemented from dx::driver< device_id_t, preference_t >.

◆ sleep()

void dx::map::driver< device_t, device_t >::sleep ( )
inlineoverrideprotectedinherited

< notify system will sleep

notify system wake completed stub

◆ try_conclude()

bool dx::object::try_conclude ( )
inlinenoexceptinherited

atomically conclude()s if currently launched; returns whether this call did it

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

◆ try_launch()

bool dx::object::try_launch ( )
inlineinherited

atomically launch()es if not already launched; returns whether this call did it

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

◆ wait()

std::shared_ptr< typename super::device_t > dx::stream::driver< map::driver< device_t > >::wait ( const std::string & id)
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wake()

void dx::map::driver< device_t, device_t >::wake ( )
inlineoverrideprotectedinherited

Member Data Documentation

◆ connection_id

template<class device_t>
promoted::property<::AudioObjectID> dx::coreaudio::driver< device_t >::connection_id
Initial value:
{::kAudioObjectSystemObject,
{.mSelector= ::kAudioHardwarePropertyTranslateBundleIDToPlugIn},
{[this](::AudioObjectID value){
this->host.log.initialized= false;
if(value){
this->version= cf::type<uint32_t>{static_cast<::CFNumberRef>(property)};
}
{(void)static_cast<dx::log>(this->host.log);} ;
}else
if(this->launched){
this->conclude();
launch();
}}},
{.data= static_cast<const void*>(static_cast<::CFStringRef>(*this)), .size= sizeof(::CFStringRef)},
}
Definition cf_reference.h:36
coreaudio driver interface class
Definition dx_coreaudio_driver.h:55
void launch() override
launch notification: object mounted and ready to use. Called only through try_launch() - never call t...
Definition dx_coreaudio_driver.h:232
std::map<::AudioObjectPropertySelector, coreaudio::property::listen > listen
Definition dx_coreaudio_driver.h:89
dx::driver_settings host
the plugin's settings mirrored: born with the plugin's property as their server (dx_value....
Definition dx_coreaudio_driver.h:188
coreaudio::property
Definition dx_coreaudio_property.h:100
std::atomic< bool > launched
Definition dx_common.h:248
virtual void conclude() noexcept
conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite...
Definition dx_common.h:269
#define dx_assert(expression,...)
Definition dx_assert.h:31
#define DX_VERSION_FORMAT
Definition dx_macros.h:79
#define DX_VERSION32
Definition dx_macros.h:77
#define DX_VERSION32_FORMAT(v32)
Definition dx_macros.h:68
#define DX_VERSION_MASK_COMPATIBILITY
Definition dx_macros.h:102
#define DX_STRINGIFY(...)
Definition dx_macros.h:34
std::string version(uint32_t v32)
a DX_VERSION32 word as it is read: major.minor.sub with the deployment letter and the build number be...
Definition dx_common.h:588
this bus's name in the device tree and the preference store
Definition dx_coreaudio_driver.h:203
static constexpr auto version
Definition dx_coreaudio_property.h:142

◆ elements

T std::map< K, T >::elements
inherited

STL member.

◆ host

Initial value:
{
[this](dx::promoted<dx::log>::lock_t&& lock, const dx::log& value, const dx::log&){
{
dx::log current;
current= cf::dictionary<::CFDictionaryRef>{static_cast<::CFDictionaryRef>(property)};
if(this->host.log.transient&& value!= current)
property= static_cast<::CFDictionaryRef>(current= value);
this->log= current;
this->host.log.commit(std::move(lock), current);
}
}
}
key value pair store
Definition cf_dictionary.h:50
promoted::property<::AudioObjectID > connection_id
Definition dx_coreaudio_driver.h:165
std::unique_lock< mutex_t > lock_t
Definition dx_value.h:75
static constexpr auto log
Definition dx_coreaudio_property.h:145
the whole log setting in one 32 bit word: a dx::log::level per dx::log::scope per dx::log::module,...
Definition dx_log.h:49

the plugin's settings mirrored: born with the plugin's property as their server (dx_value.h: no promoted is born empty)

◆ keys

K std::map< K, T >::keys
inherited

STL member.

◆ launched

std::atomic<bool> dx::object::launched {}
inherited

◆ listen

template<class device_t>
std::map<::AudioObjectPropertySelector, coreaudio::property::listen> dx::coreaudio::driver< device_t >::listen
protected
Initial value:
{
{::kAudioHardwarePropertyPlugInList,
{kAudioObjectSystemObject, {.mSelector= ::kAudioHardwarePropertyPlugInList},
std::bind(&driver::notify, this, std::placeholders::_1, std::placeholders::_2)}},
{::kAudioHardwarePropertyDevices,
{::kAudioObjectSystemObject, {.mSelector= ::kAudioHardwarePropertyDevices},
std::bind(&driver::notify, this, std::placeholders::_1, std::placeholders::_2)}},
}
virtual void notify(::AudioObjectID id, const coreaudio::property::addresses &addresses)
Definition dx_coreaudio_driver.h:67

◆ log

template<typename device_id_t, typename preference_t>
dx::log dx::driver< device_id_t, preference_t >::log {}
inherited

cached local log level, mirrors settings::log

◆ matching_ids

template<class device_t>
std::vector<coreaudio::property::dictionary> dx::coreaudio::driver< device_t >::matching_ids
protected

◆ preference

template<typename device_id_t, typename preference_t>
preference_t dx::driver< device_id_t, preference_t >::preference
inherited

◆ product_id

template<typename device_id_t, typename preference_t>
const char* dx::driver< device_id_t, preference_t >::product_id
inherited

◆ status

template<typename device_id_t, typename preference_t>
promoted<os_result> dx::driver< device_id_t, preference_t >::status {driver_not_connected}
inherited

the driver's condition, promoted so a host follows it without polling

◆ version

template<typename device_id_t, typename preference_t>
uint32_t dx::driver< device_id_t, preference_t >::version {DX_VERSION32}
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.