<commit_before>//
//  AK<%= au_name %>Window.swift
//  AudioKit
//
//  Autogenerated by scripts by <NAME>. Do not edit directly.
//  Copyright (c) 20<%= Time.now.strftime('%y') %> <NAME>. All rights reserved.
//

#if os(OSX)
    import Foundation
    import Cocoa

    /// A Window to control AK<%= au_name %> in Playgrounds
    public class AK<%= au_name %>Window: NSWindow {

        private let windowWidth = 400
        private let padding = 30
        private let sliderHeight = 20
        private let numberOfComponents = <%= parameters.count %>

<% parameters.each do |parameter| -%>
        /// Slider to control <%= parameter[:variable] %>
        public let <%= parameter[:variable] %>Slider: NSSlider
<% end -%>

<% parameters.each do |parameter| -%>
        private let <%= parameter[:variable] %>TextField: NSTextField
<% end -%>

        private var <%= au_name.uncapitalize %>: AK<%= au_name %>

        /// Initiate the AK<%= au_name %> window
        public init(_ control: AK<%= au_name %>) {
            <%= au_name.uncapitalize %> = control
            let sliderWidth = windowWidth - 2 * padding

<% parameters.each do |parameter| -%>
            <%= parameter[:variable] %>Slider = newSlider(sliderWidth)
<% end -%>

<% parameters.each do |parameter| -%>
            <%= parameter[:variable] %>TextField = newTextField(sliderWidth)
<% end -%>

            let titleHeightApproximation = 50
            let windowHeight = padding * 2 + titleHeightApproximation + numberOfComponents * 3 * sliderHeight

            super.init(contentRect: NSRect(x: padding, y: padding, width: windowWidth, height: windowHeight),
                styleMask: NSTitledWindowMask,
                backing: .Buffered,
                `defer`: false)
            self.hasShadow = true
            self.styleMask = NSBorderlessWindowMask | NSResizableWindowMask
            self.movableByWindowBackground = true
            self.level = 7
            self.title = "AK<%= au_name %>"

            let viewRect = NSRect(x: 0, y: 0, width: windowWidth, height: windowHeight)
            let view = NSView(frame: viewRect)

            let topTitle = NSTextField()
            topTitle.stringValue = "AK<%= au_name %>"
            topTitle.editable = false
            topTitle.drawsBackground = false
            topTitle.bezeled = false
            topTitle.alignment = NSCenterTextAlignment
            topTitle.font = NSFont(name: "Lucida Grande", size: 24)
            topTitle.sizeToFit()
            topTitle.frame.origin.x = CGFloat(windowWidth / 2) - topTitle.frame.width / 2
            topTitle.frame.origin.y = CGFloat(windowHeight - padding) - topTitle.frame.height
            view.addSubview(topTitle)

<% parameters.each_with_index do |parameter, i| -%>
            makeTextField(<%= parameter[:variable] %>TextField, view: view, below: topTitle, distance: <%= 2 * (i+1) + i %>,
                stringValue: "<%= parameter[:variable].underscore.humanize.titlecase %>: \(<%= au_name.uncapitalize %>.<%= parameter[:variable] %>) <%= parameter[:type] %>")
            makeSlider(<%= parameter[:variable] %>Slider, view: view, below: topTitle, distance: <%= 2 * (i+1) + i + 1 %>, target: self,
                action: "update<%= parameter[:variable].capitalize %>",
                currentValue: <%= au_name.uncapitalize %>.<%= parameter[:variable] %>,
                minimumValue: <%= parameter[:min] %>,
                maximumValue: <%= parameter[:max] %>)

<% end -%>
            self.contentView!.addSubview(view)
            self.makeKeyAndOrderFront(nil)
        }

<% parameters.each do |parameter| -%>
        internal func update<%= parameter[:variable].capitalize %>() {
            <%= au_name.uncapitalize %>.<%= parameter[:variable] %> = <%= parameter[:variable] %>Slider.floatValue
            <%= parameter[:variable] %>TextField.stringValue =
            "<%= parameter[:variable].underscore.humanize.titlecase %> \(String(format: "%0.4f", <%= au_name.uncapitalize %>.<%= parameter[:variable] %>)) <%= parameter[:type] %>"
        }
<% end -%>

        /// Required initializer
        required public init?(coder: NSCoder) {
            fatalError("init(coder:) has not been implemented")
        }
    }

