diff --git a/Aural.xcodeproj/project.pbxproj b/Aural.xcodeproj/project.pbxproj index 4fd06add8..6ec3a2a6d 100644 --- a/Aural.xcodeproj/project.pbxproj +++ b/Aural.xcodeproj/project.pbxproj @@ -956,6 +956,8 @@ 3ED373C42C70BB6200836511 /* ReplayGainNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED373C32C70BB6200836511 /* ReplayGainNode.swift */; }; 3ED373C72C70BC4400836511 /* ParametricEQNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED373C52C70BC4400836511 /* ParametricEQNode.swift */; }; 3ED373DB2C70CC8100836511 /* ReplayGainUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED373DA2C70CC8100836511 /* ReplayGainUnit.swift */; }; + 3ED373E42C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED373E32C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift */; }; + 3ED373E62C70DA4800836511 /* ReplayGainUnitDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED373E52C70DA4800836511 /* ReplayGainUnitDelegate.swift */; }; 3ED65A532C45BA3000859677 /* PlayerViewController+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED65A522C45BA3000859677 /* PlayerViewController+Actions.swift */; }; 3ED65A552C45BAD000859677 /* PlayerViewController+Theming.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED65A542C45BAD000859677 /* PlayerViewController+Theming.swift */; }; 3ED8E74A281482C9002E313F /* TableImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED8E749281482C9002E313F /* TableImageCell.swift */; }; @@ -2082,6 +2084,8 @@ 3ED373C32C70BB6200836511 /* ReplayGainNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayGainNode.swift; sourceTree = ""; }; 3ED373C52C70BC4400836511 /* ParametricEQNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParametricEQNode.swift; sourceTree = ""; }; 3ED373DA2C70CC8100836511 /* ReplayGainUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayGainUnit.swift; sourceTree = ""; }; + 3ED373E32C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayGainUnitDelegateProtocol.swift; sourceTree = ""; }; + 3ED373E52C70DA4800836511 /* ReplayGainUnitDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayGainUnitDelegate.swift; sourceTree = ""; }; 3ED65A522C45BA3000859677 /* PlayerViewController+Actions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PlayerViewController+Actions.swift"; sourceTree = ""; }; 3ED65A542C45BAD000859677 /* PlayerViewController+Theming.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PlayerViewController+Theming.swift"; sourceTree = ""; }; 3ED8E749281482C9002E313F /* TableImageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableImageCell.swift; sourceTree = ""; }; @@ -2211,62 +2215,29 @@ 3ED373C32C70BB6200836511 /* ReplayGainNode.swift */, 3E0215C62C23490E00865AC2 /* HostedAUNode.swift */, 3E0215C72C23490E00865AC2 /* VariableRateNode.swift */, - 3E0215C52C23490E00865AC2 /* Support */, ); path = CustomNodes; sourceTree = ""; }; - 3E0215DD2C23490E00865AC2 /* Delegates */ = { - isa = PBXGroup; - children = ( - 3E0215C92C23490E00865AC2 /* AudioGraphDelegate.swift */, - 3E0215CA2C23490E00865AC2 /* AudioGraphDelegateProtocol.swift */, - 3E0215CB2C23490E00865AC2 /* DelayUnitDelegate.swift */, - 3E0215CC2C23490E00865AC2 /* DelayUnitDelegateProtocol.swift */, - 3E0215CD2C23490E00865AC2 /* EffectsUnitDelegate.swift */, - 3E0215CE2C23490E00865AC2 /* EffectsUnitDelegateProtocol.swift */, - 3E0215CF2C23490E00865AC2 /* EQUnitDelegate.swift */, - 3E0215D02C23490E00865AC2 /* EQUnitDelegateProtocol.swift */, - 3E0215D12C23490E00865AC2 /* FilterUnitDelegate.swift */, - 3E0215D22C23490E00865AC2 /* FilterUnitDelegateProtocol.swift */, - 3E0215D32C23490E00865AC2 /* HostedAudioUnitDelegate.swift */, - 3E0215D42C23490E00865AC2 /* HostedAudioUnitDelegateProtocol.swift */, - 3E0215D52C23490E00865AC2 /* MasterUnitDelegate.swift */, - 3E0215D62C23490E00865AC2 /* MasterUnitDelegateProtocol.swift */, - 3E0215D72C23490E00865AC2 /* PitchShiftUnitDelegate.swift */, - 3E0215D82C23490E00865AC2 /* PitchShiftUnitDelegateProtocol.swift */, - 3E0215D92C23490E00865AC2 /* ReverbUnitDelegate.swift */, - 3E0215DA2C23490E00865AC2 /* ReverbUnitDelegateProtocol.swift */, - 3E0215DB2C23490E00865AC2 /* TimeStretchUnitDelegate.swift */, - 3E0215DC2C23490E00865AC2 /* TimeStretchUnitDelegateProtocol.swift */, - ); - path = Delegates; - sourceTree = ""; - }; 3E0215F12C23490E00865AC2 /* EffectsUnits */ = { isa = PBXGroup; children = ( - 3E0215DE2C23490E00865AC2 /* DelayUnit.swift */, - 3E0215DF2C23490E00865AC2 /* DelayUnitProtocol.swift */, - 3E0215E02C23490E00865AC2 /* EffectsUnit.swift */, 3E0215E12C23490E00865AC2 /* EffectsUnitProtocol.swift */, + 3E0215CE2C23490E00865AC2 /* EffectsUnitDelegateProtocol.swift */, + 3E0215E02C23490E00865AC2 /* EffectsUnit.swift */, + 3E0215CD2C23490E00865AC2 /* EffectsUnitDelegate.swift */, 3E0215E22C23490E00865AC2 /* EffectsUnitState.swift */, 3E0215E32C23490E00865AC2 /* EffectsUnitType.swift */, - 3E0215E42C23490E00865AC2 /* EQUnit.swift */, - 3E0215E52C23490E00865AC2 /* EQUnitProtocol.swift */, - 3ED373C12C70B62200836511 /* ReplayGainUnitProtocol.swift */, - 3ED373DA2C70CC8100836511 /* ReplayGainUnit.swift */, - 3E0215E62C23490E00865AC2 /* FilterUnit.swift */, - 3E0215E72C23490E00865AC2 /* FilterUnitProtocol.swift */, - 3E0215E82C23490E00865AC2 /* HostedAudioUnit.swift */, - 3E0215E92C23490E00865AC2 /* HostedAudioUnitProtocol.swift */, - 3E0215EA2C23490E00865AC2 /* MasterUnit.swift */, - 3E0215EB2C23490E00865AC2 /* PitchShiftUnit.swift */, - 3E0215EC2C23490E00865AC2 /* PitchShiftUnitProtocol.swift */, - 3E0215ED2C23490E00865AC2 /* ReverbUnit.swift */, - 3E0215EE2C23490E00865AC2 /* ReverbUnitProtocol.swift */, - 3E0215EF2C23490E00865AC2 /* TimeStretchUnit.swift */, - 3E0215F02C23490E00865AC2 /* TimeStretchUnitProtocol.swift */, + 3ED373E82C70DDD700836511 /* Master */, + 3ED373DC2C70D8B100836511 /* EQ */, + 3ED373DD2C70D8D000836511 /* PitchShift */, + 3ED373DE2C70D8F500836511 /* TimeStretch */, + 3ED373DF2C70D91200836511 /* Reverb */, + 3ED373E02C70D93100836511 /* Delay */, + 3ED373E12C70D95200836511 /* Filter */, + 3ED373E22C70D97000836511 /* ReplayGain */, + 3ED373E72C70DDA900836511 /* AudioUnits */, + 3E0215FD2C23490E00865AC2 /* PresetsAndProfiles */, ); path = EffectsUnits; sourceTree = ""; @@ -2302,7 +2273,6 @@ 3E0216042C23490E00865AC2 /* Utils */ = { isa = PBXGroup; children = ( - 3E0216012C23490E00865AC2 /* DeviceManagement */, 3E0216022C23490E00865AC2 /* AudioUnitsManager.swift */, 3E0216032C23490E00865AC2 /* AUExtensions.swift */, ); @@ -2312,15 +2282,16 @@ 3E0216092C23490E00865AC2 /* AudioGraph */ = { isa = PBXGroup; children = ( - 3E0215C82C23490E00865AC2 /* CustomNodes */, - 3E0215DD2C23490E00865AC2 /* Delegates */, - 3E0215F12C23490E00865AC2 /* EffectsUnits */, - 3E0215FD2C23490E00865AC2 /* PresetsAndProfiles */, - 3E0216042C23490E00865AC2 /* Utils */, - 3E0216052C23490E00865AC2 /* AudioEngine.swift */, + 3E0216082C23490E00865AC2 /* AudioGraphProtocols.swift */, 3E0216062C23490E00865AC2 /* AudioGraph.swift */, + 3E0215C92C23490E00865AC2 /* AudioGraphDelegate.swift */, + 3E0215CA2C23490E00865AC2 /* AudioGraphDelegateProtocol.swift */, + 3E0216052C23490E00865AC2 /* AudioEngine.swift */, 3E0216072C23490E00865AC2 /* AudioGraphDefaults.swift */, - 3E0216082C23490E00865AC2 /* AudioGraphProtocols.swift */, + 3E0215F12C23490E00865AC2 /* EffectsUnits */, + 3E0215C82C23490E00865AC2 /* CustomNodes */, + 3E0216012C23490E00865AC2 /* DeviceManagement */, + 3E0216042C23490E00865AC2 /* Utils */, ); path = AudioGraph; sourceTree = ""; @@ -5216,6 +5187,105 @@ path = BandEditor; sourceTree = ""; }; + 3ED373DC2C70D8B100836511 /* EQ */ = { + isa = PBXGroup; + children = ( + 3E0215E52C23490E00865AC2 /* EQUnitProtocol.swift */, + 3E0215D02C23490E00865AC2 /* EQUnitDelegateProtocol.swift */, + 3E0215E42C23490E00865AC2 /* EQUnit.swift */, + 3E0215CF2C23490E00865AC2 /* EQUnitDelegate.swift */, + ); + path = EQ; + sourceTree = ""; + }; + 3ED373DD2C70D8D000836511 /* PitchShift */ = { + isa = PBXGroup; + children = ( + 3E0215EC2C23490E00865AC2 /* PitchShiftUnitProtocol.swift */, + 3E0215D82C23490E00865AC2 /* PitchShiftUnitDelegateProtocol.swift */, + 3E0215EB2C23490E00865AC2 /* PitchShiftUnit.swift */, + 3E0215D72C23490E00865AC2 /* PitchShiftUnitDelegate.swift */, + ); + path = PitchShift; + sourceTree = ""; + }; + 3ED373DE2C70D8F500836511 /* TimeStretch */ = { + isa = PBXGroup; + children = ( + 3E0215F02C23490E00865AC2 /* TimeStretchUnitProtocol.swift */, + 3E0215DC2C23490E00865AC2 /* TimeStretchUnitDelegateProtocol.swift */, + 3E0215EF2C23490E00865AC2 /* TimeStretchUnit.swift */, + 3E0215DB2C23490E00865AC2 /* TimeStretchUnitDelegate.swift */, + ); + path = TimeStretch; + sourceTree = ""; + }; + 3ED373DF2C70D91200836511 /* Reverb */ = { + isa = PBXGroup; + children = ( + 3E0215EE2C23490E00865AC2 /* ReverbUnitProtocol.swift */, + 3E0215DA2C23490E00865AC2 /* ReverbUnitDelegateProtocol.swift */, + 3E0215ED2C23490E00865AC2 /* ReverbUnit.swift */, + 3E0215D92C23490E00865AC2 /* ReverbUnitDelegate.swift */, + ); + path = Reverb; + sourceTree = ""; + }; + 3ED373E02C70D93100836511 /* Delay */ = { + isa = PBXGroup; + children = ( + 3E0215DF2C23490E00865AC2 /* DelayUnitProtocol.swift */, + 3E0215CC2C23490E00865AC2 /* DelayUnitDelegateProtocol.swift */, + 3E0215DE2C23490E00865AC2 /* DelayUnit.swift */, + 3E0215CB2C23490E00865AC2 /* DelayUnitDelegate.swift */, + ); + path = Delay; + sourceTree = ""; + }; + 3ED373E12C70D95200836511 /* Filter */ = { + isa = PBXGroup; + children = ( + 3E0215E72C23490E00865AC2 /* FilterUnitProtocol.swift */, + 3E0215D22C23490E00865AC2 /* FilterUnitDelegateProtocol.swift */, + 3E0215E62C23490E00865AC2 /* FilterUnit.swift */, + 3E0215D12C23490E00865AC2 /* FilterUnitDelegate.swift */, + 3E0215C52C23490E00865AC2 /* Support */, + ); + path = Filter; + sourceTree = ""; + }; + 3ED373E22C70D97000836511 /* ReplayGain */ = { + isa = PBXGroup; + children = ( + 3ED373C12C70B62200836511 /* ReplayGainUnitProtocol.swift */, + 3ED373E32C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift */, + 3ED373E52C70DA4800836511 /* ReplayGainUnitDelegate.swift */, + 3ED373DA2C70CC8100836511 /* ReplayGainUnit.swift */, + ); + path = ReplayGain; + sourceTree = ""; + }; + 3ED373E72C70DDA900836511 /* AudioUnits */ = { + isa = PBXGroup; + children = ( + 3E0215E92C23490E00865AC2 /* HostedAudioUnitProtocol.swift */, + 3E0215D42C23490E00865AC2 /* HostedAudioUnitDelegateProtocol.swift */, + 3E0215E82C23490E00865AC2 /* HostedAudioUnit.swift */, + 3E0215D32C23490E00865AC2 /* HostedAudioUnitDelegate.swift */, + ); + path = AudioUnits; + sourceTree = ""; + }; + 3ED373E82C70DDD700836511 /* Master */ = { + isa = PBXGroup; + children = ( + 3E0215EA2C23490E00865AC2 /* MasterUnit.swift */, + 3E0215D62C23490E00865AC2 /* MasterUnitDelegateProtocol.swift */, + 3E0215D52C23490E00865AC2 /* MasterUnitDelegate.swift */, + ); + path = Master; + sourceTree = ""; + }; 3ED5090228472A35001A190A /* Utils */ = { isa = PBXGroup; children = ( @@ -6193,6 +6263,7 @@ 3E0218D92C23490E00865AC2 /* PlaybackSession.swift in Sources */, 3EAFB60B267FF2B900F0DC96 /* PreferencesSliderCell.swift in Sources */, 3ED65A532C45BA3000859677 /* PlayerViewController+Actions.swift in Sources */, + 3ED373E42C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift in Sources */, 3EF4CDA32C65909C00A5922D /* AVFWaveformDecoder.swift in Sources */, 3E0218862C23490E00865AC2 /* AudioGraphPersistentState.swift in Sources */, 3E6C121825CEBDE500BF0D07 /* PreferencesWindowController.swift in Sources */, @@ -6287,6 +6358,7 @@ 3E045D0F281352370069DEFE /* SortOrderMenuItemView.swift in Sources */, 3E0218AF2C23490E00865AC2 /* MusicBrainzCachePersistentState.swift in Sources */, 3E0218022C23490E00865AC2 /* HostedAudioUnitProtocol.swift in Sources */, + 3ED373E62C70DA4800836511 /* ReplayGainUnitDelegate.swift in Sources */, 3E02183D2C23490E00865AC2 /* FFmpegFrame.swift in Sources */, 3E0219352C23490E00865AC2 /* CoverArt.swift in Sources */, 3E0217E02C23490E00865AC2 /* FlexibleFilterNode.swift in Sources */, diff --git a/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate b/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate index 98e94cb73..5c914eeed 100644 Binary files a/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate and b/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Source/Core/AudioGraph/AudioGraph.swift b/Source/Core/AudioGraph/AudioGraph.swift index b26d552ea..91cad3f1d 100644 --- a/Source/Core/AudioGraph/AudioGraph.swift +++ b/Source/Core/AudioGraph/AudioGraph.swift @@ -45,6 +45,7 @@ class AudioGraph: AudioGraphProtocol, PersistentModelObject { var reverbUnit: ReverbUnit var delayUnit: DelayUnit var filterUnit: FilterUnit + var replayGainUnit: ReplayGainUnit var audioUnits: [HostedAudioUnit] var soundProfiles: SoundProfiles @@ -82,6 +83,7 @@ class AudioGraph: AudioGraphProtocol, PersistentModelObject { reverbUnit = ReverbUnit(persistentState: persistentState?.reverbUnit) delayUnit = DelayUnit(persistentState: persistentState?.delayUnit) filterUnit = FilterUnit(persistentState: persistentState?.filterUnit) + replayGainUnit = ReplayGainUnit(persistentState: nil) self.audioUnitsManager = audioUnitsManager audioUnits = [] diff --git a/Source/Core/AudioGraph/Delegates/AudioGraphDelegate.swift b/Source/Core/AudioGraph/AudioGraphDelegate.swift similarity index 98% rename from Source/Core/AudioGraph/Delegates/AudioGraphDelegate.swift rename to Source/Core/AudioGraph/AudioGraphDelegate.swift index e682834a1..a650e793f 100644 --- a/Source/Core/AudioGraph/Delegates/AudioGraphDelegate.swift +++ b/Source/Core/AudioGraph/AudioGraphDelegate.swift @@ -55,6 +55,7 @@ class AudioGraphDelegate: AudioGraphDelegateProtocol { var reverbUnit: ReverbUnitDelegateProtocol var delayUnit: DelayUnitDelegateProtocol var filterUnit: FilterUnitDelegateProtocol + var replayGainUnit: ReplayGainUnitDelegateProtocol var audioUnits: [HostedAudioUnitDelegateProtocol] var allUnits: [EffectsUnitDelegateProtocol] { @@ -102,6 +103,7 @@ class AudioGraphDelegate: AudioGraphDelegateProtocol { reverbUnit = ReverbUnitDelegate(for: graph.reverbUnit) delayUnit = DelayUnitDelegate(for: graph.delayUnit) filterUnit = FilterUnitDelegate(for: graph.filterUnit) + replayGainUnit = ReplayGainUnitDelegate(for: graph.replayGainUnit) audioUnits = graph.audioUnits.map {HostedAudioUnitDelegate(for: $0)} // Set output device based on user preference diff --git a/Source/Core/AudioGraph/Delegates/AudioGraphDelegateProtocol.swift b/Source/Core/AudioGraph/AudioGraphDelegateProtocol.swift similarity index 98% rename from Source/Core/AudioGraph/Delegates/AudioGraphDelegateProtocol.swift rename to Source/Core/AudioGraph/AudioGraphDelegateProtocol.swift index b635aedb5..233d83146 100644 --- a/Source/Core/AudioGraph/Delegates/AudioGraphDelegateProtocol.swift +++ b/Source/Core/AudioGraph/AudioGraphDelegateProtocol.swift @@ -70,6 +70,7 @@ protocol AudioGraphDelegateProtocol { var reverbUnit: ReverbUnitDelegateProtocol {get} var delayUnit: DelayUnitDelegateProtocol {get} var filterUnit: FilterUnitDelegateProtocol {get} + var replayGainUnit: ReplayGainUnitDelegateProtocol {get} var audioUnits: [HostedAudioUnitDelegateProtocol] {get} var audioUnitsStateFunction: EffectsUnitStateFunction {get} diff --git a/Source/Core/AudioGraph/AudioGraphProtocols.swift b/Source/Core/AudioGraph/AudioGraphProtocols.swift index 10fc225aa..cc643a91f 100644 --- a/Source/Core/AudioGraph/AudioGraphProtocols.swift +++ b/Source/Core/AudioGraph/AudioGraphProtocols.swift @@ -37,6 +37,7 @@ protocol AudioGraphProtocol: PlayerGraphProtocol { var reverbUnit: ReverbUnit {get} var delayUnit: DelayUnit {get} var filterUnit: FilterUnit {get} + var replayGainUnit: ReplayGainUnit {get} var audioUnits: [HostedAudioUnit] {get} func addAudioUnit(ofType type: OSType, andSubType subType: OSType) -> (audioUnit: HostedAudioUnit, index: Int)? diff --git a/Source/Core/AudioGraph/Utils/DeviceManagement/AudioDevice.swift b/Source/Core/AudioGraph/DeviceManagement/AudioDevice.swift similarity index 100% rename from Source/Core/AudioGraph/Utils/DeviceManagement/AudioDevice.swift rename to Source/Core/AudioGraph/DeviceManagement/AudioDevice.swift diff --git a/Source/Core/AudioGraph/Utils/DeviceManagement/DeviceManager.swift b/Source/Core/AudioGraph/DeviceManagement/DeviceManager.swift similarity index 100% rename from Source/Core/AudioGraph/Utils/DeviceManagement/DeviceManager.swift rename to Source/Core/AudioGraph/DeviceManagement/DeviceManager.swift diff --git a/Source/Core/AudioGraph/Utils/DeviceManagement/InternalDeviceList.swift b/Source/Core/AudioGraph/DeviceManagement/InternalDeviceList.swift similarity index 100% rename from Source/Core/AudioGraph/Utils/DeviceManagement/InternalDeviceList.swift rename to Source/Core/AudioGraph/DeviceManagement/InternalDeviceList.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/HostedAudioUnit.swift b/Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/HostedAudioUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/HostedAudioUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/HostedAudioUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/HostedAudioUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/HostedAudioUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/HostedAudioUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/HostedAudioUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/AudioUnits/HostedAudioUnitProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/DelayUnit.swift b/Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/DelayUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/DelayUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/DelayUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/DelayUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/DelayUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/DelayUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/DelayUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Delay/DelayUnitProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/EQUnit.swift b/Source/Core/AudioGraph/EffectsUnits/EQ/EQUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/EQUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/EQ/EQUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/EQUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/EQUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/EQUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/EQUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/EQUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/EQUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/EQ/EQUnitProtocol.swift diff --git a/Source/Core/AudioGraph/Delegates/EffectsUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/EffectsUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/EffectsUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/EffectsUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/EffectsUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/EffectsUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/EffectsUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/EffectsUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/FilterUnit.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/FilterUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/FilterUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/FilterUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/FilterUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/FilterUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/FilterUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/FilterUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/FilterUnitProtocol.swift diff --git a/Source/Core/AudioGraph/CustomNodes/Support/FilterBand.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/Support/FilterBand.swift similarity index 100% rename from Source/Core/AudioGraph/CustomNodes/Support/FilterBand.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/Support/FilterBand.swift diff --git a/Source/Core/AudioGraph/CustomNodes/Support/FilterBandType.swift b/Source/Core/AudioGraph/EffectsUnits/Filter/Support/FilterBandType.swift similarity index 100% rename from Source/Core/AudioGraph/CustomNodes/Support/FilterBandType.swift rename to Source/Core/AudioGraph/EffectsUnits/Filter/Support/FilterBandType.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/MasterUnit.swift b/Source/Core/AudioGraph/EffectsUnits/Master/MasterUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/MasterUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/Master/MasterUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/MasterUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/Master/MasterUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/MasterUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/Master/MasterUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/MasterUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Master/MasterUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/MasterUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Master/MasterUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/PitchShiftUnit.swift b/Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/PitchShiftUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/PitchShiftUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/PitchShiftUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/PitchShiftUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/PitchShiftUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/PitchShiftUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/PitchShiftUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/PitchShift/PitchShiftUnitProtocol.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/AudioUnitPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/AudioUnitPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/AudioUnitPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/AudioUnitPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/DelayPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/DelayPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/DelayPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/DelayPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/EQPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/EQPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/EQPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/EQPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/EffectsUnitPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/EffectsUnitPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/EffectsUnitPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/EffectsUnitPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/FilterPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/FilterPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/FilterPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/FilterPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/MasterPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/MasterPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/MasterPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/MasterPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/PitchShiftPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/PitchShiftPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/PitchShiftPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/PitchShiftPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/ReverbPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/ReverbPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/ReverbPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/ReverbPresets.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/ReverbSpace.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/ReverbSpace.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/ReverbSpace.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/ReverbSpace.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/SoundProfiles.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/SoundProfiles.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/SoundProfiles.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/SoundProfiles.swift diff --git a/Source/Core/AudioGraph/PresetsAndProfiles/TimeStretchPresets.swift b/Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/TimeStretchPresets.swift similarity index 100% rename from Source/Core/AudioGraph/PresetsAndProfiles/TimeStretchPresets.swift rename to Source/Core/AudioGraph/EffectsUnits/PresetsAndProfiles/TimeStretchPresets.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/ReplayGainUnit.swift b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnit.swift similarity index 94% rename from Source/Core/AudioGraph/EffectsUnits/ReplayGainUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnit.swift index efda80e5c..1e79534b0 100644 --- a/Source/Core/AudioGraph/EffectsUnits/ReplayGainUnit.swift +++ b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnit.swift @@ -46,6 +46,10 @@ class ReplayGainUnit: EffectsUnit, ReplayGainUnitProtocol { } } + var effectiveGain: Float { + node.globalGain + } + init(persistentState: EQUnitPersistentState?) { node = ReplayGainNode() @@ -57,8 +61,6 @@ class ReplayGainUnit: EffectsUnit, ReplayGainUnitProtocol { unitState: persistentState?.state ?? AudioGraphDefaults.replayGainState, renderQuality: persistentState?.renderQuality) - globalGain = persistentState?.globalGain ?? AudioGraphDefaults.eqGlobalGain - if let currentPresetName = persistentState?.currentPresetName, let matchingPreset = presets.object(named: currentPresetName) { @@ -77,13 +79,7 @@ class ReplayGainUnit: EffectsUnit, ReplayGainUnitProtocol { } var globalGain: Float { - - get {node.globalGain} - - set { - node.globalGain = newValue - invalidateCurrentPreset() - } + node.globalGain } override var avNodes: [AVAudioNode] {[node]} diff --git a/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegate.swift new file mode 100644 index 000000000..bbe0f4c6a --- /dev/null +++ b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegate.swift @@ -0,0 +1,30 @@ +// +// ReplayGainUnitDelegate.swift +// Aural +// +// Copyright © 2021 Kartik Venugopal. All rights reserved. +// +// This software is licensed under the MIT software license. +// See the file "LICENSE" in the project root directory for license terms. +// + +import Foundation + +class ReplayGainUnitDelegate: EffectsUnitDelegate, ReplayGainUnitDelegateProtocol { + + var mode: ReplayGainMode { + + get {unit.mode} + set {unit.mode = newValue} + } + + var preAmp: Float { + + get {unit.preAmp} + set {unit.preAmp = newValue} + } + + var effectiveGain: Float { + unit.effectiveGain + } +} diff --git a/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegateProtocol.swift new file mode 100644 index 000000000..948871692 --- /dev/null +++ b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitDelegateProtocol.swift @@ -0,0 +1,24 @@ +// +// ReplayGainUnitDelegateProtocol.swift +// Aural +// +// Copyright © 2021 Kartik Venugopal. All rights reserved. +// +// This software is licensed under the MIT software license. +// See the file "LICENSE" in the project root directory for license terms. +// + +import Foundation + +protocol ReplayGainUnitDelegateProtocol: EffectsUnitDelegateProtocol { + + var mode: ReplayGainMode {get set} + + // NOTE - Replay gain values will be set upon track change (values derived from metadata). + + // TODO: Maybe allow the user to specify whether to reset the pre-amp when no replay gain metadata is available ??? + + var preAmp: Float {get set} + + var effectiveGain: Float {get} +} diff --git a/Source/Core/AudioGraph/EffectsUnits/ReplayGainUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitProtocol.swift similarity index 94% rename from Source/Core/AudioGraph/EffectsUnits/ReplayGainUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitProtocol.swift index 4a1d0c9a5..df1e6987f 100644 --- a/Source/Core/AudioGraph/EffectsUnits/ReplayGainUnitProtocol.swift +++ b/Source/Core/AudioGraph/EffectsUnits/ReplayGain/ReplayGainUnitProtocol.swift @@ -19,6 +19,8 @@ protocol ReplayGainUnitProtocol: EffectsUnitProtocol { var replayGain: ReplayGain? {get set} var preAmp: Float {get set} + + var effectiveGain: Float {get} } enum ReplayGainMode: Int, Codable { diff --git a/Source/Core/AudioGraph/EffectsUnits/ReverbUnit.swift b/Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/ReverbUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/ReverbUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/ReverbUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/ReverbUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/ReverbUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/ReverbUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/ReverbUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/Reverb/ReverbUnitProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/TimeStretchUnit.swift b/Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnit.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/TimeStretchUnit.swift rename to Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnit.swift diff --git a/Source/Core/AudioGraph/Delegates/TimeStretchUnitDelegate.swift b/Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitDelegate.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/TimeStretchUnitDelegate.swift rename to Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitDelegate.swift diff --git a/Source/Core/AudioGraph/Delegates/TimeStretchUnitDelegateProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitDelegateProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/Delegates/TimeStretchUnitDelegateProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitDelegateProtocol.swift diff --git a/Source/Core/AudioGraph/EffectsUnits/TimeStretchUnitProtocol.swift b/Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitProtocol.swift similarity index 100% rename from Source/Core/AudioGraph/EffectsUnits/TimeStretchUnitProtocol.swift rename to Source/Core/AudioGraph/EffectsUnits/TimeStretch/TimeStretchUnitProtocol.swift