<commit_before>//
//  AK3DPanner.swift
//  AudioKit
//
//  Created by <NAME>, revision history on Github.
//  Copyright © 2017 <NAME>. All rights reserved.
//

/// 3-D Spatialization of the input
open class AK3DPanner: AKNode {
    fileprivate let environmentNode = AVAudioEnvironmentNode()

    /// Position of sound source along x-axis
    open dynamic var x: Double {
        willSet {
            environmentNode.listenerPosition.x = Float(-newValue)
        }
    }

    /// Position of sound source along y-axis
    open dynamic var y: Double {
        willSet {
            environmentNode.listenerPosition.y = Float(-newValue)
        }
    }

    /// Position of sound source along z-axis
    open dynamic var z: Double {
        willSet {
            environmentNode.listenerPosition.z = Float(-newValue)
        }
    }

    /// Initialize the panner node
    ///
    /// - Parameters:
    ///   - input: Node to pan in 3D Space
    ///   - x:     x-axis location in meters
    ///   - y:     y-axis location in meters
    ///   - z:     z-axis location in meters
    ///
    public init(_ input: AKNode?, x: Double = 0, y: Double = 0, z: Double = 0) {
        self.x = x
        self.y = y
        self.z = z
        super.init(avAudioNode: environmentNode, attach: true)

        guard let inputNode = input else {
            return
        }

        var inputsConnectionPoints = inputNode.connectionPoints
        inputsConnectionPoints.append(AVAudioConnectionPoint(node: environmentNode,
                                                             bus: environmentNode.numberOfInputs))

        let format = AVAudioFormat(standardFormatWithSampleRate: AKSettings.sampleRate, channels: 1)

        AudioKit.engine.connect(inputNode.avAudioNode, to: inputsConnectionPoints, fromBus: 0, format: format)
    }

}<commit_msg>Implemented AKInput for AK3DPanner.<commit_after>//
//  AK3DPanner.swift
//  AudioKit
//
//  Created by <NAME>, revision history on Github.
//  Copyright © 2017 <NAME>. All rights reserved.
//

/// 3-D Spatialization of the input
open class AK3DPanner: AKNode, AKInput {
    fileprivate let environmentNode = AVAudioEnvironmentNode()

    /// Position of sound source along x-axis
    open dynamic var x: Double {
        willSet {
            environmentNode.listenerPosition.x = Float(-newValue)
        }
    }

    /// Position of sound source along y-axis
    open dynamic var y: Double {
        willSet {
            environmentNode.listenerPosition.y = Float(-newValue)
        }
    }

    /// Position of sound source along z-axis
    open dynamic var z: Double {
        willSet {
            environmentNode.listenerPosition.z = Float(-newValue)
        }
    }

    var inputMixer = AKMixer()
    /// Initialize the panner node
    ///
    /// - Parameters:
    ///   - input: Node to pan in 3D Space
    ///   - x:     x-axis location in meters
    ///   - y:     y-axis location in meters
    ///   - z:     z-axis location in meters
    ///
    public init(_ input: AKNode? = nil, x: Double = 0, y: Double = 0, z: Double = 0) {
        self.x = x
        self.y = y
        self.z = z
        super.init(avAudioNode: environmentNode, attach: true)

        guard let inputNode = input else {
            return
        }
        input?.connect(to: inputMixer)
        var inputsConnectionPoints = inputNode.connectionPoints
        inputsConnectionPoints.append(AVAudioConnectionPoint(node: inputMixer.avAudioNode,
                                                             bus: inputMixer.nextInput.bus))

        let format = AVAudioFormat(standardFormatWithSampleRate: AKSettings.sampleRate, channels: 1)

        AudioKit.engine.connect(inputNode.avAudioNode, to: inputsConnectionPoints, fromBus: 0, format: format)
    }
    public var inputNode: AVAudioNode {
        return inputMixer.avAudioNode
    }
    open override func detach() {
        AudioKit.detach(nodes: [environmentNode, inputMixer.avAudioNode])
    }
}
{'fraction_non_alphanumeric': 0.09668508287292818, 'fraction_numerical': 0.006780512305374184, 'mean_word_length': 1.9394833948339483, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4936785', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1080, 'n_words': 319}