==============================================================================
| 385 | |
| 386 | //============================================================================== |
| 387 | inline 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 | |
| 430 | inline AudioFileFormat::AudioFileFormat() = default; |
| 431 | inline AudioFileFormat::~AudioFileFormat() = default; |
nothing calls this directly
no test coverage detected