Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::pm::Bow< Law > Class Template Reference

Detailed Description

template<typename Law>
class sbl::dsp::pm::Bow< Law >

Definition at line 34 of file bow.hpp.

#include <bow.hpp>

Inheritance diagram for sbl::dsp::pm::Bow< Law >:
[legend]

Public Member Functions

 Bow ()
 
Law & law ()
 The law, for its own parameters (a table, a rosin).
 
const Law & law () const
 
void set_velocity_su (float su)
 How fast the bow travels across the string. Smoothed.
 
void set_pressure_su (float su)
 How hard it presses: which force slice the law reads. Zero is no contact. Smoothed.
 
void advance (uint16_t n)
 A block's worth of port movement.
 
float excite (const JunctionState &j)
 One sample: the force on the string for the junction's state.
 
float energy () const
 A bow stores nothing: it only does work on the string.
 
void reset ()
 
bool sticking () const
 True while the bow holds the string (with weight on it).
 
float limit () const
 The static limit the bow holds the string with right now, in wave units.
 
float force () const
 The force injected on the last sample, in wave units.
 
diagram::Ports describe (diagram::Graph &g, uint8_t group, const char *name="bow") const
 The velocity source into the friction junction. Never called from audio code.
 

Static Public Attributes

static constexpr float DEFAULT_VELOCITY_SU = 0.5f
 
static constexpr float DEFAULT_PRESSURE_SU = 0.5f
 
static constexpr float MAX_VELOCITY = 0.5f
 wave units at full speed
 
static constexpr float SMOOTH_MS = 20.0f
 
static constexpr float MIN_PRESSURE_SU = 0.001f
 

Constructor & Destructor Documentation

◆ Bow()

Member Function Documentation

◆ law() [1/2]

template<typename Law >
Law & sbl::dsp::pm::Bow< Law >::law ( )
inline

The law, for its own parameters (a table, a rosin).

Definition at line 55 of file bow.hpp.

◆ law() [2/2]

template<typename Law >
const Law & sbl::dsp::pm::Bow< Law >::law ( ) const
inline

Definition at line 56 of file bow.hpp.

◆ set_velocity_su()

template<typename Law >
void sbl::dsp::pm::Bow< Law >::set_velocity_su ( float  su)
inline

How fast the bow travels across the string. Smoothed.

Definition at line 61 of file bow.hpp.

References sbl::dsp::math::clamp01(), and sbl::dsp::primitives::SmoothedPort::set().

◆ set_pressure_su()

template<typename Law >
void sbl::dsp::pm::Bow< Law >::set_pressure_su ( float  su)
inline

How hard it presses: which force slice the law reads. Zero is no contact. Smoothed.

Definition at line 64 of file bow.hpp.

References sbl::dsp::math::clamp01(), and sbl::dsp::primitives::SmoothedPort::set().

◆ advance()

template<typename Law >
void sbl::dsp::pm::Bow< Law >::advance ( uint16_t  n)
inline

◆ excite()

template<typename Law >
float sbl::dsp::pm::Bow< Law >::excite ( const JunctionState &  j)
inline

One sample: the force on the string for the junction's state.

Definition at line 77 of file bow.hpp.

References sbl::dsp::pm::JunctionState::impedance, sbl::dsp::primitives::SoftLimiter::limit(), and sbl::dsp::pm::JunctionState::velocity.

◆ energy()

template<typename Law >
float sbl::dsp::pm::Bow< Law >::energy ( ) const
inline

A bow stores nothing: it only does work on the string.

Definition at line 85 of file bow.hpp.

◆ reset()

◆ sticking()

template<typename Law >
bool sbl::dsp::pm::Bow< Law >::sticking ( ) const
inline

True while the bow holds the string (with weight on it).

Definition at line 102 of file bow.hpp.

◆ limit()

template<typename Law >
float sbl::dsp::pm::Bow< Law >::limit ( ) const
inline

The static limit the bow holds the string with right now, in wave units.

Definition at line 104 of file bow.hpp.

◆ force()

template<typename Law >
float sbl::dsp::pm::Bow< Law >::force ( ) const
inline

The force injected on the last sample, in wave units.

Definition at line 106 of file bow.hpp.

◆ describe()

template<typename Law >
diagram::Ports sbl::dsp::pm::Bow< Law >::describe ( diagram::Graph &  g,
uint8_t  group,
const char *  name = "bow" 
) const
inline

The velocity source into the friction junction. Never called from audio code.

Definition at line 109 of file bow.hpp.

References sbl::dsp::diagram::Graph::add_edge(), sbl::dsp::diagram::Graph::add_node(), sbl::dsp::diagram::Ports::in, sbl::dsp::diagram::Source, and sbl::dsp::diagram::Velocity.

Member Data Documentation

◆ DEFAULT_VELOCITY_SU

template<typename Law >
constexpr float sbl::dsp::pm::Bow< Law >::DEFAULT_VELOCITY_SU = 0.5f
staticconstexpr
Note
All public methods are ISR-safe — bounded computation, no I/O.

Definition at line 40 of file bow.hpp.

Referenced by sbl::dsp::pm::Bow< Law >::Bow().

◆ DEFAULT_PRESSURE_SU

template<typename Law >
constexpr float sbl::dsp::pm::Bow< Law >::DEFAULT_PRESSURE_SU = 0.5f
staticconstexpr

Definition at line 41 of file bow.hpp.

Referenced by sbl::dsp::pm::Bow< Law >::Bow().

◆ MAX_VELOCITY

template<typename Law >
constexpr float sbl::dsp::pm::Bow< Law >::MAX_VELOCITY = 0.5f
staticconstexpr

wave units at full speed

Definition at line 42 of file bow.hpp.

Referenced by sbl::dsp::pm::Bow< Law >::advance(), and sbl::dsp::pm::Bow< Law >::reset().

◆ SMOOTH_MS

template<typename Law >
constexpr float sbl::dsp::pm::Bow< Law >::SMOOTH_MS = 20.0f
staticconstexpr

Definition at line 43 of file bow.hpp.

Referenced by sbl::dsp::pm::Bow< Law >::reset().

◆ MIN_PRESSURE_SU

template<typename Law >
constexpr float sbl::dsp::pm::Bow< Law >::MIN_PRESSURE_SU = 0.001f
staticconstexpr

Below this the bow is off the string. A smoothed port only approaches zero, so "no pressure" has to be a threshold; the lightest bow is this.

Definition at line 46 of file bow.hpp.

Referenced by sbl::dsp::pm::Bow< Law >::advance(), and sbl::dsp::pm::Bow< Law >::reset().


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