Safe Haskell | None |
---|
- class C event where
- note :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
- noteExplicitOff :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
- noteImplicitOff :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
- program :: C event => event -> Maybe (Channel, Program)
- anyController :: C event => event -> Maybe (Channel, (Controller, Int))
- mode :: C event => event -> Maybe (Channel, T)
- pitchBend :: C event => event -> Maybe (Channel, Int)
- channelPressure :: C event => event -> Maybe (Channel, Int)
Documentation
class C event where
All methods have default implementations that return Nothing
.
This helps implementing event data types
that support only a subset of types of events.
Maybe a better approach is to provide type classes
for every type of event
and make C
a subclass of all of them.
note :: event -> Maybe (Channel, (Velocity, Pitch, Bool))
Warning: This returns note events as they are,
that is, a NoteOff p 64
might be encoded as such or as NoteOn p 0
depending on the content of event
.
For normalized results you may use noteExplicitOff
.
program :: event -> Maybe (Channel, Program)
anyController :: event -> Maybe (Channel, (Controller, Int))
pitchBend :: event -> Maybe (Channel, Int)
channelPressure :: event -> Maybe (Channel, Int)
note :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
Warning: This returns note events as they are,
that is, a NoteOff p 64
might be encoded as such or as NoteOn p 0
depending on the content of event
.
For normalized results you may use noteExplicitOff
.
noteExplicitOff :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
Like note
, but converts NoteOn p 0
to NoteOff p 64
.
See explicitNoteOff
.
noteImplicitOff :: C event => event -> Maybe (Channel, (Velocity, Pitch, Bool))
Like note
, but converts NoteOff p 64
to NoteOn p 0
.
See implicitNoteOff
.
anyController :: C event => event -> Maybe (Channel, (Controller, Int))
channelPressure :: C event => event -> Maybe (Channel, Int)