Skip to content

Commit 770f590

Browse files
committed
CodecWAV: naming conflict
1 parent f892789 commit 770f590

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

src/AudioTools/AudioCodecs/CodecWAV.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ class WAVEncoder : public AudioEncoder {
533533
/// Associates an external encoder for non-PCM formats
534534
void setEncoder(AudioEncoderExt &enc, AudioFormat fmt) {
535535
TRACED();
536-
audioInfo.format = fmt;
536+
wav_info.format = fmt;
537537
p_encoder = &enc;
538538
}
539539

@@ -562,35 +562,35 @@ class WAVEncoder : public AudioEncoder {
562562

563563
/// Update actual WAVAudioInfo
564564
virtual void setAudioInfo(AudioInfo from) override {
565-
audioInfo.sample_rate = from.sample_rate;
566-
audioInfo.channels = from.channels;
567-
audioInfo.bits_per_sample = from.bits_per_sample;
565+
wav_info.sample_rate = from.sample_rate;
566+
wav_info.channels = from.channels;
567+
wav_info.bits_per_sample = from.bits_per_sample;
568568
// recalculate byte rate, block align...
569-
setAudioInfo(audioInfo);
569+
setAudioInfo(wav_info);
570570
}
571571

572572
/// Defines the WAVAudioInfo
573573
virtual void setAudioInfo(WAVAudioInfo ai) {
574574
AudioEncoder::setAudioInfo(ai);
575575
if (p_encoder) p_encoder->setAudioInfo(ai);
576-
audioInfo = ai;
577-
LOGI("sample_rate: %d", (int)audioInfo.sample_rate);
578-
LOGI("channels: %d", audioInfo.channels);
576+
wav_info = ai;
577+
LOGI("sample_rate: %d", (int)wav_info.sample_rate);
578+
LOGI("channels: %d", wav_info.channels);
579579
// bytes per second
580-
audioInfo.byte_rate = audioInfo.sample_rate * audioInfo.channels *
581-
audioInfo.bits_per_sample / 8;
582-
if (audioInfo.format == AudioFormat::PCM) {
583-
audioInfo.block_align =
584-
audioInfo.bits_per_sample / 8 * audioInfo.channels;
580+
wav_info.byte_rate = wav_info.sample_rate * wav_info.channels *
581+
wav_info.bits_per_sample / 8;
582+
if (wav_info.format == AudioFormat::PCM) {
583+
wav_info.block_align =
584+
wav_info.bits_per_sample / 8 * wav_info.channels;
585585
}
586-
if (audioInfo.is_streamed || audioInfo.data_length == 0 ||
587-
audioInfo.data_length >= 0x7fff0000) {
586+
if (wav_info.is_streamed || wav_info.data_length == 0 ||
587+
wav_info.data_length >= 0x7fff0000) {
588588
LOGI("is_streamed! because length is %u",
589-
(unsigned)audioInfo.data_length);
590-
audioInfo.is_streamed = true;
591-
audioInfo.data_length = ~0;
589+
(unsigned)wav_info.data_length);
590+
wav_info.is_streamed = true;
591+
wav_info.data_length = ~0;
592592
} else {
593-
size_limit = audioInfo.data_length;
593+
size_limit = wav_info.data_length;
594594
LOGI("size_limit is %d", (int)size_limit);
595595
}
596596
}
@@ -628,16 +628,16 @@ class WAVEncoder : public AudioEncoder {
628628

629629
if (!header_written) {
630630
LOGI("Writing Header");
631-
header.setAudioInfo(audioInfo);
631+
header.setAudioInfo(wav_info);
632632
int len = header.writeHeader(p_print);
633-
audioInfo.file_size -= len;
633+
wav_info.file_size -= len;
634634
header_written = true;
635635
}
636636

637637
int32_t result = 0;
638638
Print *p_out = p_encoder == nullptr ? p_print : &enc_out;
639639
;
640-
if (audioInfo.is_streamed) {
640+
if (wav_info.is_streamed) {
641641
result = p_out->write((uint8_t *)data, len);
642642
} else if (size_limit > 0) {
643643
size_t write_size = min((size_t)len, (size_t)size_limit);
@@ -659,14 +659,14 @@ class WAVEncoder : public AudioEncoder {
659659
bool isOpen() { return is_open; }
660660

661661
/// Adds n empty bytes at the beginning of the data
662-
void setDataOffset(uint16_t offset) { audioInfo.offset = offset; }
662+
void setDataOffset(uint16_t offset) { wav_info.offset = offset; }
663663

664664
protected:
665665
WAVHeader header;
666666
Print *p_print = nullptr; // final output CopyEncoder copy; // used for PCM
667667
AudioEncoderExt *p_encoder = nullptr;
668668
EncodedAudioOutput enc_out;
669-
WAVAudioInfo audioInfo = defaultConfig();
669+
WAVAudioInfo wav_info = defaultConfig();
670670
int64_t size_limit = 0;
671671
bool header_written = false;
672672
volatile bool is_open = false;
@@ -676,10 +676,10 @@ class WAVEncoder : public AudioEncoder {
676676
assert(p_print != nullptr);
677677
enc_out.setOutput(p_print);
678678
enc_out.setEncoder(p_encoder);
679-
enc_out.setAudioInfo(audioInfo);
679+
enc_out.setAudioInfo(wav_info);
680680
enc_out.begin();
681681
// block size only available after begin(): update block size
682-
audioInfo.block_align = p_encoder->blockSize();
682+
wav_info.block_align = p_encoder->blockSize();
683683
}
684684
}
685685
};

tests-cmake/build/ArduinoCore-API

Submodule ArduinoCore-API deleted from cd91833

0 commit comments

Comments
 (0)