Made it such that the signal generator always starts from the start (pos 0)
All checks were successful
Building, testing and releasing LASP if it has a tag / Build-Test-Ubuntu (push) Successful in -5m57s
Building, testing and releasing LASP if it has a tag / Release-Ubuntu (push) Has been skipped

This commit is contained in:
Thijs Hekman 2024-12-03 11:24:20 +01:00
parent 4cd390871a
commit cf672dc9d7
3 changed files with 8 additions and 2 deletions

View File

@ -38,6 +38,7 @@ protected:
int _interruption_frame_count = 0;
virtual void resetImpl() = 0;
virtual void resetPos() = 0;
virtual vd genSignalUnscaled(const us nframes) = 0;
public:
@ -75,7 +76,7 @@ public:
*
* @param mute if true
*/
void setMute(bool mute = true) { _muted = mute; _interruption_frame_count=0; }
void setMute(bool mute = true) { _muted = mute; _interruption_frame_count=0; resetPos();}
/**
* @brief Set the level of the signal generator

View File

@ -29,6 +29,7 @@ vd Noise::genSignalUnscaled(us nframes)
return arma::randn<vd>(nframes);
}
void Noise::resetImpl() {}
void Noise::resetPos() {}
Sine::Sine(const d freq) : omg(2 * arma::datum::pi * freq) { DEBUGTRACE_ENTER; }

View File

@ -18,6 +18,7 @@ class Noise : public Siggen {
d level_linear;
virtual vd genSignalUnscaled(const us nframes) override;
void resetImpl() override;
void resetPos() override;
public:
/**
@ -39,6 +40,7 @@ class Sine : public Siggen {
protected:
void resetImpl() override final { phase = 0; }
void resetPos() override final { phase = 0; }
virtual vd genSignalUnscaled(const us nframes) override final;
public:
@ -73,6 +75,8 @@ class Periodic: public Siggen {
void setA(const vd& A);
void resetPos() override final { _cur_pos = 0; }
virtual vd genSignalUnscaled(const us nframes) override final;
vd getA() const { return A_; }
@ -91,7 +95,7 @@ class Sweep : public Periodic {
vd fn_ { 1, arma::fill::zeros};
void resetImpl() override;
public:
static constexpr int ForwardSweep = 1 << 0;
static constexpr int BackwardSweep = 1 << 1;