Skip to content

Commit

Permalink
Fix a clang-tidy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Jun 13, 2022
1 parent c88a851 commit 486d569
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/DSP/AudioFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace ta
template<typename ExpectedFormat>
auto fileHasFormat(juce::AudioFormatManager& formatManager, juce::File const& file) -> bool
{
static_assert(std::is_base_of<juce::AudioFormat, ExpectedFormat>::value,
"ExpectedFormat must be a subclass of AudioFormat");

auto reader = std::unique_ptr<juce::AudioFormatReader>(formatManager.createReaderFor(file));
if (reader == nullptr) { return false; }
return dynamic_cast<ExpectedFormat*>(reader.get()) != nullptr;
Expand Down
3 changes: 2 additions & 1 deletion src/DSP/AudioFileConverter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ inline auto AudioFileConverter::convert(Options const& options) -> Result
auto writer = std::unique_ptr<juce::AudioFormatWriter>(format.createWriterFor(out.get(), sr, ch, bits, {}, 0));

if (writer == nullptr) { return Result{false, "Failed to convert to wav"}; }
out.release(); // writer took ownership
auto* p = out.release(); // writer took ownership
(void)p; // fixes nodiscard warning on release

writer->writeFromAudioReader(*reader, 0, reader->lengthInSamples);
writer->flush();
Expand Down

0 comments on commit 486d569

Please sign in to comment.