diff options
author | marwik15 <marwik15@gmail.com> | 2022-05-02 11:30:54 +0200 |
---|---|---|
committer | marwik15 <marwik15@gmail.com> | 2022-05-02 11:30:54 +0200 |
commit | d417394ae791e9972fede0665587aa612f93bca0 (patch) | |
tree | 1087d58f9db079327b9f516157a31b6821b7997f /daemon/src/Sinewave.h | |
parent | ac5e26518a780f19483585cd6b5d62de9094c2b8 (diff) | |
download | hwd-d417394ae791e9972fede0665587aa612f93bca0.zip hwd-d417394ae791e9972fede0665587aa612f93bca0.tar.gz hwd-d417394ae791e9972fede0665587aa612f93bca0.tar.bz2 |
Add sine wave generator
Diffstat (limited to 'daemon/src/Sinewave.h')
-rw-r--r-- | daemon/src/Sinewave.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/daemon/src/Sinewave.h b/daemon/src/Sinewave.h new file mode 100644 index 0000000..d8988ad --- /dev/null +++ b/daemon/src/Sinewave.h @@ -0,0 +1,33 @@ +#pragma once + +#include <string> +#include <math.h> +#include <chrono> + +#include "Assembly.h" + +class Sinewave { + +public: + Sinewave(); + + void apply(AssemblyContext ctx); + + void set_amplitude(double amplitude); + void set_frequency(double frequency); + void set_phase(double phase); + + double get_amplitude() const; + double get_frequency() const; + double get_phase() const; + +private: + std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time, m_current_time; + std::chrono::duration<double> m_duration_time; + + double m_amplitude; + double m_frequency; + double m_phase; + + double get_point(); +}; |