@@ -1032,4 +1032,33 @@ BOOST_AUTO_TEST_CASE (AudioFeedbackPrevention)
10321032 BOOST_REQUIRE (! feedbackAllowed);
10331033}
10341034
1035+ BOOST_AUTO_TEST_CASE (IONodeMinimumAudioPortCount)
1036+ {
1037+ // Test that Audio I/O nodes get a minimum port count when added to a graph with zero audio ports
1038+ // This prevents the bug where Audio Input/Output nodes appear with zero ports
1039+
1040+ PreparedGraph fix;
1041+ GraphNode& graph = fix.graph ;
1042+
1043+ fix.graph .clear ();
1044+ graph.setNumPorts (PortType::Audio, 0 , true , false );
1045+ graph.setNumPorts (PortType::Audio, 0 , false , false );
1046+
1047+ // Verify graph starts with zero audio ports configured
1048+ BOOST_REQUIRE_EQUAL (graph.getNumPorts (PortType::Audio, true ), 0 );
1049+ BOOST_REQUIRE_EQUAL (graph.getNumPorts (PortType::Audio, false ), 0 );
1050+
1051+ // Add Audio Input node - should set graph audio inputs to minimum 2 (stereo)
1052+ auto * audioIn = new IONode (IONode::audioInputNode);
1053+ graph.addNode (audioIn);
1054+ BOOST_REQUIRE_EQUAL (graph.getNumPorts (PortType::Audio, true ), 2 );
1055+ BOOST_REQUIRE_EQUAL (audioIn->getNumPorts (), 2 );
1056+
1057+ // Add Audio Output node - should set graph audio outputs to minimum 2 (stereo)
1058+ auto * audioOut = new IONode (IONode::audioOutputNode);
1059+ graph.addNode (audioOut);
1060+ BOOST_REQUIRE_EQUAL (graph.getNumPorts (PortType::Audio, false ), 2 );
1061+ BOOST_REQUIRE_EQUAL (audioOut->getNumPorts (), 2 );
1062+ }
1063+
10351064BOOST_AUTO_TEST_SUITE_END ()
0 commit comments