@@ -2071,6 +2071,10 @@ The actual packets are taken | |||
be specified, but periods longer than 1 second may be automatically | |||
shortened for small level changes, due to numerical precision limits. | |||
</p> | |||
<p class=func><span class=keyword>read</span>();</p> | |||
<p class=desc>Read the current level. Returns -1.0 to 1.0. This can be | |||
useful for monitoring the amplitude after configuring a slow change. | |||
</p> | |||
<!-- | |||
<h3>Examples</h3> | |||
<p class=exam>File > Examples > Audio > |
@@ -127,6 +127,10 @@ public: | |||
state = 1; | |||
__enable_irq(); | |||
} | |||
float read(void) { | |||
int32_t m = magnitude; | |||
return (float)m * (1.0 / 2147418112.0); | |||
} | |||
virtual void update(void); | |||
private: | |||
uint8_t state; // 0=steady output, 1=transitioning |