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");