Music XML updates and optimizations

This commit is contained in:
2026-06-16 20:55:32 -07:00
parent ca1ee503cc
commit 73191c958f
97 changed files with 5459 additions and 2031 deletions
@@ -134,6 +134,37 @@ struct BinaryOpGeneratorTests {
let samples: [[Double]] = gen.calculatedSamples(graph: graph, count: count)
#expect(samples[0].prefix(count).allSatisfy { $0 == 7.0 })
}
// Order-sensitive operands: a flipped vDSP subtract/divide argument order
// would produce the reciprocal/negated value, so these lock the orientation.
@Test func scalarMinusGenerator() {
let count: Int = 8
let gen: BinaryOpGenerator = (1.0 as Double) - ConstantAudioGen(0.25)
let samples: [[Double]] = gen.calculatedSamples(graph: graph, count: count)
#expect(samples[0].prefix(count).allSatisfy { $0 == 0.75 })
}
@Test func scalarDividedByGenerator() {
let count: Int = 8
let gen: BinaryOpGenerator = (1.0 as Double) / ConstantAudioGen(4.0)
let samples: [[Double]] = gen.calculatedSamples(graph: graph, count: count)
#expect(samples[0].prefix(count).allSatisfy { $0 == 0.25 })
}
@Test func generatorMinusGenerator() {
let count: Int = 8
let gen: BinaryOpGenerator = ConstantAudioGen(3.0) - ConstantAudioGen(2.0)
let samples: [[Double]] = gen.calculatedSamples(graph: graph, count: count)
#expect(samples[0].prefix(count).allSatisfy { $0 == 1.0 })
}
@Test func generatorDividedByGenerator() {
let count: Int = 8
let gen: BinaryOpGenerator = ConstantAudioGen(8.0) / ConstantAudioGen(2.0)
let samples: [[Double]] = gen.calculatedSamples(graph: graph, count: count)
#expect(samples[0].prefix(count).allSatisfy { $0 == 4.0 })
}
}
// MARK: - Multi-channel broadcast