Skip to content

Commit

Permalink
readme and version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante1349 committed Jan 27, 2022
1 parent 99a58ac commit 43c3aee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@ npx cap sync

## 🎼 Usage

### Subscribe to MIDI events after a device is opened

#### Open device and subscribe to MidiMessages
```typescript
const options: DeviceOptions = {
deviceNumber: 0 // Choose device from listMIDIDevices()
}

await MIDI.openDevice(options)
.catch((e) => console.error(e))
this.devices = await MIDI.listMIDIDevices();

MIDI.addDeviceListener((message: MidiMessage) => console.log(message));
MIDI.addListener('MIDI_MSG_EVENT', (message: MidiMessage) => {
console.log(message);
});
```
#### Subscribe to device connection changes
```typescript
await MIDI.initConnectionListener();

interface MidiMessage {
type: string; // NoteOn, NoteOff, UNKNOWN - XXX
note: number;
velocity: number;
}
MIDI.addListener('MIDI_CON_EVENT', (devices: { value: string[] }) => {
console.log(devices.value);
});
```

## 🎛 API
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capacitor-midi",
"version": "0.0.6",
"version": "0.0.7",
"description": "Grants access to midi devices via native libraries or WebMIDI.",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down

0 comments on commit 43c3aee

Please sign in to comment.