Skip to content

Commit d208e3f

Browse files
committed
Renaming
1 parent ccec90d commit d208e3f

File tree

5 files changed

+51
-51
lines changed

5 files changed

+51
-51
lines changed

Sources/CSoundpipeAudioKit/Effects/PitchCorrectDSP.mm

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "SoundpipeDSPBase.h"
44
#include "ParameterRamper.h"
55
#include "Soundpipe.h"
6-
#include "autotune.h"
6+
#include "pitchcorrect.h"
77

88
enum PitchCorrectParameter : AUParameterAddress {
99
PitchCorrectParameterSpeed,
@@ -14,8 +14,8 @@
1414
private:
1515
sp_rms *rms_l;
1616
sp_rms *rms_r;
17-
autotune *autotune_l;
18-
autotune *autotune_r;
17+
pitchcorrect *pitchcorrect_l;
18+
pitchcorrect *pitchcorrect_r;
1919
ParameterRamper speedRamp;
2020
ParameterRamper amountRamp;
2121

@@ -31,10 +31,10 @@ void init(int channelCount, double sampleRate) override {
3131
sp_rms_init(sp, rms_l);
3232
sp_rms_create(&rms_r);
3333
sp_rms_init(sp, rms_r);
34-
autotune_create(&autotune_l);
35-
autotune_init(sp, autotune_l);
36-
autotune_create(&autotune_r);
37-
autotune_init(sp, autotune_r);
34+
pitchcorrect_create(&pitchcorrect_l);
35+
pitchcorrect_init(sp, pitchcorrect_l);
36+
pitchcorrect_create(&pitchcorrect_r);
37+
pitchcorrect_init(sp, pitchcorrect_r);
3838

3939
// Create chromatic scale from A220 to A440
4040
float scale[13] = {
@@ -53,8 +53,8 @@ void init(int channelCount, double sampleRate) override {
5353
440.00 // A
5454
};
5555

56-
autotune_set_scale_freqs(autotune_l, scale, 13);
57-
autotune_set_scale_freqs(autotune_r, scale, 13);
56+
pitchcorrect_set_scale_freqs(pitchcorrect_l, scale, 13);
57+
pitchcorrect_set_scale_freqs(pitchcorrect_r, scale, 13);
5858
}
5959

6060
void deinit() override {
@@ -83,17 +83,17 @@ void process(FrameRange range) override {
8383

8484
float leftOut = 0, rightOut = 0;
8585

86-
autotune_set_speed(autotune_l, speed);
87-
autotune_set_amount(autotune_l, amount);
86+
pitchcorrect_set_speed(pitchcorrect_l, speed);
87+
pitchcorrect_set_amount(pitchcorrect_l, amount);
8888

89-
autotune_set_speed(autotune_r, speed);
90-
autotune_set_amount(autotune_r, amount);
89+
pitchcorrect_set_speed(pitchcorrect_r, speed);
90+
pitchcorrect_set_amount(pitchcorrect_r, amount);
9191

9292
sp_rms_compute(sp, rms_l, &leftIn, &rms_l_out);
93-
autotune_compute(sp, autotune_l, &leftIn, &leftOut, rms_l_out);
93+
pitchcorrect_compute(sp, pitchcorrect_l, &leftIn, &leftOut, rms_l_out);
9494

9595
sp_rms_compute(sp, rms_r, &rightIn, &rms_r_out);
96-
autotune_compute(sp, autotune_r, &rightIn, &rightOut, rms_r_out);
96+
pitchcorrect_compute(sp, pitchcorrect_r, &rightIn, &rightOut, rms_r_out);
9797

9898
outputSample(0, i) = leftOut;
9999
outputSample(1, i) = rightOut;

Sources/Soundpipe/include/arp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ typedef struct {
1616

1717
int arp_create(arp **p);
1818
int arp_init(sp_data *sp, arp *p);
19-
int arp_compute(sp_data *sp, arp *p, float *in, float autotune_freq, float *out);
19+
int arp_compute(sp_data *sp, arp *p, float *in, float pitchcorrect_freq, float *out);
2020

2121
#endif /* arp_h */
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef autotune_h
2-
#define autotune_h
1+
#ifndef pitchcorrect_h
2+
#define pitchcorrect_h
33

44
#ifdef __cplusplus
55
extern "C" {
@@ -8,7 +8,7 @@ extern "C" {
88
#include <stdio.h>
99
#include <stdint.h>
1010
#include <stdbool.h>
11-
#include "soundpipe.h"
11+
#include "Soundpipe.h"
1212
#include "Yin.h"
1313
#include "circular_buffer.h"
1414
#include "pitchshift.h"
@@ -41,23 +41,23 @@ typedef struct {
4141
bool should_smooth_target_freq;
4242

4343
bool should_update_scale_freqs;
44-
float *autotune_scale_freqs;
45-
int autotune_scale_freqs_count;
44+
float *pitchcorrect_scale_freqs;
45+
int pitchcorrect_scale_freqs_count;
4646
float *tmp_scale_freqs;
4747
int tmp_scale_freqs_count;
48-
} autotune;
48+
} pitchcorrect;
4949

50-
int autotune_create(autotune **p);
51-
int autotune_init(sp_data *sp, autotune *p);
52-
int autotune_compute(sp_data *sp, autotune *p, float *in, float *out, float rms);
53-
int autotune_set_scale_freqs(autotune *p, float *frequencies, int count);
54-
int autotune_set_amount(autotune *p, float amount);
55-
int autotune_set_speed(autotune *p, float speed);
50+
int pitchcorrect_create(pitchcorrect **p);
51+
int pitchcorrect_init(sp_data *sp, pitchcorrect *p);
52+
int pitchcorrect_compute(sp_data *sp, pitchcorrect *p, float *in, float *out, float rms);
53+
int pitchcorrect_set_scale_freqs(pitchcorrect *p, float *frequencies, int count);
54+
int pitchcorrect_set_amount(pitchcorrect *p, float amount);
55+
int pitchcorrect_set_speed(pitchcorrect *p, float speed);
5656

5757
#ifdef __cplusplus
5858
}
5959
#endif
6060

6161

62-
#endif /* autotune_h */
62+
#endif /* pitchcorrect_h */
6363

Sources/Soundpipe/modules/Custom Soundpipe Modules/arp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int arp_init(sp_data *sp, arp *p) {
2121
return SP_OK;
2222
}
2323

24-
int arp_compute(sp_data *sp, arp *p, float *in, float autotune_freq, float *out) {
24+
int arp_compute(sp_data *sp, arp *p, float *in, float pitchcorrect_freq, float *out) {
2525
float del_out = 0.0;
2626
float pshift_out = 0.0;
2727

@@ -32,8 +32,8 @@ int arp_compute(sp_data *sp, arp *p, float *in, float autotune_freq, float *out)
3232
for (int i = 0; i < p->num_steps; i++) {
3333
sp_delay_compute(sp, &p->dels[i], in, &del_out);
3434
if (del_out != 0.0) {
35-
if (autotune_freq > 0) {
36-
*p->pshifts[i].window = (1.0 / autotune_freq) * (float)sp->sr;
35+
if (pitchcorrect_freq > 0) {
36+
*p->pshifts[i].window = (1.0 / pitchcorrect_freq) * (float)sp->sr;
3737
*p->pshifts[i].xfade = *p->pshifts[i].window / 2.0f;
3838
}
3939

Sources/Soundpipe/modules/Custom Soundpipe Modules/autotune.c renamed to Sources/Soundpipe/modules/Custom Soundpipe Modules/pitchcorrect.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <stdlib.h>
22
#include <math.h>
33
#include <string.h>
4-
#include "autotune.h"
4+
#include "pitchcorrect.h"
55
#include "Yin.h"
66
#include "circular_buffer.h"
77

@@ -11,12 +11,12 @@
1111
float min_freq = 20.0;
1212
float max_freq = 3000.0;
1313

14-
int autotune_create(autotune **p) {
15-
*p = malloc(sizeof(autotune));
14+
int pitchcorrect_create(pitchcorrect **p) {
15+
*p = malloc(sizeof(pitchcorrect));
1616
return SP_OK;
1717
}
1818

19-
int autotune_init(sp_data *sp, autotune *p) {
19+
int pitchcorrect_init(sp_data *sp, pitchcorrect *p) {
2020
pitchshift2_create(&p->pshift2);
2121
pitchshift2_init(sp, p->pshift2, min_freq, max_freq);
2222
pitchcalculate_create(&p->pcalc);
@@ -46,19 +46,19 @@ int autotune_init(sp_data *sp, autotune *p) {
4646
return SP_OK;
4747
}
4848

49-
float nearest_scale_freq_index(autotune *p, float freq) {
49+
float nearest_scale_freq_index(pitchcorrect *p, float freq) {
5050
if (freq < 0) {
5151
return 0.0;
5252
}
5353

5454
float nearest_difference = 10000.0;
5555
float nearest = 10.0;
5656
float nearest_index = -1;
57-
for (int i = 0; i < p->autotune_scale_freqs_count; i++) {
58-
float diff = fabs(p->autotune_scale_freqs[i] - freq);
57+
for (int i = 0; i < p->pitchcorrect_scale_freqs_count; i++) {
58+
float diff = fabs(p->pitchcorrect_scale_freqs[i] - freq);
5959
if (diff < nearest_difference) {
6060
nearest_difference = diff;
61-
nearest = p->autotune_scale_freqs[i];
61+
nearest = p->pitchcorrect_scale_freqs[i];
6262
nearest_index = (float)i;
6363
} else if (diff > nearest_difference) {
6464
break;
@@ -78,7 +78,7 @@ float semitone_ratio(float scale_freq, float detected_freq) {
7878
return 1.0;
7979
}
8080

81-
int yin_add_to_buff(sp_data *sp, autotune *p, float *in) {
81+
int yin_add_to_buff(sp_data *sp, pitchcorrect *p, float *in) {
8282
float lpf_out;
8383
sp_butlp_compute(sp, p->lpf, in, &lpf_out);
8484

@@ -93,7 +93,7 @@ int yin_add_to_buff(sp_data *sp, autotune *p, float *in) {
9393
return SP_OK;
9494
}
9595

96-
int compute_yin_pitch(sp_data *sp, autotune *p) {
96+
int compute_yin_pitch(sp_data *sp, pitchcorrect *p) {
9797
if (p->buff->count >= p->yin->bufferSize) {
9898
cb_pop_multiple(p->buff, p->intBuffer, p->yin->bufferSize, 16);
9999
float freq = Yin_getPitch(p->yin, p->intBuffer);
@@ -111,7 +111,7 @@ int compute_yin_pitch(sp_data *sp, autotune *p) {
111111
return SP_OK;
112112
}
113113

114-
int compute_nearest_scale_freq_index(sp_data *sp, autotune *p) {
114+
int compute_nearest_scale_freq_index(sp_data *sp, pitchcorrect *p) {
115115
p->scale_freq_index_acc++;
116116

117117
float freq = p->detected_freq;
@@ -130,8 +130,8 @@ int compute_nearest_scale_freq_index(sp_data *sp, autotune *p) {
130130
}
131131

132132
int integerScaleIndex = (int)roundf(p->nearest_scale_freq_index);
133-
if (integerScaleIndex >= 0 && integerScaleIndex < p->autotune_scale_freqs_count) {
134-
p->target_freq = p->autotune_scale_freqs[integerScaleIndex];
133+
if (integerScaleIndex >= 0 && integerScaleIndex < p->pitchcorrect_scale_freqs_count) {
134+
p->target_freq = p->pitchcorrect_scale_freqs[integerScaleIndex];
135135
}
136136
}
137137

@@ -153,10 +153,10 @@ int compute_nearest_scale_freq_index(sp_data *sp, autotune *p) {
153153
return SP_OK;
154154
}
155155

156-
int autotune_compute(sp_data *sp, autotune *p, float *in, float *out, float rms) {
156+
int pitchcorrect_compute(sp_data *sp, pitchcorrect *p, float *in, float *out, float rms) {
157157
if (p->should_update_scale_freqs) {
158-
p->autotune_scale_freqs = p->tmp_scale_freqs;
159-
p->autotune_scale_freqs_count = p->tmp_scale_freqs_count;
158+
p->pitchcorrect_scale_freqs = p->tmp_scale_freqs;
159+
p->pitchcorrect_scale_freqs_count = p->tmp_scale_freqs_count;
160160
p->should_update_scale_freqs = false;
161161
p->scale_freq_index_acc = 128;
162162
p->should_smooth_scale_idx = false;
@@ -224,7 +224,7 @@ int autotune_compute(sp_data *sp, autotune *p, float *in, float *out, float rms)
224224
return SP_OK;
225225
}
226226

227-
int autotune_set_scale_freqs(autotune *p, float *frequencies, int count) {
227+
int pitchcorrect_set_scale_freqs(pitchcorrect *p, float *frequencies, int count) {
228228
float *new_freqs = malloc(sizeof(float) * count);
229229
memcpy(new_freqs, frequencies, sizeof(float) * count);
230230
p->tmp_scale_freqs = new_freqs;
@@ -233,12 +233,12 @@ int autotune_set_scale_freqs(autotune *p, float *frequencies, int count) {
233233
return SP_OK;
234234
}
235235

236-
int autotune_set_amount(autotune *p, float amount) {
236+
int pitchcorrect_set_amount(pitchcorrect *p, float amount) {
237237
p->amount = amount;
238238
return SP_OK;
239239
}
240240

241-
int autotune_set_speed(autotune *p, float speed) {
241+
int pitchcorrect_set_speed(pitchcorrect *p, float speed) {
242242
p->speed = speed;
243243
p->scale_freq_port->htime = -0.05 * speed + 0.05;
244244
return SP_OK;

0 commit comments

Comments
 (0)