MCPcopy Create free account
hub / github.com/Tracktion/choc / getDescription

Method getDescription

choc/audio/choc_AudioFileFormat.h:387–428  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

385
386//==============================================================================
387inline std::string AudioFileProperties::getDescription() const
388{
389 std::string desc;
390
391 if (! formatName.empty())
392 desc += "Format: " + formatName + "\n";
393
394 if (sampleRate > 0)
395 desc += "Rate: " + std::to_string (static_cast<uint32_t> (sampleRate)) + "Hz\n";
396
397 if (bitDepth != BitDepth::unknown)
398 desc += "Bit depth: " + std::string (getBitDepthDescription (bitDepth)) + "\n";
399
400 desc += "Frame count: " + std::to_string (numFrames) + "\n";
401
402 if (sampleRate > 0)
403 {
404 auto millisecs = (numFrames * 1000u) / static_cast<uint64_t> (sampleRate);
405 desc += "Length: " + choc::text::getDurationDescription (std::chrono::milliseconds (millisecs)) + "\n";
406 }
407
408 if (numChannels != 0)
409 desc += "Channels: " + std::to_string (numChannels) + "\n";
410
411 if (! speakers.empty())
412 {
413 std::vector<std::string> names;
414
415 for (auto& s : speakers)
416 names.push_back (std::string (getSpeakerName (s)));
417
418 desc += "Speakers: " + choc::text::joinStrings (names, ", ") + "\n";
419 }
420
421 if (! quality.empty())
422 desc += "Quality: " + quality + "\n";
423
424 if (! metadata.isVoid())
425 desc += "Metadata: " + choc::json::toString (metadata, true) + "\n";
426
427 return desc;
428}
429
430inline AudioFileFormat::AudioFileFormat() = default;
431inline AudioFileFormat::~AudioFileFormat() = default;

Callers

nothing calls this directly

Calls 8

getBitDepthDescriptionFunction · 0.85
getDurationDescriptionFunction · 0.85
getSpeakerNameFunction · 0.85
joinStringsFunction · 0.85
toStringFunction · 0.50
emptyMethod · 0.45
push_backMethod · 0.45
isVoidMethod · 0.45

Tested by

no test coverage detected