DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::wdf::RType< T, Children > Class Template Reference

N-port R-type adaptor for non-series/parallel interconnections. More...

#include <WDF.h>

Public Member Functions

 RType (const std::array< std::pair< int, int >, static_cast< size_t >(kNumPorts)> &portNodes, int numNodes, Children &... children) noexcept
 
void prepare (double sampleRate) noexcept
 
void updatePorts () noexcept
 
void reset () noexcept
 
double portResistance () const noexcept
 
reflected () noexcept
 
void incident (T aUp) noexcept
 

Static Public Attributes

static constexpr int kNumPorts = static_cast<int>(sizeof...(Children)) + 1
 
static constexpr int kMaxNodes = 12
 

Detailed Description

template<FloatType T, typename... Children>
class dspark::wdf::RType< T, Children >

N-port R-type adaptor for non-series/parallel interconnections.

Port 0 faces up (toward the root) and is adapted: its resistance is set to the Thévenin resistance seen into the network, making S(0,0) = 0. Ports 1..N-1 connect the children, in declaration order. The topology is a list of (node+, node-) pairs over a small node graph (-1 = ground reference).

On every updatePorts() the scattering matrix is rebuilt from Modified Nodal Analysis with the children's current port resistances – O(nodes^3), a few microseconds for typical circuits, fine for pot automation.

Template Parameters
TSample type of the wave interface.
ChildrenChild node types, one per port 1..N-1.

Definition at line 562 of file WDF.h.

Constructor & Destructor Documentation

◆ RType()

template<FloatType T, typename... Children>
dspark::wdf::RType< T, Children >::RType ( const std::array< std::pair< int, int >, static_cast< size_t >(kNumPorts)> &  portNodes,
int  numNodes,
Children &...  children 
)
inlinenoexcept
Parameters
portNodes(node+, node-) per port, port 0 first; -1 is ground.
numNodesNumber of non-ground nodes in the graph.
childrenChild elements bound to ports 1..N-1, in order.

Definition at line 574 of file WDF.h.

Member Function Documentation

◆ incident()

template<FloatType T, typename... Children>
void dspark::wdf::RType< T, Children >::incident ( aUp)
inlinenoexcept

Definition at line 659 of file WDF.h.

◆ portResistance()

template<FloatType T, typename... Children>
double dspark::wdf::RType< T, Children >::portResistance ( ) const
inlinenoexcept

Definition at line 645 of file WDF.h.

◆ prepare()

template<FloatType T, typename... Children>
void dspark::wdf::RType< T, Children >::prepare ( double  sampleRate)
inlinenoexcept

Definition at line 592 of file WDF.h.

◆ reflected()

template<FloatType T, typename... Children>
T dspark::wdf::RType< T, Children >::reflected ( )
inlinenoexcept

Definition at line 647 of file WDF.h.

◆ reset()

template<FloatType T, typename... Children>
void dspark::wdf::RType< T, Children >::reset ( )
inlinenoexcept

Definition at line 639 of file WDF.h.

◆ updatePorts()

template<FloatType T, typename... Children>
void dspark::wdf::RType< T, Children >::updatePorts ( )
inlinenoexcept

Definition at line 597 of file WDF.h.

Member Data Documentation

◆ kMaxNodes

template<FloatType T, typename... Children>
constexpr int dspark::wdf::RType< T, Children >::kMaxNodes = 12
staticconstexpr

Definition at line 566 of file WDF.h.

◆ kNumPorts

template<FloatType T, typename... Children>
constexpr int dspark::wdf::RType< T, Children >::kNumPorts = static_cast<int>(sizeof...(Children)) + 1
staticconstexpr

Definition at line 565 of file WDF.h.


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