/** @packageDocumentation WAV file handler. Reads and writes ID3v2 and RIFF INFO tags embedded in WAV/RIFF containers. */ import { RiffFile } from "../riffFile.js"; import { WavProperties } from "./wavProperties.js"; import { RiffInfoTag } from "../infoTag.js"; import { Id3v2Tag } from "../../mpeg/id3v2/id3v2Tag.js"; import type { Tag } from "../../tag.js"; import type { ReadStyle } from "../../toolkit/types.js"; import type { IOStream } from "../../toolkit/ioStream.js"; /** * Bitmask identifying which tag formats are present in a WAV file. * Used with {@link WavFile.strip} to select which tags to remove. */ export declare enum WavTagTypes { /** No tag types. */ NoTags = 0, /** Matches ID3v2 tags. */ ID3v2 = 1, /** Matches RIFF INFO tags. */ Info = 2, /** Matches all tag types. */ AllTags = 65535 } /** * WAV file handler. * * WAV is a little-endian RIFF container (`"RIFF"` / `"WAVE"`) that may hold: * - `"fmt "` – audio format description * - `"data"` – raw audio samples * - `"ID3 "` / `"id3 "` – ID3v2 tag * - `"LIST"` – with sub-type `"INFO"` → RIFF INFO tag */ export declare class WavFile extends RiffFile { /** Audio properties parsed from the `"fmt "` chunk, or `null` if not yet read. */ private _properties; /** ID3v2 tag read from the `"ID3 "` chunk, or `null` if absent. */ private _id3v2Tag; /** RIFF INFO tag read from the `"LIST"` / `"INFO"` chunk, or `null` if absent. */ private _infoTag; /** Priority-ordered combined view of all tags (ID3v2 preferred over INFO). */ private _combinedTag; /** Zero-based index of the `"ID3 "` chunk in the chunk list, or `-1` if absent. */ private _id3v2ChunkIndex; /** Zero-based index of the `"LIST"` chunk containing `"INFO"` data, or `-1` if absent. */ private _infoChunkIndex; /** * Private constructor — use {@link WavFile.open} to create instances. * @param stream - The underlying I/O stream for the WAV file. */ private constructor(); /** * Open and parse a WAV 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. * @returns A fully initialised `WavFile` instance. */ static open(stream: IOStream, readProperties?: boolean, readStyle?: ReadStyle): Promise; /** * Returns the combined tag providing unified access to all tag data. * @returns The {@link CombinedTag} for this file (ID3v2 preferred over INFO). */ tag(): Tag; /** * Returns the audio properties parsed from the `"fmt "` chunk. * @returns The {@link WavProperties}, or `null` if `readProperties` was `false` on open. */ audioProperties(): WavProperties | null; /** * The ID3v2 tag embedded in the `"ID3 "` chunk, or `null` if absent. * @returns The {@link Id3v2Tag}, or `null`. */ get id3v2Tag(): Id3v2Tag | null; /** * Whether the file currently contains a non-empty ID3v2 tag chunk. * Returns `true` if an ID3v2 chunk was found during parsing (regardless of tag validity), * matching C++ `hasID3v2Tag()` behavior. * @returns `true` if an ID3v2 chunk is present. */ get hasId3v2Tag(): boolean; /** * The RIFF INFO tag embedded in the `"LIST"` / `"INFO"` chunk, or `null` if absent. * Auto-creates an empty INFO tag on first access so callers can always write to it. * @returns The {@link RiffInfoTag}. */ get infoTag(): RiffInfoTag; /** * Whether the file currently contains a RIFF INFO tag. * Returns `true` if a `LIST/INFO` chunk was found during parsing. * @returns `true` if an INFO tag chunk is present. */ get hasInfoTag(): boolean; /** * Writes all pending tag changes back to the underlying stream. * Matches C++ behavior: removes all existing tag chunks before re-writing. * @param version - Optional ID3v2 version to save as (2 or 3; default is 4). * @returns `true` on success, `false` if the file is read-only. */ save(version?: number): Promise; /** * Removes the tag types indicated by `tags` from the in-memory representation. * Changes are written to disk the next time {@link save} is called. * @param tags - Bitmask of {@link WavTagTypes} to strip (default: all). */ strip(tags?: WavTagTypes): void; /** * Reads all chunks and (optionally) audio properties from the parsed chunk list. * @param readProperties - Whether to parse audio properties. * @param readStyle - Level of detail for audio property parsing. */ private read; } //# sourceMappingURL=wavFile.d.ts.map