-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathImpulseResponse.h
More file actions
58 lines (48 loc) · 1.4 KB
/
ImpulseResponse.h
File metadata and controls
58 lines (48 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// ImpulseResponse.h
// NeuralAmpModeler-macOS
//
// Created by Steven Atkinson on 12/30/22.
//
// Impulse response processing
#pragma once
#include <filesystem>
#include <Eigen/Dense>
#include "dsp.h"
#include "wav.h"
namespace dsp
{
class ImpulseResponse : public History
{
public:
struct IRData;
ImpulseResponse(const char* fileName, const double sampleRate);
ImpulseResponse(const IRData& irData, const double sampleRate);
ImpulseResponse(const unsigned char* data, size_t dataSize, double sampleRate);
double** Process(double** inputs, const size_t numChannels, const size_t numFrames) override;
IRData GetData();
double GetSampleRate() const { return mSampleRate; };
// TODO states for the IR class
dsp::wav::LoadReturnCode GetWavState() const { return this->mWavState; };
private:
// Set the weights, given that the plugin is running at the provided sample
// rate.
void _SetWeights();
// State of audio
dsp::wav::LoadReturnCode mWavState;
// Keep a copy of the raw audio that was loaded so that it can be resampled
std::vector<float> mRawAudio;
double mRawAudioSampleRate;
// Resampled to the required sample rate.
std::vector<float> mResampled;
double mSampleRate;
const size_t mMaxLength = 8192;
// The weights
Eigen::VectorXf mWeight;
};
struct dsp::ImpulseResponse::IRData
{
std::vector<float> mRawAudio;
double mRawAudioSampleRate;
};
}; // namespace dsp