メインコンテンツまでスキップ

hooks/useMIDIAccess

Type Aliases

MIDIAccessOptions

type MIDIAccessOptions = object;

Defined in: dom/dist/index.d.ts:117

Properties

sysex?
optional sysex?: boolean;

Defined in: dom/dist/index.d.ts:126

Ask for system exclusive messages as well.

Browsers treat this as a separate, more sensitive permission, so leave it off unless the app actually reads or sends sysex.

Default
false

Functions

useMIDIAccess()

function useMIDIAccess(requestOnMount?): object;

Defined in: react/src/hooks/useMIDIAccess.ts:23

Hooks for requesting MIDI access in the browser. The first argument allows you to choose whether to request access on mount.

inputs follows the devices: it changes as one is plugged in or unplugged, so a list of devices needs no statechange listener of its own.

request takes { sysex: true } when the app needs system exclusive messages. Browsers treat that as a separate, more sensitive permission, so ask for it only when it is actually used.

Parameters

ParameterTypeDefault value
requestOnMountbooleantrue

Returns

object

error
error: MIDIAccessError | null;
inputs
inputs: readonly MIDIInput[];
midiAccess
midiAccess: MIDIAccess | null;
request
request: (options?) => void = instance.request;
Parameters
ParameterType
options?MIDIAccessOptions
Returns

void