Skip to content

Commit 98e8482

Browse files
committed
Automatic handle latency changes in AudioGraph
1 parent cb90564 commit 98e8482

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

modules/yup_audio_graph/graph/yup_AudioGraphProcessor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ class AudioGraphProcessor::Pimpl final : private AudioProcessor::Listener
410410
if (details.latencyChanged)
411411
{
412412
latencyChangeCounter.fetch_add (1);
413+
414+
if (! commitInProgress.load())
415+
{
416+
ignoreUnused (commitChanges());
417+
}
413418
}
414419
}
415420

modules/yup_audio_graph/graph/yup_AudioGraphProcessor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ namespace yup
2929
Topology edits are made to a control-thread graph model. commitChanges()
3030
validates the model, prepares newly compiled nodes for the current playback
3131
configuration, and publishes an immutable processing plan. Child processor
32-
latency notifications mark the graph dirty; call commitChanges() from the
33-
control thread to rebuild delay compensation. Metadata edits such as node
34-
positions and properties are saved by the model without invalidating the
35-
compiled plan. processBlock() only swaps pending plans at block boundaries
36-
and keeps retired plans alive until a later control-thread commit or destruction.
32+
latency notifications are handled by the graph as host notifications and
33+
rebuild delay compensation. Metadata edits such as node positions and
34+
properties are saved by the model without invalidating the compiled plan.
35+
processBlock() only swaps pending plans at block boundaries and keeps retired
36+
plans alive until a later control-thread commit or destruction.
3737
*/
3838
class YUP_API AudioGraphProcessor final : public AudioProcessor
3939
{

tests/yup_audio_graph/yup_AudioGraphProcessor.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,11 +1220,6 @@ TEST (AudioGraphProcessorTests, ExternalTopologyEditsDriveDirtyRevision)
12201220
ASSERT_NE (nullptr, processor);
12211221

12221222
processor->setLatencySamplesForTest (16);
1223-
EXPECT_TRUE (graph.hasUncommittedChanges());
1224-
EXPECT_EQ (0, graph.getLatencySamples());
1225-
EXPECT_EQ (latencyQueriesAfterCommit, latencyQueryCount.load());
1226-
1227-
EXPECT_TRUE (graph.commitChanges().wasOk());
12281223
EXPECT_FALSE (graph.hasUncommittedChanges());
12291224
EXPECT_EQ (16, graph.getLatencySamples());
12301225
EXPECT_GT (latencyQueryCount.load(), latencyQueriesAfterCommit);

0 commit comments

Comments
 (0)