Skip to content

Commit

Permalink
Engine -> AudioEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
aure committed Jun 12, 2023
1 parent 115d0f4 commit c9ae7cb
Show file tree
Hide file tree
Showing 39 changed files with 123 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Utilities
/// New audio engine to mostly replace AVAudioEngine. Eventually we will completely replace AVAudioEngine.
///
/// See https://github.com/AudioKit/AudioKit/issues/2804
public class Engine {
public class AudioEngine {
/// Internal AVAudioEngine
private let avEngine = AVAudioEngine()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Utilities
public extension AVAudioPCMBuffer {
/// Audition the buffer. Especially useful in AudioKit testing
func audition() {
let engine = Engine()
let engine = AudioEngine()
let sampler = Sampler()
engine.output = sampler
do {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Delay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public class Delay: Node {
self.time = time
self.feedback = feedback
self.lowPassCutoff = lowPassCutoff
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Distortion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ public class Distortion: Node {
self.polynomialMix = polynomialMix
self.softClipGain = softClipGain
self.finalMix = finalMix
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/DynamicsProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ public class DynamicsProcessor: Node {
self.attackTime = attackTime
self.releaseTime = releaseTime
self.masterGain = masterGain
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Filters/BandPassFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class BandPassFilter: Node {

self.centerFrequency = centerFrequency
self.bandwidth = bandwidth
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Filters/HighPassFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class HighPassFilter: Node {

self.cutoffFrequency = cutoffFrequency
self.resonance = resonance
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Filters/HighShelfFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class HighShelfFilter: Node {

self.cutOffFrequency = cutOffFrequency
self.gain = gain
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Filters/LowPassFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class LowPassFilter: Node {

self.cutoffFrequency = cutoffFrequency
self.resonance = resonance
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Filters/LowShelfFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class LowShelfFilter: Node {

self.cutoffFrequency = cutoffFrequency
self.gain = gain
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/MatrixReverb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ public class MatrixReverb: Node {
self.smallDelayRange = smallDelayRange
self.modulationRate = modulationRate
self.modulationDepth = modulationDepth
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/ParametricEQ.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public class ParametricEQ: Node {
self.centerFreq = centerFreq
self.q = q
self.gain = gain
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/PeakLimiter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public class PeakLimiter: Node {
self.attackTime = attackTime
self.decayTime = decayTime
self.preGain = preGain
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Effects/Reverb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public class Reverb: Node {
associateParams(with: au)

self.wetDryMix = wetDryMix
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Generators/Noise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class Noise: Node {
noiseAU.amplitudeParam.value = amplitude
self.amplitude = amplitude

Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Generators/Oscillator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public class Oscillator: Node {
self.frequency = frequency
oscAU.setWaveform(waveform)
self.waveform = waveform
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Mixing/Mixer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public class Mixer: Node, NamedNode {
volumeAU.volumeParam.value = volume
self.volume = volume
self.name = name ?? MemoryAddress(of: self).description
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}

/// Initialize the mixer node with multiple inputs
Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Mixing/Volume.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class Volume: Node {
version: .max)
au = instantiateAU(componentDescription: componentDescription)
volumeAU = au as! VolumeAudioUnit
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Playback/Apple Sampler/AppleSampler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ open class AppleSampler: Node {
/// Initialize the sampler node
public init() {
au = samplerUnit.auAudioUnit
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}

// Add URL based initializers
Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Playback/Audio Player/AudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public final class AudioPlayer: Node {
self.pitch = pitch
self.overlap = overlap

Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}

public func play(url: URL) {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Audio/Nodes/Playback/Sampler/Sampler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public class Sampler: Node {
version: .max)
au = instantiateAU(componentDescription: componentDescription)
samplerAU = au as! SamplerAudioUnit
Engine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingIncrement(ordering: .relaxed)
}

deinit {
Engine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
AudioEngine.nodeInstanceCount.wrappingDecrement(ordering: .relaxed)
}

public func stop() {
Expand Down
18 changes: 9 additions & 9 deletions Tests/AudioKitTests/Engine Tests/EngineRealtimeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import XCTest

class EngineRealtimeTests: AKTestCase {
func testBasicRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc = Oscillator()
osc.amplitude = 0.1
Expand All @@ -17,7 +17,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testEffectRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc = Oscillator()
let fx = Distortion(osc)
Expand All @@ -32,7 +32,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testTwoEffectsRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc = Oscillator()
let dist = Distortion(osc)
Expand All @@ -49,7 +49,7 @@ class EngineRealtimeTests: AKTestCase {

/// Test changing the output chain on the fly.
func testDynamicChangeRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc = Oscillator()
let dist = Distortion(osc)
Expand All @@ -67,7 +67,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testMixerRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc1 = Oscillator()
let osc2 = Oscillator()
Expand All @@ -86,7 +86,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testMixerDynamicRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc1 = Oscillator()
let osc2 = Oscillator()
Expand All @@ -109,7 +109,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testMultipleChangesRealtime() throws {
let engine = Engine()
let engine = AudioEngine()

let osc1 = Oscillator()
let osc2 = Oscillator()
Expand All @@ -130,7 +130,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testSamplerRealtime() throws {
let engine = Engine()
let engine = AudioEngine()
let url = URL.testAudio
let buffer = try! AVAudioPCMBuffer(url: url)!
let sampler = Sampler()
Expand All @@ -143,7 +143,7 @@ class EngineRealtimeTests: AKTestCase {
}

func testManyOscillators() throws {
let engine = Engine()
let engine = AudioEngine()

let mixer = Mixer()

Expand Down

0 comments on commit c9ae7cb

Please sign in to comment.