UNPKG

shimi

Version:

A JS framework for building complex MIDI applications

74 lines (73 loc) 3.06 kB
import ShimiEvent, { ShimiEventData } from './ShimiEvent'; /** * The MidiAccessPortEventData class extends ShimiEventData. It contains a reference to the source MidiAccess that created the event data, as well as information about a port that has changed. * * @category Midi IO */ export declare class MidiAccessPortEventData extends ShimiEventData<MidiAccess> { /** The port which has been added, removed, or changed in some way. */ get port(): any; private _port; constructor(source: MidiAccess, port: any); } /** * The MidiAccessPortEvent class extends ShimiEvent, providing an object which can be subscribed to. * * It distributes events which point back to the source MidiAccess, and a MidiAccessPortEventData object that contains the event information. * * @Category Midi IO */ export declare class MidiAccessPortEvent extends ShimiEvent<MidiAccessPortEventData, MidiAccess> { } /** * The MidiAccess class provides an interface for fetching MIDI ports which data can be sent to, or received from. * * The recommended way to get a new instance of this class is through the asynchronous `request()` method. * * Example: * ``` * const midiAccess = await MidiAccess.request(); * console.log(midiAccess.getOutPortNames()); * ``` * * @category Midi IO */ export default class MidiAccess { /** Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable. */ get typeName(): string; /** Calling this static method is the recommended way to get new instances of this class. It waits for the MIDI access request to be confirmed before returning a new MidiAccess instance. */ static request(): Promise<MidiAccess>; private _baseAccess; /** Please use the `MidiAccess.request()` method instead. */ constructor(baseAccess: any); private _onBaseAccessStateChange; /** * The portChanged event dispatches an event whenever a new port is added, or an existing port is removed/modified. */ get portChanged(): MidiAccessPortEvent; private _portChanged; /** Disconnects the MidiAccess object from its baseAccess. This is called to free things up for garbage collection. The MidiAccess object is entirely useless after this method has been called on it. */ detach(): void; /** * This method searches through all MIDI out ports for a specific one by name, and returns the port object. * @param portName The name of the expected MIDI out port. * @returns */ getOutPort(portName: string): any; /** * This method searches through all MIDI in ports for a specific one by name, and returns the port object. * @param portName The name of the expected MIDI in port. * @returns */ getInPort(portName: string): any; /** * This method returns the names of all available MIDI out ports. * @returns */ getOutPortNames(): string[]; /** * This method returns the names of all available MIDI in ports. * @returns */ getInPortNames(): string[]; }