MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / checkDirection

Function checkDirection

tests/audio_device_negotiator_test.cpp:34–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void 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

Callers 1

mainFunction · 0.85

Calls 8

probeFunction · 0.85
toStringFunction · 0.85
formatLadderFunction · 0.85
isNullMethod · 0.80
reportFunction · 0.70
negotiateFunction · 0.50
isEmptyMethod · 0.45
sampleRateMethod · 0.45

Tested by

no test coverage detected