diff --git a/Cookbook/Cookbook/CookbookApp.swift b/Cookbook/Cookbook/CookbookApp.swift index 046a732..42f7698 100644 --- a/Cookbook/Cookbook/CookbookApp.swift +++ b/Cookbook/Cookbook/CookbookApp.swift @@ -1,8 +1,6 @@ // Copyright AudioKit. All Rights Reserved. import AudioKit -import AudioKitEX -import AudioKitUI import AVFoundation import CookbookCommon import SwiftUI diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift index eeaa759..deee93e 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift @@ -1,14 +1,9 @@ -import AudioKit -import AudioKitEX -import AudioKitUI -import AVFoundation import SwiftUI struct ContentView: View { var body: some View { NavigationView { MasterView() -// DetailView() }.navigationViewStyle(StackNavigationViewStyle()) } } @@ -28,19 +23,15 @@ struct MasterView: View { NavigationLink("Instrument SFZ", destination: InstrumentSFZView()) } Group { + NavigationLink("MIDI Monitor", destination: MIDIMonitorView()) + NavigationLink("MIDI Track View", destination: MIDITrackDemo()) NavigationLink("Music Toy", destination: MusicToyView()) + NavigationLink("Noise Generators", destination: NoiseGeneratorsView()) + NavigationLink("Recorder", destination: RecorderView()) NavigationLink("Telephone", destination: Telephone()) NavigationLink("Tuner", destination: TunerView()) - NavigationLink("Noise Generators", destination: NoiseGeneratorsView()) NavigationLink("Vocal Tract", destination: VocalTractView()) - NavigationLink("MIDI Monitor", destination: MIDIMonitorView()) - NavigationLink("MIDI Track View", destination: MIDITrackDemo()) - NavigationLink("Recorder", destination: RecorderView()) } - // TODO: - // Text("Level Meter") - // Text("Sequencer") - // Text("MIDI Controller") - MIDI Output Sender } } Group { @@ -90,7 +81,7 @@ struct MasterView: View { Group { DisclosureGroup("Effects") { Group { - NavigationLink("Audio3D", destination: AudioKit3DView()) + NavigationLink("Audio 3D", destination: AudioKit3DView()) NavigationLink("Auto Panner", destination: AutoPannerView()) NavigationLink("Auto Wah", destination: AutoWahView()) NavigationLink("Balancer", destination: BalancerView()) @@ -136,12 +127,12 @@ struct MasterView: View { Group { DisclosureGroup("Reverb") { Group { + NavigationLink("Apple Reverb", destination: ReverbView()) NavigationLink("Chowning Reverb", destination: ChowningReverbView()) NavigationLink("Comb Filter Reverb", destination: CombFilterReverbView()) NavigationLink("Costello Reverb", destination: CostelloReverbView()) NavigationLink("Flat Frequency Response Reverb", destination: FlatFrequencyResponseReverbView()) - NavigationLink("Apple Reverb", destination: ReverbView()) NavigationLink("Zita Reverb", destination: ZitaReverbView()) } } @@ -188,10 +179,10 @@ struct MasterView: View { NavigationLink("Amplitude Envelope", destination: AmplitudeEnvelopeView()) NavigationLink("Dynamic Oscillator", destination: DynamicOscillatorView()) NavigationLink("FM Frequency Modulation", destination: FMOscillatorView()) - NavigationLink("Waveform Morphing", destination: MorphingOscillatorView()) - NavigationLink("Sine", destination: OscillatorView()) NavigationLink("Phase Distortion", destination: PhaseDistortionOscillatorView()) NavigationLink("Pulse Width Modulation", destination: PWMOscillatorView()) + NavigationLink("Sine", destination: OscillatorView()) + NavigationLink("Waveform Morphing", destination: MorphingOscillatorView()) } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Audio3D.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Audio3D.swift index 2b14c57..e3c8528 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Audio3D.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Audio3D.swift @@ -16,7 +16,6 @@ final class AudioKit3DVM: ObservableObject { init() { coordinator.updateAudioSourceNodeDelegate = conductor } - } protocol UpdateAudioSourceNodeDelegate: AnyObject { @@ -57,7 +56,6 @@ class AudioEngine3DConductor: ObservableObject, ProcessesPlayerInput, UpdateAudi engine.mainMixerNode?.pan = 1.0 print(engine.avEngine) - } deinit { @@ -82,7 +80,6 @@ class AudioEngine3DConductor: ObservableObject, ProcessesPlayerInput, UpdateAudi func updateSoundSourcePosition(_ position3D: AVAudio3DPoint) { source1mixer3D.position = position3D } - } class SceneCoordinator: NSObject, SCNSceneRendererDelegate, ObservableObject { @@ -135,14 +132,11 @@ class SceneCoordinator: NSObject, SCNSceneRendererDelegate, ObservableObject { y: pointOfView.upVector.y, z: pointOfView.upVector.z) )) - } renderer.showsStatistics = self.showsStatistics renderer.debugOptions = self.debugOptions - } - } struct AudioKit3DView: View { diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/AutoWah.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/AutoWah.swift index fbe1a34..442195c 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/AutoWah.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/AutoWah.swift @@ -19,7 +19,6 @@ class AutoWahConductor: ObservableObject, ProcessesPlayerInput { autowah = AutoWah(player) dryWetMixer = DryWetMixer(player, autowah) - engine.output = dryWetMixer } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Chorus.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Chorus.swift index 9226730..ae5cea8 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Chorus.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Chorus.swift @@ -20,7 +20,7 @@ class ChorusConductor: ObservableObject, ProcessesPlayerInput { chorus = Chorus(player) dryWetMixer = DryWetMixer(player, chorus) - engine.output = chorus + engine.output = dryWetMixer } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Compressor.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Compressor.swift index 5e329d0..37f512b 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Compressor.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Compressor.swift @@ -18,7 +18,6 @@ class CompressorConductor: ObservableObject, ProcessesPlayerInput { player.isLooping = true compressor = Compressor(player) - dryWetMixer = DryWetMixer(player, compressor) engine.output = dryWetMixer } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Expander.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Expander.swift index 862945b..255b8c4 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Expander.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/Expander.swift @@ -18,7 +18,6 @@ class ExpanderConductor: ObservableObject, ProcessesPlayerInput { player.isLooping = true expander = Expander(player) - dryWetMixer = DryWetMixer(player, expander) engine.output = dryWetMixer } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PeakLimiter.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PeakLimiter.swift index bbd3b63..eee0fe3 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PeakLimiter.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PeakLimiter.swift @@ -22,7 +22,6 @@ class PeakLimiterConductor: ObservableObject, ProcessesPlayerInput { player.isLooping = true peakLimiter = PeakLimiter(player) - dryWetMixer = DryWetMixer(player, peakLimiter) engine.output = dryWetMixer } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PhaseLockedVocoder.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PhaseLockedVocoder.swift index 61c75a3..b44a596 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PhaseLockedVocoder.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Effects/PhaseLockedVocoder.swift @@ -23,7 +23,6 @@ class PhaseLockedVocoderConductor: ObservableObject, HasAudioEngine { phaseLockedVocoder.amplitude = 1 phaseLockedVocoder.pitchRatio = 1 phaseLockedVocoder.start() - engine.output = phaseLockedVocoder } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentEXS.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentEXS.swift index fbd4fb5..b8dd329 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentEXS.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentEXS.swift @@ -32,11 +32,6 @@ class InstrumentEXSConductor: ObservableObject, HasAudioEngine { } catch { Log("Could not load instrument") } - do { - try engine.start() - } catch { - Log("AudioKit did not start!") - } } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentSFZ.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentSFZ.swift index 69cdc50..84cb1c2 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentSFZ.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/InstrumentSFZ.swift @@ -28,14 +28,7 @@ class InstrumentSFZConductor: ObservableObject, HasAudioEngine { Log("Could not find file") } instrument.masterVolume = 0.15 - engine.output = instrument - - do { - try engine.start() - } catch { - Log("AudioKit did not start!") - } } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/NoiseGenerators.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/NoiseGenerators.swift index 2a7c09b..18cf5a5 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/NoiseGenerators.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/NoiseGenerators.swift @@ -13,6 +13,7 @@ struct NoiseData { } class NoiseGeneratorsConductor: ObservableObject, HasAudioEngine { + let engine = AudioEngine() var brown = BrownianNoise() var pink = PinkNoise() var white = WhiteNoise() @@ -26,8 +27,6 @@ class NoiseGeneratorsConductor: ObservableObject, HasAudioEngine { } } - let engine = AudioEngine() - init() { mixer.addInput(brown) mixer.addInput(pink) diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/AmplitudeEnvelope.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/AmplitudeEnvelope.swift index 9512a49..3c8d1c3 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/AmplitudeEnvelope.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/AmplitudeEnvelope.swift @@ -19,6 +19,9 @@ import Tonic //: * Release is the amount of time after a note is let go for the sound to die away to zero. class AmplitudeEnvelopeConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc: Oscillator + var env: AmplitudeEnvelope + var fader: Fader var currentNote = 0 func noteOn(pitch: Pitch, point _: CGPoint) { @@ -33,10 +36,6 @@ class AmplitudeEnvelopeConductor: ObservableObject, HasAudioEngine { env.closeGate() } - var osc: Oscillator - var env: AmplitudeEnvelope - var fader: Fader - init() { osc = Oscillator() env = AmplitudeEnvelope(osc) diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/DynamicOscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/DynamicOscillator.swift index 18fd983..6a2554e 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/DynamicOscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/DynamicOscillator.swift @@ -9,6 +9,7 @@ import Tonic class DynamicOscillatorConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc = DynamicOscillator() func noteOn(pitch: Pitch, point _: CGPoint) { isPlaying = true @@ -23,8 +24,6 @@ class DynamicOscillatorConductor: ObservableObject, HasAudioEngine { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = DynamicOscillator() - init() { osc.amplitude = 0.2 engine.output = osc diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/FMOscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/FMOscillator.swift index 2fcda4e..142856d 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/FMOscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/FMOscillator.swift @@ -8,13 +8,12 @@ import SwiftUI class FMOscillatorConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc = FMOscillator() @Published var isPlaying: Bool = false { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = FMOscillator() - init() { engine.output = osc } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/MorphingOscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/MorphingOscillator.swift index 398da64..430586c 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/MorphingOscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/MorphingOscillator.swift @@ -9,6 +9,7 @@ import Tonic class MorphingOscillatorConductor: ObservableObject, HasAudioEngine { var engine = AudioEngine() + var osc = MorphingOscillator() func noteOn(pitch: Pitch, point _: CGPoint) { isPlaying = true @@ -23,8 +24,6 @@ class MorphingOscillatorConductor: ObservableObject, HasAudioEngine { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = MorphingOscillator() - init() { osc.amplitude = 0.2 engine.output = osc diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/Oscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/Oscillator.swift index fccf977..5fabdf8 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/Oscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/Oscillator.swift @@ -9,6 +9,7 @@ import Tonic class OscillatorConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc = Oscillator() func noteOn(pitch: Pitch, point _: CGPoint) { isPlaying = true @@ -23,8 +24,6 @@ class OscillatorConductor: ObservableObject, HasAudioEngine { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = Oscillator() - init() { osc.amplitude = 0.2 engine.output = osc diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PWMOscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PWMOscillator.swift index 99e0be5..2066092 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PWMOscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PWMOscillator.swift @@ -9,6 +9,7 @@ import Tonic class PWMOscillatorConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc = PWMOscillator() func noteOn(pitch: Pitch, point _: CGPoint) { isPlaying = true @@ -23,8 +24,6 @@ class PWMOscillatorConductor: ObservableObject, HasAudioEngine { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = PWMOscillator() - init() { osc.amplitude = 0.2 engine.output = osc diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PhaseDistortionOscillator.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PhaseDistortionOscillator.swift index f437154..239dfc9 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PhaseDistortionOscillator.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Oscillators/PhaseDistortionOscillator.swift @@ -9,6 +9,7 @@ import Tonic class PhaseDistortionOscillatorConductor: ObservableObject, HasAudioEngine { let engine = AudioEngine() + var osc = PhaseDistortionOscillator() func noteOn(pitch: Pitch, point _: CGPoint) { isPlaying = true @@ -23,8 +24,6 @@ class PhaseDistortionOscillatorConductor: ObservableObject, HasAudioEngine { didSet { isPlaying ? osc.start() : osc.stop() } } - var osc = PhaseDistortionOscillator() - init() { osc.amplitude = 0.2 engine.output = osc diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Reverbs/ZitaReverb.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Reverbs/ZitaReverb.swift index d0d53a8..dcb1063 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Reverbs/ZitaReverb.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/Reverbs/ZitaReverb.swift @@ -22,7 +22,6 @@ class ZitaReverbConductor: ObservableObject, ProcessesPlayerInput { } reverb = ZitaReverb(player) dryWetMixer = DryWetMixer(player, reverb) - engine.output = dryWetMixer } } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTest.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTest.swift index 67603c0..1d32338 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTest.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTest.swift @@ -16,13 +16,9 @@ struct MIDIPortTestView: View { VStack { HStack { Text("Input Ports Available") - // .font(.title2) Text("Destination Ports Available") - // .font(.title2) Text("Virtual Input Ports Available") - // .font(.title2) Text("Virtual Output Ports Available") - // .font(.title2) } HStack { ForEach(0 ..< conductor.inputNames.count, id: \.self) { index in diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTestConductor.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTestConductor.swift index 2094b21..f6e21d2 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTestConductor.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/MIDIPortTestConductor.swift @@ -131,8 +131,6 @@ class MIDIPortTestConductor: ObservableObject, MIDIListener { init() { midi.createVirtualInputPorts(count: 1, uniqueIDs: [inputUIDDevelop]) midi.createVirtualOutputPorts(count: 1, uniqueIDs: [outputUIDDevelop]) -// midi.createVirtualInputPorts(numberOfPort: 1, [inputUIDMain], names: ["MIDI Test Input Port_Main"]) -// midi.createVirtualOutputPorts(numberOfPort: 1, [outputUIDMain], names: ["MIDI Test Output Port_Main"]) midi.addListener(self) } diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/RolandTB303Filter.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/RolandTB303Filter.swift similarity index 100% rename from Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/RolandTB303Filter.swift rename to Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/WIP/RolandTB303Filter.swift diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/CallbackLoop.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/Reusable Components/CallbackLoop.swift similarity index 97% rename from Cookbook/CookbookCommon/Sources/CookbookCommon/CallbackLoop.swift rename to Cookbook/CookbookCommon/Sources/CookbookCommon/Reusable Components/CallbackLoop.swift index 5bd98d5..28407b2 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/CallbackLoop.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/Reusable Components/CallbackLoop.swift @@ -1,7 +1,7 @@ // Copyright AudioKit. All Rights Reserved. Revision History at http://github.com/AudioKit/AudioKit/ import Foundation -/// Class to handle updating via CADisplayLink +/// Class to handle an updating loop public class CallbackLoop: NSObject { private var internalHandler: () -> Void = {}