@@ -24,14 +24,26 @@ Namespace AudioGraphControl
2424 Public Shared Sub DisposeNode(nodeControl As NodeControl)
2525 Dim node = DirectCast (nodeControl.NodeContent, IAudioNodeControl)
2626
27- ' Remove visual & graph connections
28- Dim connections = node.OutgoingConnector.Connections.ToArray()
27+ # Region "' Remove visual & graph connections"
28+ Dim connections As New List( Of NodeConnection)
29+
30+ Dim inputNode = TryCast (nodeControl.NodeContent, IAudioNodeControlInput)
31+ If inputNode IsNot Nothing Then
32+ connections.AddRange(inputNode.IncomingConnector.Connections)
33+ End If
34+
35+ Dim outputNode = TryCast (nodeControl.NodeContent, IAudioNodeControlOutput)
36+ If outputNode IsNot Nothing Then
37+ connections.AddRange(outputNode.OutgoingConnector.Connections)
38+ End If
39+
2940 For Each connection In connections
3041 DeleteConnection(connection)
3142 Next
43+ # End Region
3244
45+ ' Dispose audio node
3346 If Not node.BaseAudioNode Is Nothing Then
34- ' Dispose audio node
3547 node.BaseAudioNode.Stop()
3648 node.BaseAudioNode.Dispose()
3749 End If
@@ -57,7 +69,7 @@ Namespace AudioGraphControl
5769 End Sub
5870
5971 <Extension>
60- Public Sub ReconnectAudioNode( ByRef nodeControl As IAudioNodeControl )
72+ Public Sub ReconnectAudioNode( ByRef nodeControl As IAudioNodeControlOutput )
6173 For Each connection In nodeControl.OutgoingConnector.Connections
6274 Dim node As IAudioNode = connection.DestinationConnector.AttachedNode.BaseAudioNode
6375 DirectCast (nodeControl.BaseAudioNode, IAudioInputNode).AddOutgoingConnection(node)
0 commit comments