<commit_before>//
//  AKHighShelfFilter.swift
//  AudioKit
//
//  Autogenerated by scripts by <NAME>. Do not edit directly.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import AVFoundation

/** AudioKit version of Apple's HighShelfFilter Audio Unit */
public class AKHighShelfFilter: AKNode {
    
    private let cd = AudioComponentDescription(
        componentType: kAudioUnitType_Effect,
        componentSubType: kAudioUnitSubType_HighShelfFilter,
        componentManufacturer: kAudioUnitManufacturer_Apple,
        componentFlags: 0,
        componentFlagsMask: 0)
    
    private var internalEffect = AVAudioUnitEffect()
    private var internalAU = AudioUnit()
    public var internalAudioUnit:AudioUnit?
    
    /** Cut Off Frequency (Hz) ranges from 10000 to 22050 (Default: 10000) */
    public var cutOffFrequency: Float = 10000 {
        didSet {
            if cutOffFrequency < 10000 {
                cutOffFrequency = 10000
            }
            if cutOffFrequency > 22050 {
                cutOffFrequency = 22050
            }
            AudioUnitSetParameter(
                internalAU,
                kHighShelfParam_CutOffFrequency,
                kAudioUnitScope_Global, 0,
                cutOffFrequency, 0)
        }
    }
    
    /** Gain (dB) ranges from -40 to 40 (Default: 0) */
    public var gain: Float = 0 {
        didSet {
            if gain < -40 {
                gain = -40
            }
            if gain > 40 {
                gain = 40
            }
            AudioUnitSetParameter(
                internalAU,
                kHighShelfParam_Gain,
                kAudioUnitScope_Global, 0,
                gain, 0)
        }
    }
    
    /** Initialize the high shelf filter node */
    public init(
        _ input: AKNode,
        cutOffFrequency: Float = 10000,
        gain: Float = 0) {
            
            self.cutOffFrequency = cutOffFrequency
            self.gain = gain
            super.init()
            
            internalEffect = AVAudioUnitEffect(audioComponentDescription: cd)
            output = internalEffect
            AKManager.sharedInstance.engine.attachNode(internalEffect)
            AKManager.sharedInstance.engine.connect(input.output!, to: internalEffect, format: AKManager.format)
            internalAU = internalEffect.audioUnit
            internalAudioUnit = internalEffect.audioUnit
            
            AudioUnitSetParameter(internalAU, kHighShelfParam_CutOffFrequency, kAudioUnitScope_Global, 0, cutOffFrequency, 0)
            AudioUnitSetParameter(internalAU, kHighShelfParam_Gain,            kAudioUnitScope_Global, 0, gain, 0)
    }
}<commit_msg>Proof of concept for AU type effects<commit_after>//
//  AKHighShelfFilter.swift
//  AudioKit
//
//  Autogenerated by scripts by <NAME>. Do not edit directly.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import AVFoundation

/** AudioKit version of Apple's HighShelfFilter Audio Unit */
public struct AKHighShelfFilter: AKProtocolNode {
    
    private let cd = AudioComponentDescription(
        componentType: kAudioUnitType_Effect,
        componentSubType: kAudioUnitSubType_HighShelfFilter,
        componentManufacturer: kAudioUnitManufacturer_Apple,
        componentFlags: 0,
        componentFlagsMask: 0)
    
    private var internalEffect = AVAudioUnitEffect()
    private var internalAU = AudioUnit()
    public var avAudioNode: AVAudioNode
    
    /** Cut Off Frequency (Hz) ranges from 10000 to 22050 (Default: 10000) */
    public var cutOffFrequency: Float = 10000 {
        didSet {
            if cutOffFrequency < 10000 {
                cutOffFrequency = 10000
            }
            if cutOffFrequency > 22050 {
                cutOffFrequency = 22050
            }
            AudioUnitSetParameter(
                internalAU,
                kHighShelfParam_CutOffFrequency,
                kAudioUnitScope_Global, 0,
                cutOffFrequency, 0)
        }
    }
    
    /** Gain (dB) ranges from -40 to 40 (Default: 0) */
    public var gain: Float = 0 {
        didSet {
            if gain < -40 {
                gain = -40
            }
            if gain > 40 {
                gain = 40
            }
            AudioUnitSetParameter(
                internalAU,
                kHighShelfParam_Gain,
                kAudioUnitScope_Global, 0,
                gain, 0)
        }
    }
    
    /** Initialize the high shelf filter node */
    public init(
        _ input: AKNode,
        cutOffFrequency: Float = 10000,
        gain: Float = 0) {
            
            self.cutOffFrequency = cutOffFrequency
            self.gain = gain
            
            internalEffect = AVAudioUnitEffect(audioComponentDescription: cd)
            self.avAudioNode = internalEffect
            AKManager.sharedInstance.engine.attachNode(self.avAudioNode)
            AKManager.sharedInstance.engine.connect(input.output!, to: self.avAudioNode, format: AKManager.format)
            internalAU = internalEffect.audioUnit
            
            AudioUnitSetParameter(internalAU, kHighShelfParam_CutOffFrequency, kAudioUnitScope_Global, 0, cutOffFrequency, 0)
            AudioUnitSetParameter(internalAU, kHighShelfParam_Gain,            kAudioUnitScope_Global, 0, gain, 0)
    }
}
{'fraction_non_alphanumeric': 0.06911487758945387, 'fraction_numerical': 0.027871939736346517, 'mean_word_length': 1.8477211796246649, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '379010', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1355, 'n_words': 346}