import { Rect, RenderCanvasSize, RenderWindow } from "./rendering"; import { AudioModel } from "./recordings"; import { Signal } from "@lit-labs/preact-signals"; import { Annotation } from "./annotation"; export type Milliseconds = number; export type Seconds = number; export type Hertz = number; export type MHertz = number; export type Sample = number; export type Pixel = number; export type EmUnit = number; export type AngleDegrees = number; /** * A value that is bounded from [0, 1] * A unit intervals can be used to represent percentages in decimal form */ export type UnitInterval = number; export type ScaleDomain = [min: T, min: T]; export type ScaleRange = [min: T, max: T]; export type LinearScale = (value: T) => Pixel; export type InverseLinearScale = (value: Pixel) => T; export type TemporalScale = LinearScale; export type FrequencyScale = LinearScale; export type InvertTemporalScale = InverseLinearScale; export type InvertFrequencyScale = InverseLinearScale; export declare class UnitConverter { readonly renderWindow: Signal; readonly canvasSize: Signal; readonly audioModel: Signal; readonly melScale: Signal; constructor(renderWindow: Signal, canvasSize: Signal, audioModel: Signal, melScale: Signal); readonly nyquist: import("@lit-labs/preact-signals").ReadonlySignal; private readonly frequencyInterpolator; readonly temporalDomain: import("@lit-labs/preact-signals").ReadonlySignal>; readonly frequencyDomain: import("@lit-labs/preact-signals").ReadonlySignal>; readonly temporalRange: import("@lit-labs/preact-signals").ReadonlySignal>; readonly frequencyRange: import("@lit-labs/preact-signals").ReadonlySignal>; /** * Convert Seconds into a Pixel value on the canvas * * @param value the value in seconds * @returns the x-offset that the seconds value should be drawn */ readonly scaleX: import("@lit-labs/preact-signals").ReadonlySignal; /** * Convert a Pixel value on a canvas value into a number of Seconds * * @param value the x-offset on the canvas * @returns what seconds value the x-offset represents */ readonly scaleXInverse: import("@lit-labs/preact-signals").ReadonlySignal; /** * Convert Hertz into a Pixel value on the canvas * * @param value the value in Hertz * @returns the y-offset that the Hertz value should be drawn */ readonly scaleY: import("@lit-labs/preact-signals").ReadonlySignal; /** * Convert a Pixel value on a canvas into a number of Hertz * * @param value the y-offset on the canvas * @returns what Hertz value the y-offset represents */ readonly scaleYInverse: import("@lit-labs/preact-signals").ReadonlySignal; annotationRect(annotation: Readonly): Readonly>>; /** * @returns * A boolean indicating if any part of the value is within the temporal * domain */ overlapsTemporalDomain(value: ScaleDomain): boolean; /** * @returns * A boolean indicating if any part of the value is within the frequency * domain. */ overlapsFrequencyDomain(value: ScaleDomain): boolean; /** * @returns a function that converts a value to a pixel value */ private linearScale; /** * @returns a function that converts a pixel value to a value */ private inverseLinearScale; /** * calculate the magnitude of a linear function using * (y_2 - y_1) / (x_2 - x_1) * * @returns the magnitude of the mathematical function */ private calculateMagnitude; }