import { DEFAULT } from './Util'; import SynthInstrument from './SynthInstrument'; import { IGrid, ITile } from './Interfaces'; export declare function makeDefaultInstruments(width: number, height: number, noteLength: number): SynthInstrument[]; /** A 2-D matrix that keeps track of notes and can enable, disable, and play them */ export default class Grid implements IGrid { get data(): readonly ITile[]; get instrumentCount(): number; private _data; /** * The width of the grid in tiles */ get width(): number; private _width; /** * The height of the grid in tiles */ get height(): number; /** * Index of the current instrument that's being placed with setTileValue */ readonly currentInstrument = 0; private _height; private instruments; private makeInstruments; private noteLength; private defaultNoteLength; /** * Creates a new Grid player * @param width - The width of the grid in tiles * @param height - The height of the grid in tiles * @param renderer - The renderer to use to render the grid */ constructor(width: number, height: number, noteLength?: number, makeInstruments?: typeof makeDefaultInstruments); /** * Update the size of the grid. * Note: If shrinking, tiles outside the space of * new grid will be lost * * @param newWidth - New width in tiles * @param newHeight - New height in tiles * @param newNoteLength - New note length. If not set, use previous value, * or recalculate the default if using the default value previously. * If using the DEFAULT symbol explicitly recalculate the default. */ setSize(newWidth?: number, newHeight?: number, newNoteLength?: number | typeof DEFAULT | null): void; getPlayheadX(): number; /** * Gets whether a grid tile is currently lit up (armed) * @param x - The x position, measured in grid tiles * @param y - The y position, measured in grid tiles * @returns Whether the tile is lit up */ getTileValue(x: number, y: number, instrument?: number): boolean; /** * Sets whether a grid tile is currently lit up (armed) * @param x - The x position, measured in grid tiles * @param y - The y position, measured in grid tiles * @param bool - Whether the tile should be turned on (true) or off (false) */ setTileValue(x: number, y: number, bool: boolean, instrument?: number): void; /** * Toggles whether a grid tile is currently lit up (armed) * @param x - The x position, measured in grid tiles * @param y - The y position, measured in grid tiles */ toggleTileValue(x: number, y: number, instrument?: number): void; /** * Turns off all tiles and removes all notes */ clearAllTiles(): void; /** * Set the instrument that the {@link Grid.setTileValue} will put * @param instrumentId */ setCurrentInstrument(instrumentId: number): void; /** * Sets whether the ToneMatrix grid is muted. * @param muted - True for muted, false for unmuted */ setMuted(muted: boolean): void; /** * Dispose of all resources used by this grid object. */ dispose(): void; }