feat: sine tone audio in testpattern node

testpattern now optionally writes an audio flow when audio_flow_id is
wired in the graph. Each channel generates a sine wave at (c+1)*1000 Hz
(ch0=1kHz, ch1=2kHz, ...) at -18 dBFS broadcast reference level.

Phase is derived from the absolute audio_index so there are no clicks
at frame boundaries. One audio chunk per video frame (1920 samples at
48kHz/25fps), written via mxlFlowWriterOpenSamples with ring-buffer
fragment and channel stride handling matching ndiin.

build_graph: separate UUIDs for testpattern and ndiin flows; wire
testpattern audio_flow_id (no sink yet).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
JohannesItten
2026-07-01 13:26:22 +03:00
parent 42507886fe
commit bb4d527cbe
2 changed files with 96 additions and 28 deletions
+8 -6
View File
@@ -38,8 +38,10 @@ static std::string gen_uuid() {
static dmf::FlowGraph build_graph() {
dmf::FlowGraph g;
const std::string video_flow = gen_uuid();
const std::string audio_flow = gen_uuid();
const std::string tp_video_flow = gen_uuid();
const std::string tp_audio_flow = gen_uuid();
const std::string ndi_video_flow = gen_uuid();
const std::string ndi_audio_flow = gen_uuid();
g.nodes = {
{ "testpattern", "testpattern", {{"pattern", "bars"}} },
{ "ndiin", "ndiin", {} },
@@ -53,10 +55,10 @@ static dmf::FlowGraph build_graph() {
{"kind","audio"}, {"sample_rate",48000}, {"channels",2}, {"bit_depth",32}
};
g.edges = {
{ video_flow, "ndiin", "video_flow_id", "fakesink", "flow_id", video_fmt },
{ video_flow, "ndiin", "video_flow_id", "ndiout", "flow_id", video_fmt },
// audio_flow_id wired to ndiin only — no sink node yet, readers added later
{ audio_flow, "ndiin", "audio_flow_id", "", "", audio_fmt },
{ tp_video_flow, "testpattern", "flow_id", "fakesink", "flow_id", video_fmt },
{ tp_audio_flow, "testpattern", "audio_flow_id", "", "", audio_fmt },
{ ndi_video_flow, "ndiin", "video_flow_id", "ndiout", "flow_id", video_fmt },
{ ndi_audio_flow, "ndiin", "audio_flow_id", "", "", audio_fmt },
};
return g;
}