Skip to content

Commit d835bf6

Browse files
committed
DynamicResamplingQueueStream: log step_size
1 parent bb5f97d commit d835bf6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/AudioTools/Sandbox/DynamicResamplingQueueStream.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ class DynamicResamplingQueueStream : public AudioStream {
5555
moving_average_level_percent.add(p_buffer->levelPercent());
5656
step_size = pid.calculate(50.0, moving_average_level_percent.average());
5757

58+
// log step size every 10th read
59+
if (read_count++ % 10 == 0) {
60+
LOGI("step_size: %f", step_size);
61+
}
62+
5863
// return resampled result
5964
resample_stream.setStepSize(step_size);
6065
return resample_stream.readBytes(data, len);
@@ -64,8 +69,9 @@ class DynamicResamplingQueueStream : public AudioStream {
6469
moving_average_level_percent.setSize(size);
6570
}
6671

67-
/// e.g. a value of 0.0005 means that we allow to resample for 44100 by +- 22.05 from 44077.95 to 44122.05
68-
void setStepRangePercent(float rangePercent){
72+
/// e.g. a value of 0.0005 means that we allow to resample for 44100 by
73+
/// +- 22.05 from 44077.95 to 44122.05
74+
void setStepRangePercent(float rangePercent) {
6975
resample_range = rangePercent / 100.0;
7076
}
7177

@@ -82,6 +88,7 @@ class DynamicResamplingQueueStream : public AudioStream {
8288
float p = 0.005;
8389
float i = 0.00005;
8490
float d = 0.0001;
91+
uint32_t read_count = 0;
8592
};
8693

8794
} // namespace audio_tools

0 commit comments

Comments
 (0)