From e45707b09fee96fcb42336a9da62cb9656b46542 Mon Sep 17 00:00:00 2001 From: VoidX Date: Wed, 29 Nov 2023 03:04:14 +0100 Subject: [PATCH] Optional extra parameters to spatial remapping XML generation --- Cavern/Channels/SpatialRemapping.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Cavern/Channels/SpatialRemapping.cs b/Cavern/Channels/SpatialRemapping.cs index f64ff281..ae1841e1 100644 --- a/Cavern/Channels/SpatialRemapping.cs +++ b/Cavern/Channels/SpatialRemapping.cs @@ -101,7 +101,10 @@ public static string ToEqualizerAPO(float[][] matrix) { /// /// Convert a spatial remapping matrix to an XML file. /// - public static string ToXML(float[][] matrix) { + /// A mixing matrix created with one of the functions + /// Optional argument keys and their values for all output channels - if the number of the + /// values is less than the number of channels, the last channels without values will skip that attribute + public static string ToXML(float[][] matrix, params (string key, string[] values)[] extraParams) { StringBuilder result = new StringBuilder(); using XmlWriter writer = XmlWriter.Create(result); writer.WriteStartElement("matrix"); @@ -109,6 +112,12 @@ public static string ToXML(float[][] matrix) { float[] inputs = matrix[output]; writer.WriteStartElement("output"); writer.WriteAttributeString("channel", output.ToString()); + for (int extra = 0; extra < extraParams.Length; extra++) { + (string key, string[] values) = extraParams[extra]; + if (output < values.Length) { + writer.WriteAttributeString(key, values[output].ToString()); + } + } for (int input = 0; input < inputs.Length; input++) { if (inputs[input] != 0) { writer.WriteStartElement("input");