Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

Midi.Interface

Description

Common interface for the MIDI drivers.

Synopsis

Documentation

type Initialize a Source #

Arguments

 = String

register this name with CoreMIDI

-> WantMessage 
-> (Either Error (RawInterface Midi.WriteMessage) -> IO a) 
-> IO a 

type WantMessage = ByteString.ByteString -> Bool Source #

Read msgs that return false are filtered. This uses a raw ByteString to avoid the decode overhead for messages that will be rejected, probably in a high-priority callback. TODO I could probably make this a bitmask or something and put it down in the driver.

data RawInterface write_message Source #

Produced by an initialize function.

Constructors

Interface 

Fields

Instances

Instances details
Show (RawInterface a) Source # 
Instance details

Defined in Midi.Interface

data Message Source #

Annotate a WriteMessage with additional control messages.

Constructors

Midi !Midi.WriteMessage 
AllNotesOff !RealTime

Turn off sounding notes on all devices and channels.

AllDevices !RealTime ![Midi.Message]

Emit the messages for all devices that have been used. This doesn't care if they have sounding notes because control state persists after NoteOff.

Instances

Instances details
Show Message Source # 
Instance details

Defined in Midi.Interface

DeepSeq.NFData Message Source # 
Instance details

Defined in Midi.Interface

Methods

rnf :: Message -> () #

Eq Message Source # 
Instance details

Defined in Midi.Interface

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

Pretty Message Source # 
Instance details

Defined in Midi.Interface

note_tracker :: Bool -> (Midi.WriteMessage -> IO (Maybe err)) -> IO (Message -> IO (Maybe err)) Source #

Wrap a write_message and keep track of which notes are on. It can then handle reset messages which need to know current state to reset it.

This is necessary because some synthesizers do not support AllNotesOff, but also relieves callers of having to track which devices and channels have active notes.