/** @packageDocumentation TrueAudio (TTA) file format handler. Supports ID3v1 and ID3v2 tags. */ import { File } from "../file.js"; import { Tag } from "../tag.js"; import { ReadStyle } from "../toolkit/types.js"; import type { IOStream } from "../toolkit/ioStream.js"; import { ID3v1Tag } from "../mpeg/id3v1/id3v1Tag.js"; import { Id3v2Tag } from "../mpeg/id3v2/id3v2Tag.js"; import { TrueAudioProperties } from "./trueAudioProperties.js"; /** Bitmask of tag types present in or to be applied to a TrueAudio file. */ export declare enum TrueAudioTagTypes { /** No tags. */ NoTags = 0, /** ID3v1 tag appended at the end of the file. */ ID3v1 = 1, /** ID3v2 tag prepended at the start of the file. */ ID3v2 = 2, /** All supported tag types. */ AllTags = 65535 } /** * TrueAudio (TTA) file format handler. * * Supports ID3v2 (primary) and ID3v1 (secondary) tags. */ export declare class TrueAudioFile extends File { /** The ID3v2 tag read from or to be written to the file, or `null` if absent. */ private _id3v2Tag; /** The ID3v1 tag read from or to be written to the file, or `null` if absent. */ private _id3v1Tag; /** Priority-ordered combined view of all tags (ID3v2 preferred over ID3v1). */ private _combinedTag; /** Parsed audio properties, or `null` if not yet read. */ private _properties; /** Byte offset of the ID3v2 tag in the file, or `-1` if absent. */ private _id3v2Location; /** Original byte size of the ID3v2 tag on disk (used for in-place replacement). */ private _id3v2OriginalSize; /** Byte offset of the ID3v1 tag in the file, or `-1` if absent. */ private _id3v1Location; /** * Private constructor — use {@link TrueAudioFile.open} to create instances. * @param stream - The underlying I/O stream for the TTA file. */ private constructor(); /** * Open and parse a TrueAudio file from the given stream. * @param stream - The I/O stream to read from. * @param readProperties - Whether to parse audio properties. Defaults to `true`. * @param readStyle - Level of detail for audio property parsing. Defaults to `ReadStyle.Average`. * @returns A fully initialised `TrueAudioFile` instance. */ static open(stream: IOStream, readProperties?: boolean, readStyle?: ReadStyle): Promise; /** * Quick-check whether `stream` looks like a valid TrueAudio file. * A TTA file starts with "TTA"; an ID3v2 tag may precede the signature. */ static isSupported(stream: IOStream): Promise; /** * Returns the combined tag providing unified access to all tag data. * @returns The {@link CombinedTag} for this file (ID3v2 preferred over ID3v1). */ tag(): Tag; /** * Returns the audio properties parsed from the TTA header. * @returns The {@link TrueAudioProperties}, or `null` if `readProperties` was `false` on open. */ audioProperties(): TrueAudioProperties | null; /** * Writes all pending tag changes to the file. * @returns `true` on success, `false` if the file is read-only. */ save(): Promise; /** * Get the ID3v2 tag, optionally creating one if absent. * @param create - When `true`, a new empty tag is created if none exists. * @returns The {@link Id3v2Tag}, or `null` if absent and `create` is `false`. */ id3v2Tag(create?: boolean): Id3v2Tag | null; /** * Get the ID3v1 tag, optionally creating one if absent. * @param create - When `true`, a new empty tag is created if none exists. * @returns The {@link ID3v1Tag}, or `null` if absent and `create` is `false`. */ id3v1Tag(create?: boolean): ID3v1Tag | null; /** * Remove the specified tag types from the in-memory representation. * Call `save()` afterwards to persist the changes to disk. * @param tags - Bitmask of tag types to remove. Defaults to {@link TrueAudioTagTypes.AllTags}. */ strip(tags?: TrueAudioTagTypes): void; /** Whether the file on disk has an ID3v1 tag. */ get hasID3v1Tag(): boolean; /** Whether the file on disk has an ID3v2 tag. */ get hasID3v2Tag(): boolean; /** * Reads all tags and (optionally) audio properties from the file. * @param readProperties - Whether to parse audio properties. * @param readStyle - Level of detail for audio property parsing. */ private read; /** * Searches the start of the file for an ID3v2 tag and, if found, * populates {@link _id3v2Location}, {@link _id3v2OriginalSize}, and {@link _id3v2Tag}. */ private findID3v2; /** * Searches the end of the file for an ID3v1 tag and, if found, * populates {@link _id3v1Location} and {@link _id3v1Tag}. */ private findID3v1; /** * Rebuilds {@link _combinedTag} from the currently active tag objects, * ordered by priority (ID3v2 before ID3v1). */ private refreshCombinedTag; } //# sourceMappingURL=trueAudioFile.d.ts.map