| 32 | } |
| 33 | |
| 34 | void checkDirection(const char* label, const QAudioDevice& dev, AFN::Direction dir) |
| 35 | { |
| 36 | if (dev.isNull()) { |
| 37 | std::printf("[SKIP] %-58s (no device on this runner)\n", label); |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | // Probe must produce a non-empty, self-consistent capability snapshot. |
| 42 | const AFN::DeviceCaps caps = AudioDeviceNegotiator::probe(dev, dir); |
| 43 | report(std::string(label) + ": probe found rates", |
| 44 | !caps.supportedRates.isEmpty(), |
| 45 | caps.supportedRates.isEmpty() ? "no rates probed" : ""); |
| 46 | |
| 47 | // Negotiation must succeed and yield an openable (positive-rate) format. |
| 48 | const auto r = AudioDeviceNegotiator::negotiate( |
| 49 | dev, dir, AFN::ResamplerPolicy::PreservePan); |
| 50 | report(std::string(label) + ": negotiate ok", |
| 51 | r.ok && r.format.sampleRate() > 0 && r.format.channelCount() >= 1, |
| 52 | r.ok ? (std::string("rate=") + std::to_string(r.format.sampleRate()) |
| 53 | + " ch=" + std::to_string(r.format.channelCount()) |
| 54 | + " resampler=" + AFN::toString(r.resampler)) |
| 55 | : "negotiate failed"); |
| 56 | |
| 57 | // The format ladder must be non-empty and start at the preferred rung. |
| 58 | const auto ladder = AudioDeviceNegotiator::formatLadder( |
| 59 | dev, dir, AFN::ResamplerPolicy::PreservePan); |
| 60 | report(std::string(label) + ": ladder non-empty", !ladder.isEmpty()); |
| 61 | } |
| 62 | |
| 63 | } // namespace |
| 64 |
no test coverage detected