Skip to content
Snippets Groups Projects
Waveform.cpp 1.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • #include "waveform.h"
    
    Waveform::WaveformParam::WaveformParam() {
        this->samplingRate = 0;
        this->freqResolution = 0;
    }
    
    Waveform::WaveformParam::WaveformParam(
        const WaveformParam& other
    ) {
        this->samplingRate = other.samplingRate;
        this->freqResolution = other.freqResolution;
        this->freqTones = other.freqTones;
        this->phases = other.phases;
        this->amplitudes = other.amplitudes;
    }
    
    void Waveform::WaveformParam::setFreqTone(
        int centerFreq, 
        int freqSpacing,
        int numTones
    ) {
        int freqStart = centerFreq - 
            freqSpacing * int(std::floor(numTones / 2));
        this->freqTones.setLinSpaced(
            numTones,
            freqStart,
            freqStart + freqSpacing * (numTones-1)
        );
    }
    
    void Waveform::WaveformParam::setFreqTone(
        const Eigen::VectorXi otherTones
    ) {
        this->freqTones = otherTones;
    }
    
    void Waveform::WaveformParam::setPhase(
        const Eigen::VectorXd otherPhase
    ) {
        this->phases = otherPhase;
    }
    
    void Waveform::WaveformParam::setAmplitude(
        const Eigen::VectorXd otherAmp
    ) {
        this->amplitudes = otherAmp;