MCPcopy Create free account
hub / github.com/bbc/audiowaveform / convertWaveformData

Method convertWaveformData

src/OptionHandler.cpp:276–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274//------------------------------------------------------------------------------
275
276bool OptionHandler::convertWaveformData(
277 const boost::filesystem::path& input_filename,
278 const FileFormat::FileFormat input_format,
279 const boost::filesystem::path& output_filename,
280 const FileFormat::FileFormat output_format,
281 const Options& options)
282{
283 WaveformBuffer buffer;
284
285 if (!loadWaveformData(buffer, input_filename, input_format)) {
286 return false;
287 }
288
289 const int bits = options.hasBits() ? options.getBits() : buffer.getBits();
290
291 bool success = true;
292
293 const boost::filesystem::path output_file_ext = output_filename.extension();
294
295 if (output_format == FileFormat::Dat) {
296 success = buffer.save(output_filename.string().c_str(), bits);
297 }
298 else if (output_format == FileFormat::Json) {
299 success = buffer.saveAsJson(output_filename.string().c_str(), bits);
300 }
301 else if (output_format == FileFormat::Txt) {
302 success = buffer.saveAsText(output_filename.string().c_str(), bits);
303 }
304
305 return success;
306}
307
308//------------------------------------------------------------------------------
309

Callers

nothing calls this directly

Calls 6

loadWaveformDataFunction · 0.85
hasBitsMethod · 0.80
saveMethod · 0.80
saveAsJsonMethod · 0.80
saveAsTextMethod · 0.80
getBitsMethod · 0.45

Tested by

no test coverage detected