#endif<commit_msg>Removing the OS check from this template since it is only for the OSX project<commit_after>//
//  AK<%= au_name %>Window.swift
//  AudioKit
//
//  Autogenerated by scripts by <NAME>. Do not edit directly.
//  Copyright (c) 20<%= Time.now.strftime('%y') %> <NAME>. All rights reserved.
//

import Foundation
import Cocoa

/// A Window to control AK<%= au_name %> in Playgrounds
public class AK<%= au_name %>Window: NSWindow {

    private let windowWidth = 400
    private let padding = 30
    private let sliderHeight = 20
    private let numberOfComponents = <%= parameters.count %>

<% parameters.each do |parameter| -%>
    /// Slider to control <%= parameter[:variable] %>
    public let <%= parameter[:variable] %>Slider: NSSlider
<% end -%>

<% parameters.each do |parameter| -%>
    private let <%= parameter[:variable] %>TextField: NSTextField
<% end -%>

    private var <%= au_name.uncapitalize %>: AK<%= au_name %>

    /// Initiate the AK<%= au_name %> window
    public init(_ control: AK<%= au_name %>) {
        <%= au_name.uncapitalize %> = control
        let sliderWidth = windowWidth - 2 * padding

<% parameters.each do |parameter| -%>
        <%= parameter[:variable] %>Slider = newSlider(sliderWidth)
<% end -%>

<% parameters.each do |parameter| -%>
        <%= parameter[:variable] %>TextField = newTextField(sliderWidth)
<% end -%>

        let titleHeightApproximation = 50
        let windowHeight = padding * 2 + titleHeightApproximation + numberOfComponents * 3 * sliderHeight

        super.init(contentRect: NSRect(x: padding, y: padding, width: windowWidth, height: windowHeight),
            styleMask: NSTitledWindowMask,
            backing: .Buffered,
            `defer`: false)
        self.hasShadow = true
        self.styleMask = NSBorderlessWindowMask | NSResizableWindowMask
        self.movableByWindowBackground = true
        self.level = 7
        self.title = "AK<%= au_name %>"

        let viewRect = NSRect(x: 0, y: 0, width: windowWidth, height: windowHeight)
        let view = NSView(frame: viewRect)

        let topTitle = NSTextField()
        topTitle.stringValue = "AK<%= au_name %>"
        topTitle.editable = false
        topTitle.drawsBackground = false
        topTitle.bezeled = false
        topTitle.alignment = NSCenterTextAlignment
        topTitle.font = NSFont(name: "Lucida Grande", size: 24)
        topTitle.sizeToFit()
        topTitle.frame.origin.x = CGFloat(windowWidth / 2) - topTitle.frame.width / 2
        topTitle.frame.origin.y = CGFloat(windowHeight - padding) - topTitle.frame.height
        view.addSubview(topTitle)

<% parameters.each_with_index do |parameter, i| -%>
        makeTextField(<%= parameter[:variable] %>TextField, view: view, below: topTitle, distance: <%= 2 * (i+1) + i %>,
            stringValue: "<%= parameter[:variable].underscore.humanize.titlecase %>: \(<%= au_name.uncapitalize %>.<%= parameter[:variable] %>) <%= parameter[:type] %>")
        makeSlider(<%= parameter[:variable] %>Slider, view: view, below: topTitle, distance: <%= 2 * (i+1) + i + 1 %>, target: self,
            action: "update<%= parameter[:variable].capitalize %>",
            currentValue: <%= au_name.uncapitalize %>.<%= parameter[:variable] %>,
            minimumValue: <%= parameter[:min] %>,
            maximumValue: <%= parameter[:max] %>)

<% end -%>
        self.contentView!.addSubview(view)
        self.makeKeyAndOrderFront(nil)
    }

<% parameters.each do |parameter| -%>
    internal func update<%= parameter[:variable].capitalize %>() {
        <%= au_name.uncapitalize %>.<%= parameter[:variable] %> = <%= parameter[:variable] %>Slider.floatValue
        <%= parameter[:variable] %>TextField.stringValue =
        "<%= parameter[:variable].underscore.humanize.titlecase %> \(String(format: "%0.4f", <%= au_name.uncapitalize %>.<%= parameter[:variable] %>)) <%= parameter[:type] %>"
    }
<% end -%>

    /// Required initializer
    required public init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
{'fraction_non_alphanumeric': 0.15102533172496985, 'fraction_numerical': 0.006755126658624849, 'mean_word_length': 2.7669241253975465, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, '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': '6638726', 'n_tokens_mistral': 2654, 'n_tokens_neox': 2366, 'n_words': 566}