package ῲ.ⁱ.K.K;

import java.util.Arrays;
import ඓ.K.K.K.C1293;

/* renamed from: ῲ.ⁱ.K.K.㴹  reason: contains not printable characters */
/* compiled from: Oscillator */
public class C2192 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public double[] f7642;

    /* renamed from: ඓ  reason: contains not printable characters */
    public double f7643 = 6.283185307179586d;

    /* renamed from: ῲ  reason: contains not printable characters */
    public double[] f7644 = new double[0];

    /* renamed from: K  reason: contains not printable characters */
    public float[] f7645 = new float[0];

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f7646;

    public String toString() {
        StringBuilder r0 = C1293.m3416("pos =");
        r0.append(Arrays.toString(this.f7644));
        r0.append(" period=");
        r0.append(Arrays.toString(this.f7645));
        return r0.toString();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public double m5766(double d) {
        double abs;
        switch (this.f7646) {
            case 1:
                return Math.signum(0.5d - (m5767(d) % 1.0d));
            case 2:
                abs = Math.abs((((m5767(d) * 4.0d) + 1.0d) % 4.0d) - 2.0d);
                break;
            case 3:
                return (((m5767(d) * 2.0d) + 1.0d) % 2.0d) - 1.0d;
            case 4:
                abs = ((m5767(d) * 2.0d) + 1.0d) % 2.0d;
                break;
            case 5:
                return Math.cos(m5767(d) * this.f7643);
            case 6:
                double abs2 = 1.0d - Math.abs(((m5767(d) * 4.0d) % 4.0d) - 2.0d);
                abs = abs2 * abs2;
                break;
            default:
                return Math.sin(m5767(d) * this.f7643);
        }
        return 1.0d - abs;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public double m5767(double d) {
        if (d < 0.0d) {
            d = 0.0d;
        } else if (d > 1.0d) {
            d = 1.0d;
        }
        int binarySearch = Arrays.binarySearch(this.f7644, d);
        if (binarySearch > 0) {
            return 1.0d;
        }
        if (binarySearch == 0) {
            return 0.0d;
        }
        int i = (-binarySearch) - 1;
        float[] fArr = this.f7645;
        int i2 = i - 1;
        double d2 = (double) (fArr[i] - fArr[i2]);
        double[] dArr = this.f7644;
        double d3 = d2 / (dArr[i] - dArr[i2]);
        return ((((d * d) - (dArr[i2] * dArr[i2])) * d3) / 2.0d) + ((d - dArr[i2]) * (((double) fArr[i2]) - (dArr[i2] * d3))) + this.f7642[i2];
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5769(double d, float f) {
        int length = this.f7645.length + 1;
        int binarySearch = Arrays.binarySearch(this.f7644, d);
        if (binarySearch < 0) {
            binarySearch = (-binarySearch) - 1;
        }
        this.f7644 = Arrays.copyOf(this.f7644, length);
        this.f7645 = Arrays.copyOf(this.f7645, length);
        this.f7642 = new double[length];
        double[] dArr = this.f7644;
        System.arraycopy(dArr, binarySearch, dArr, binarySearch + 1, (length - binarySearch) - 1);
        this.f7644[binarySearch] = d;
        this.f7645[binarySearch] = f;
    }

    /* renamed from: K  reason: contains not printable characters */
    public double m5768(double d) {
        if (d <= 0.0d) {
            d = 1.0E-5d;
        } else if (d >= 1.0d) {
            d = 0.999999d;
        }
        int binarySearch = Arrays.binarySearch(this.f7644, d);
        if (binarySearch > 0 || binarySearch == 0) {
            return 0.0d;
        }
        int i = (-binarySearch) - 1;
        float[] fArr = this.f7645;
        int i2 = i - 1;
        double d2 = (double) (fArr[i] - fArr[i2]);
        double[] dArr = this.f7644;
        double d3 = d2 / (dArr[i] - dArr[i2]);
        return (((double) fArr[i2]) - (d3 * dArr[i2])) + (d * d3);
    }
}
