Stepdance Software Library
Loading...
Searching...
No Matches
filters.hpp
1#include <stdint.h>
2#include <sys/types.h>
3/*
4Filters Module of the StepDance Control System
5
6This module contains an assortment of motion filters
7
8[More Details to be Added]
9
10A part of the Mixing Metaphors Project
11(c) 2025 Ilan Moyer, Jennifer Jacobs, Devon Frost
12
13*/
14#include "core.hpp"
15
16#ifndef filters_h //prevent importing twice
17#define filters_h
25class ScalingFilter1D : public Plugin{
26 // Generates an output signal in proportion to one input signal.
27
28 public:
29 ScalingFilter1D();
34 void begin(uint8_t mode = INCREMENTAL);
39 void set_ratio(ControlParameter ratio);
45 inline void set_ratio(ControlParameter output_distance, ControlParameter input_distance){
46 set_ratio(output_distance / input_distance);
47 }
48
52 void enroll(RPC *rpc, const String& instance_name);
53
54 ControlParameter ratio = 1.0; // output / input
58
59 // BlockPorts
68
69 private:
70 DecimalPosition input_position;
71 DecimalPosition output_position;
72 uint8_t mode = INCREMENTAL;
73
74 protected:
75 void run();
76};
77
83class ScalingFilter2D : public Plugin{
84 // Generates two output signals, each in proportion to an input signal.
85
86 public:
87 ScalingFilter2D();
92 void begin(uint8_t mode = INCREMENTAL);
97 void set_ratio(ControlParameter ratio);
103 inline void set_ratio(ControlParameter output_distance, ControlParameter input_distance){
104 set_ratio(output_distance / input_distance);
105 }
106
110 void enroll(RPC *rpc, const String& instance_name);
115 ControlParameter ratio = 1.0; // output / input
116
117 // BlockPorts
134
135
136 private:
137 DecimalPosition input_1_position;
138 DecimalPosition input_2_position;
139 DecimalPosition output_1_position;
140 DecimalPosition output_2_position;
141 uint8_t mode = INCREMENTAL;
142
143 protected:
144 void run();
145};
146
147#endif
BlockPorts provide a unified interface for mapping inputs and outputs of different StepDance componen...
Definition core.hpp:148
RPC class for handling remote procedure calls over serial streams.
Definition rpc.hpp:35
void begin(uint8_t mode=INCREMENTAL)
Initializes the ScalingFilter1D with the specified mode.
BlockPort input
Input BlockPort. Map upstream components to the input.
Definition filters.hpp:63
void set_ratio(ControlParameter output_distance, ControlParameter input_distance)
Sets the scaling ratio using output and input distances.
Definition filters.hpp:45
BlockPort output
Output BlockPort. Map downstream components to the output.
Definition filters.hpp:67
void set_ratio(ControlParameter ratio)
Sets the scaling ratio between output and input.
void set_ratio(ControlParameter ratio)
Sets the scaling ratio between output and input.
void set_ratio(ControlParameter output_distance, ControlParameter input_distance)
Sets the scaling ratio using output and input distances.
Definition filters.hpp:103
BlockPort input_1
First input BlockPort. Map upstream components to this input.
Definition filters.hpp:121
ControlParameter ratio
ControlParameter scaling output relative to input (output/input). Can be set by calling set_ratio().
Definition filters.hpp:115
void begin(uint8_t mode=INCREMENTAL)
Initializes the ScalingFilter2D with the specified mode. Must be called to set up the filter.
BlockPort output_1
First output BlockPort corresponding to the scaled input_1. Map downstream components to this output.
Definition filters.hpp:129
BlockPort output_2
Second output BlockPort corresponding to the scaled input_2. Map downstream components to this output...
Definition filters.hpp:133
BlockPort input_2
Second input BlockPort. Map upstream components to this input.
Definition filters.hpp:125