Hi, I want to create a wav file from a buffer using filechooser in order to let select the user the location of the file. My code is this:
auto soundChooser = std::make_unique<juce::FileChooser>("Please save your IR");
soundChooser->launchAsync(juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles, [this](const juce::FileChooser& chooser)
{
auto file = chooser.getResult();
if (file.exists())
{
auto outputFile = chooser.getResult();
std::unique_ptr<juce::FileOutputStream> outStream;
outStream = outputFile.createOutputStream();
juce::WavAudioFormat format;
std::unique_ptr<juce::AudioFormatWriter> writer;
writer.reset (format.createWriterFor (outStream.get(),
44100,
audioSampleBufferOut.getNumChannels(),
24,
{},
0));
if (writer != nullptr)
writer->writeFromAudioSampleBuffer (audioSampleBufferOut, 0, audioSampleBufferOut.getNumSamples());
outStream.release();
}
});
My problem is that CMAKE is showing me the message: Variable ‘audioSampleBufferOut’ cannot be implicitly captured in a lambda with no capture-default specified.
I’m implementing this function in a subsection called by AudioProcessor (only is triggered once when you click button designed to save a file).
Thank you in advance!