Awesome
Fable.Import.WebMIDI
Fable bindings for Web MIDI
install with DotNet:
dotnet add package Fable.Import.WebMIDI
or with Paket:
paket add Fable.Import.WebMIDI
Usage
Example in Elmish:
open Fable.Import.WebMIDI
type Model = { MIDIAccess: IMIDIAccess option
ErrorMessage: string option }
type Msg = | MIDISuccess of IMIDIAccess
| MIDIError of exn
| MIDIStateChanged of IMIDIConnectionEvent
let init () : Model*Cmd<Msg> =
{ MIDIAccess = None
ErrorMessage = None }, Cmd.ofPromise MIDI.requestAccess [ Sysex true ] MIDISuccess MIDIError
let update (msg: Msg) (model: Model) : Model*Cmd<Msg> =
match msg with
| MIDISuccess of midiAccess ->
let stateChangeSub dispatch =
let onStateChange ev =
dispatch (MIDIStateChanged ev)
midiAccess.OnStateChange <- onStateChange
{ model with MIDIAccess = Some midiAccess }, Cmd.ofSub stateChangeSub
| MIDIError of ex ->
{ model with ErrorMessage = Some ex.Message }, Cmd.none
| MIDIStateChanged ev ->
printfn "MIDI state changed"
model, Cmd.none
...
Building
Make sure the following requirements are installed in your system:
- dotnet SDK 2.0.2 or higher
- node.js 6.11 or higher
- yarn
- Mono if you're on Linux or macOS.
Then you just need to type ./build.cmd
or ./build.sh
Release
In order to push your package to [nuget.org][https://nuget.org] you need to add your API keys to NUGET_KEY
environmental variable.
You can create a key here.
- Update RELEASE_NOTES with a new version, data and release notes ReleaseNotesHelper. Ex:
#### 0.2.0 - 30.04.2017
* FEATURE: Does cool stuff!
* BUGFIX: Fixes that silly oversight
- You can then use the Release target. This will:
- make a commit bumping the version: Bump version to 0.2.0
- publish the package to nuget
- push a git tag
./build.sh Release
MacOS/Linux | Windows |
---|---|
Nuget
Stable | Prerelease |
---|---|