Repository navigation
P0 First Sound: real RAW input and MAIN PCM diagnostics in native mixer #411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
masarray
merged 8 commits into
main
from
integration/first-sound-signal-evidence-20261105
Nov 5, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c2a8627
feat(audio): expose source-only verified capture and MAIN PCM evidenc…
masarray a98eb8d
fix(first-sound): replace fake G0 zero meters with guarded callback P…
masarray 81c3cbc
fix(meter): preserve genuine over-zero-dBFS clipped input peaks rathe…
masarray 10b0ae4
feat(first-sound): pure tested RAW input/MAIN PCM diagnosis from real…
masarray 87baf58
feat(gui): show genuine RAW input/MAIN PCM levels and actionable Firs…
masarray e84c0c2
test(native): prove First Sound RAW pin and MAIN PCM evidence; reject…
masarray 3f56b97
test(first-sound): sparse physical input PCM diagnosis, output ARM an…
masarray 18fc3e7
test(ui): match accurate PCM versus hardware-audibility status labels
masarray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // SPDX-License-Identifier: AGPL-3.0-only | ||
| #pragma once | ||
| #include <juce_core/juce_core.h> | ||
| #include <cmath> | ||
| #include <memory> | ||
|
|
||
| // JUCE MESSAGE-thread evidence projection. Raw values come ONLY from the | ||
| // installed LiveAudioEngine callback atomics; this does not produce PCM, | ||
| // read the audio device, invent a signal, or claim audible speaker output. | ||
| namespace armix::console { | ||
| inline bool evidenceFlag(const juce::var& o, const char* name, bool expected) { | ||
| const auto v=o.getProperty(name,{}); | ||
| return v.isBool() && static_cast<bool>(v)==expected; | ||
| } | ||
| inline bool evidenceInteger(const juce::var& v, double& n) { | ||
| if(!(v.isInt()||v.isInt64()||v.isDouble()))return false; | ||
| n=static_cast<double>(v); | ||
| return std::isfinite(n) && n>=0.0 && n<=9007199254740991.0 | ||
| && std::floor(n)==n; | ||
| } | ||
| inline bool evidencePeak(const juce::var& v, double& peak) { | ||
| if(!(v.isInt()||v.isInt64()||v.isDouble()))return false; | ||
| peak=static_cast<double>(v); | ||
| return std::isfinite(peak) && peak>=0.0 && peak<=16.0; | ||
| } | ||
| inline juce::var projectFirstSoundSignalEvidence( | ||
| const juce::var& live, bool verifiedDirectOpen, | ||
| bool primaryOutputArmed, int activeInputCount, int activeOutputCount) | ||
| { | ||
| auto t=std::make_unique<juce::DynamicObject>(); | ||
| // Empty/never-called capture must be UNKNOWN, not a synthetic zero | ||
| // that misleadingly suggests a working microphone or driver. | ||
| t->setProperty("captureObserved",false); | ||
| t->setProperty("rawCapturePresent",false); | ||
| t->setProperty("rawCapturePeak",juce::var()); | ||
| t->setProperty("captureCallbackPeaks",juce::var(juce::Array<juce::var>{})); | ||
| t->setProperty("mainPcmObserved",false); | ||
| t->setProperty("mainPcmPresent",false); | ||
| t->setProperty("mainPcmPeak",juce::var()); | ||
| t->setProperty("monitorPcmPresent",false); | ||
| if(!live.isObject() || !verifiedDirectOpen || | ||
| activeInputCount<=0 || activeInputCount>64 || | ||
| activeOutputCount<2 || activeOutputCount>64) | ||
| return juce::var(t.release()); | ||
| const auto route=live.getProperty("dryRoutingLab",{}); | ||
| if(!route.isObject() || | ||
| !evidenceFlag(live,"connected",true) || | ||
| !evidenceFlag(live,"directRouteAuthorized",true) || | ||
| !evidenceFlag(live,"adaptiveClockActive",false) || | ||
| !evidenceFlag(route,"active",true) || | ||
| !evidenceFlag(route,"ready",true) || | ||
| !evidenceFlag(route,"topologyFault",false)) | ||
| return juce::var(t.release()); | ||
| double observations=0.,inCount=0.,outCount=0.,inputPeak=0.; | ||
| if(!evidenceInteger(live.getProperty("captureObservationBlocks",{}),observations) || | ||
| observations<1. || | ||
| !evidenceInteger(live.getProperty("callbackInputChannels",{}),inCount) || | ||
| !evidenceInteger(live.getProperty("callbackOutputChannels",{}),outCount) || | ||
| inCount!=activeInputCount || outCount!=activeOutputCount || | ||
| !evidencePeak(live.getProperty("inputPeak",{}),inputPeak)) | ||
| return juce::var(t.release()); | ||
| const auto peaks=live.getProperty("captureCallbackPeaks",{}); | ||
| const auto* list=peaks.getArray(); | ||
| if(!list || list->size()!=activeInputCount) | ||
| return juce::var(t.release()); | ||
| juce::Array<juce::var> verifiedPeaks; | ||
| for(const auto& value:*list) { | ||
| double peak=0.; | ||
| if(!evidencePeak(value,peak)) | ||
| return juce::var(t.release()); | ||
| verifiedPeaks.add(peak); | ||
| } | ||
| t->setProperty("captureObserved",true); | ||
| t->setProperty("rawCapturePeak",inputPeak); | ||
| t->setProperty("rawCapturePresent",inputPeak>0.0005); | ||
| t->setProperty("captureCallbackPeaks",juce::var(verifiedPeaks)); | ||
| // MAIN telemetry is measured *post* fader/FX/output gate, but remains | ||
| // PCM evidence only: it can never certify actual DAC/earphone playback. | ||
| if(primaryOutputArmed && | ||
| evidenceFlag(route,"hasAcceptedRoute",true) && | ||
| evidenceFlag(live,"monitor",true)) { | ||
| double left=0.,right=0.; | ||
| if(evidencePeak(live.getProperty("peakLeft",{}),left) && | ||
| evidencePeak(live.getProperty("peakRight",{}),right)) { | ||
| const auto peak=juce::jmax(left,right); | ||
| t->setProperty("mainPcmObserved",true); | ||
| t->setProperty("mainPcmPeak",peak); | ||
| t->setProperty("mainPcmPresent",peak>0.0005); | ||
| } | ||
| } | ||
| return juce::var(t.release()); | ||
| } | ||
| } // namespace armix::console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this status text leaves
tests/approved_native_m2_contract.test.cjs:449asserting/REAL NATIVE PCM · FAT PENDING/, which no longer appears in the bridge. Runningnode --test tests/approved_native_m2_contract.test.cjsfails on that assertion. Both.github/workflows/ui-smoke.ymland.github/workflows/p1-windows.ymlrun this contract suite, so the change breaks qualification even when the native implementation is otherwise correct. Update the assertion to match the intended new wording.Useful? React with 👍 / 👎.