launchpad-control-0.0.1.0: High and low-level interface to the Novation Launchpad midi controller.

Safe HaskellNone

System.MIDI.Launchpad.AppFramework.Internal

Contents

Synopsis

simple colors

controlColor :: ColorSource

Default color of the control buttons (session, user modes, mixer), which is amber

pure interface

data PureApp cfg mode state Source

We suppose an application can have different modes (similarly as in Ableton one can have session, session overview, different mixer modes, etc), which are basically different "screens" on the Launchpad; and also a global state. See the example applications how it is intended to be used.

Constructors

PureApp 

Fields

pAppConfig :: cfg

application-specific configuration

pAppIniState :: (mode, state)

initial state of the application

pAppStartStop :: cfg -> Bool -> state -> state

what to do when get start or stop playing MIDI signal

pAppRender :: cfg -> mode -> state -> Maybe Int -> [(Button, Color)]

render the screen (it will optimized, don't worry)

pAppButton :: cfg -> ButtonPress -> (mode, state) -> ((mode, state), [MidiMessage'])

the user presses a button

pAppSync :: cfg -> mode -> state -> Int -> (state, [MidiMessage'])

external MIDI sync signal (24 times per quarter note)

render only the difference between old and new display

unsafeRenderDiff :: [(Button, Color)] -> [(Button, Color)] -> MessagesSource

Optimized led update. We assume that the inputs are sorted.

global variables

theSyncCounter :: MVar IntSource

24 tick per quarter note

theLaunchpadMode :: MVar ControlSource

We should only use user2 mode to be compatible with Ableton. We default to session mode (a hack, but who cares :)

helper functions

forceList :: [a] -> [a]Source

update loop

run applications

data GlobalConfig Source

Global configuration of an app

Constructors

GlobalConfig 

Fields

defaultLaunchpadDevice :: String

Should be probably "Launchpad"

defaultMidiOutputDevice :: String

default output device name (eg. "IAC Bus 1")

outputChannel :: Int

The midi channel we send the messages (towards the DAW or synth)

onlyUserMode2 :: Bool

If we want to be Ableton-compatible, we should only do anything in "User mode 2"

runPureApp :: GlobalConfig -> PureApp cfg mode state -> IO ()Source

Executes a pure application

appLaunchpadCallback :: (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> Connection -> MidiEvent -> IO ()Source

appSyncHandler :: (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> Connection -> MidiEvent -> IO ()Source

render the buttons

diffRender :: (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> IO ()Source

fullRender :: (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> IO ()Source

diffRender' :: Maybe Int -> (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> IO ()Source

fullRender' :: Maybe Int -> (GlobalConfig, PureApp cfg mode state, MVar mode, MVar state) -> IO ()Source