Line data Source code
1 : #pragma once
2 :
3 : #include <string>
4 : #include <vector>
5 :
6 : namespace Amplitron {
7 :
8 93 : struct WavData {
9 : std::vector<float> samples; // mono, normalized to [-1, 1]
10 31 : int sample_rate = 0;
11 31 : int channels = 0;
12 : };
13 :
14 : // Load a WAV file, mix down to mono, optionally resample to target_sample_rate.
15 : // Returns empty WavData (samples.empty()) on failure.
16 : // Caps IR length at max_length_samples if > 0.
17 : WavData load_wav_file(const std::string& filepath, int target_sample_rate = 0,
18 : int max_length_samples = 0);
19 :
20 : // Simple linear-interpolation resampler (mono only).
21 : std::vector<float> resample_linear(const std::vector<float>& input, int from_rate, int to_rate);
22 :
23 : } // namespace Amplitron
|