Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
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.