-
Notifications
You must be signed in to change notification settings - Fork 0
/
scale.cpp
27 lines (24 loc) · 836 Bytes
/
scale.cpp
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
void scale(complex data[], WavFile wav_file, uint64_t N, const char *mode, int freq)
{
double points_per_freq = (double)N / (double)wav_file.header.SamplesRate;
double target_idx = points_per_freq * freq; // traget freq
double target_idx_n = N - (int)target_idx;
int start = (int)target_idx - 100;
int end = (int)target_idx + 100;
int start_n = (int)target_idx_n - 100;
int end_n = (int)target_idx_n + 100;
if (strcmp(mode, "gain") == 0)
{
for (int i = start; i < end; i++)
toDouble(data[i]);
for (int i = start_n; i < end_n; i++)
toDouble(data[i]);
}
else if (strcmp(mode, "debuff") == 0)
{
for (int i = start; i < end; i++)
toZero(data[i]);
for (int i = start_n; i < end_n; i++)
toZero(data[i]);
}
}