Skip to content

Commit 8b4e6aa

Browse files
committed
Merge branch 'main' into develop
2 parents ba482ca + 9995efd commit 8b4e6aa

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Tests/SoundpipeAudioKitTests/OscillatorAutomationTests.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,44 @@ class OscillatorAutomationTests: XCTestCase {
6969
audio.append(engine.render(duration: 2.0))
7070
testMD5(audio)
7171
}
72+
73+
func testAutomationAfterDelayedConnection() {
74+
let engine = AudioEngine()
75+
let osc = Oscillator(waveform: Table(.triangle))
76+
let osc2 = Oscillator(waveform: Table(.triangle))
77+
let mixer = Mixer()
78+
let events = [AutomationEvent(targetValue: 1320, startTime: 0.0, rampDuration: 0.5)]
79+
engine.output = mixer
80+
mixer.addInput(osc)
81+
let audio = engine.startTest(totalDuration: 2.0)
82+
osc.play()
83+
osc.$frequency.automate(events: events)
84+
audio.append(engine.render(duration: 1.0))
85+
mixer.removeInput(osc)
86+
mixer.addInput(osc2)
87+
osc2.play()
88+
osc2.$frequency.automate(events: events)
89+
audio.append(engine.render(duration: 1.0))
90+
testMD5(audio)
91+
}
92+
93+
94+
func testDelayedAutomation() throws {
95+
let engine = AudioEngine()
96+
let osc = Oscillator(waveform: Table(.triangle))
97+
engine.output = osc
98+
osc.amplitude = 0.2
99+
osc.start()
100+
let audio = engine.startTest(totalDuration: 2.0)
101+
102+
audio.append(engine.render(duration: 1.0))
103+
let events = [AutomationEvent(targetValue: 1320, startTime: 0, rampDuration: 0.1),
104+
AutomationEvent(targetValue: 660, startTime: 0.1, rampDuration: 0.1),
105+
AutomationEvent(targetValue: 1100, startTime: 0.2, rampDuration: 0.1),
106+
AutomationEvent(targetValue: 770, startTime: 0.3, rampDuration: 0.1),
107+
AutomationEvent(targetValue: 880, startTime: 0.4, rampDuration: 0.1)]
108+
osc.$frequency.automate(events: events)
109+
audio.append(engine.render(duration: 1.0))
110+
testMD5(audio)
111+
}
72112
}

Tests/SoundpipeAudioKitTests/ValidatedMD5s.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ let validatedMD5s: [String: String] = [
5858
"-[OscillatorAutomationTests testNewAutomationDelayed]": "170f682ea6ad60e6a94ad48aba159efe",
5959
"-[OscillatorAutomationTests testNewAutomationFrequency]": "5c8c218d2c21e8c436493bb09a80a47a",
6060
"-[OscillatorAutomationTests testNewAutomationMultiple]": "c1840e8045b8d976ca0aaddb984da4c5",
61+
"-[OscillatorAutomationTests testAutomationAfterDelayedConnection]": "f5f2cf536578d5a037c88d2cd458eb10",
62+
"-[OscillatorAutomationTests testDelayedAutomation]": "b4c68d2afd4fdbb5074b7ddc655ea5c6",
6163
"-[PhaseLockedVocoderTests testDefault]": "d3522d2e9cad9467740cbcb3624887f2",
6264
"-[PitchTapTests testBasic]": "db6a903846a19d9e06066391308ee7ff",
6365
"-[PluckedStringTests testDefault]": "9e2d3aa3b50fa53a43b798901f0cb0e5",

0 commit comments

Comments
 (0)