MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / WriteDataToFile

Method WriteDataToFile

Source/Sample.cpp:163–176  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

161
162//static
163bool Sample::WriteDataToFile(const std::string& path, float** data, int numSamples, int channels)
164{
165 auto wavFormat = std::make_unique<juce::WavAudioFormat>();
166 juce::File outputFile(ofToSamplePath(path));
167 outputFile.create();
168 auto outputTo = outputFile.createOutputStream();
169 assert(outputTo != nullptr);
170 bool b1{ false };
171 auto writer = std::unique_ptr<juce::AudioFormatWriter>(
172 wavFormat->createWriterFor(outputTo.release(), gSampleRate, channels, 16, b1, 0));
173 writer->writeFromFloatArrays(data, channels, numSamples);
174
175 return true;
176}
177
178//static
179bool Sample::WriteDataToFile(const std::string& path, ChannelBuffer* data, int numSamples)

Callers

nothing calls this directly

Calls 4

ofToSamplePathFunction · 0.85
createMethod · 0.80
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80

Tested by

no test coverage detected