Skip to content

Commit b9c1334

Browse files
committed
ResampleStream
1 parent 43bee66 commit b9c1334

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

examples/sandbox/examples-sdr/generator-am_sender-audiokit/generator-am_sender-audiokit.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ void setup() {
4040
audio_data.resize(num_samples);
4141
modulated_data.resize(num_samples);
4242

43+
// define resample
44+
auto rcfg = resample.defaultConfig();
4345
// define resample we resample the audio data from 44100 to 13M
44-
resample.begin(sample_rate, sample_rate_carrier);
46+
rcfg.step_size = resample.getStepSize(sample_rate, sample_rate_carrier);
47+
rcfg.channels = channels;
48+
resample.begin(rcfg);
4549

4650
// setup test tone
4751
auto cfgs = sound.defaultConfig();
48-
cfgs.sample_rate = sample_rate;
4952
cfgs.channels = channels;
5053
sound.begin(cfgs);
5154

examples/tests/test-resample-in/test-resample-in.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ void setup(void) {
1616
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
1717

1818
// define resample
19-
int sample_rate_from = sample_rate;
20-
int to_sample_rate = 22050;
21-
resample.begin(sample_rate_from, to_sample_rate);
19+
auto rcfg = resample.defaultConfig();
20+
rcfg.step_size = 0.5
21+
rcfg.channels = channels;
22+
resample.begin(rcfg);
2223

2324
// Define CSV Output
2425
auto config = out.defaultConfig();
25-
config.sample_rate = sample_rate;
2626
config.channels = channels;
2727
out.begin(config);
2828

examples/tests/test-resample-out/test-resample-out.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ void setup(void) {
1616
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
1717

1818
// define resample
19-
int sample_rate_from = sample_rate;
20-
int sample_rate_to = 22050;
21-
resample.begin(sample_rate_from, sample_rate_to);
19+
auto rcfg = resample.defaultConfig();
20+
rcfg.step_size = 0.5
21+
rcfg.channels = channels;
22+
resample.begin(rcfg);
2223

2324
// Define CSV Output
2425
auto config = out.defaultConfig();

src/AudioTools/Resample.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ResampleConfig : public AudioBaseInfo {
2222
* @tparam T
2323
*/
2424
template<typename T>
25-
class ResampleStream : public AudioStream {
25+
class ResampleStream : public AudioStreamX {
2626
public:
2727
/// Support for resampling via write.
2828
ResampleStream(Print &out, int channelCount=2){

0 commit comments

Comments
 (0)