Safe Haskell | None |
---|
Low-level interface to the Novation Launchpad.
- data Button
- data Dir
- data Control
- data Buffer
- data FullColor
- data Brightness
- data Color
- = None
- | Color !FullColor !Brightness
- | RedGreen !Brightness !Brightness
- type Message = MidiMessage
- type Messages = [Message]
- noteOn :: Int -> Int -> Message
- cc :: Int -> Int -> Message
- noteOff :: Int -> Int -> Message
- theGlobalConnections :: MVar (Connection, Connection)
- initializeLaunchpad :: Connection -> Connection -> IO ()
- sendMsg :: Messages -> IO ()
- encodeColor :: Color -> Int
- encodeBrightness :: Brightness -> Int
- colorTable :: FullColor -> Brightness -> Int
- flashColor :: FullColor -> Int
- setColor1 :: Button -> Color -> Messages
- turnOff1 :: Button -> Messages
- turnOff :: [Button] -> Messages
- setColor :: [(Button, Color)] -> Messages
- setColor' :: Button -> Int -> Message
- marshalControl :: Button -> Int
- unmarshalControl' :: Int -> Maybe Button
- unmarshalControl :: Int -> Button
- resetMsg :: Messages
- turnOnAll :: Brightness -> Messages
- resetLaunchpad :: Bool -> IO ()
- handShake :: IO ()
- data ButtonPress
- buttonPress :: Bool -> Button -> ButtonPress
- decodeLaunchpadMessage' :: Message -> Maybe ButtonPress
- decodeLaunchpadMessage :: Message -> ButtonPress
- allButtons :: [Button]
- data Grid = Grid {}
- ledUpdateInit :: Messages
- ledUpdateClose :: Messages
- rapidLedUpdateArr :: Grid -> Messages
- rapidLedUpdateList :: [(Button, Color)] -> Messages
- pairs :: [a] -> [(a, a)]
- xxNoteOn :: Color -> Color -> MidiMessage'
- sortNubMap :: [(Button, Color)] -> [(Button, Color)]
definitions
A button of the launchpad. Numbering starts from zero.
(Note that the derived ordering is the same as the "rapid LED update" order!)
A direction, also the left top 4 control buttons in the top row.
A control button (right 4 in the top row)
data Brightness Source
A color. There are two possible specifications:
- either a predefined color with a brightness;
- or exact control of the red and greed leds.
basic midi
type Message = MidiMessageSource
theGlobalConnections :: MVar (Connection, Connection)Source
in-connection, out-connection
initializeLaunchpad :: Connection -> Connection -> IO ()Source
encoding colors
encodeColor :: Color -> IntSource
colorTable :: FullColor -> Brightness -> IntSource
flashColor :: FullColor -> IntSource
setting single leds
control buttons
marshalControl :: Button -> IntSource
unmarshalControl :: Int -> ButtonSource
initialization
Officially, reset is simply CC 0 0
. But the Launchpad implementation
is rather strange and somewhat stupid, see
http://linuxaudio.org/mailarchive/lau/2012/7/12/191303
This convoluted reset sequence may or may not help...
turnOnAll :: Brightness -> MessagesSource
Turns on all leds
resetLaunchpad :: Bool -> IO ()Source
The argument controls if we want to flash all the leds for a moment
button presses
data ButtonPress Source
A button is pressed or released
buttonPress :: Bool -> Button -> ButtonPressSource
Constructor
decodeLaunchpadMessage :: Message -> ButtonPressSource
Unsafe decoding, may throw error
led update
allButtons :: [Button]Source
Sorted list of all Launchpad buttons (sort order is the "rapid led update" order)
ledUpdateInit :: MessagesSource
Actually this is at the moment empty.
ledUpdateClose :: MessagesSource
We have to exit the rapid led update mode before the next update! Setting the grid coordinate mode to XY should do the trick.
rapidLedUpdateArr :: Grid -> MessagesSource
Untested (the grid may be trransposed??)
rapidLedUpdateList :: [(Button, Color)] -> MessagesSource
helper functions
xxNoteOn :: Color -> Color -> MidiMessage'Source