Safe Haskell | None |
---|
A framework to create functional Launchpad "apps".
See the modules below System.MIDI.Launchpad.Apps
for examples.
Notes:
- Both Ableton and the Launchpad embedded software seems to be somewhat buggy... If you experience issues, try resetting the Launchpad, try to launch Ableton and your app in the opposite order, etc...
- ALWAYS compile with the threaded runtime (ghc option -threaded)
- When the programs start, the Launchpad is reseted, and Session mode is assumed. Press User mode 2 to start playing with the app. Sometimes you have to press Session mode / User mode 2 a few times so that Ableton and the launchpad app thinks the same thing about the state...
- How to setup Ableton: Use a loopback device (eg. IAC Bus 1 on OSX) to communicate between the app and Ableton. In Ableton midi setup, enable the track and remote MIDI input for the loopback device, and enable the sync MIDI output for the loopback device; disable everything else. Also disable all Launchpad MIDI inputs and outputs (it can remain a control surface).
- red :: Color
- green :: Color
- amber :: Color
- yellow :: Color
- orange :: Color
- data PureApp cfg mode state = PureApp {
- pAppConfig :: cfg
- pAppIniState :: (mode, state)
- pAppStartStop :: cfg -> Bool -> state -> state
- pAppRender :: cfg -> mode -> state -> Maybe Int -> [(Button, Color)]
- pAppButton :: cfg -> ButtonPress -> (mode, state) -> ((mode, state), [MidiMessage'])
- pAppSync :: cfg -> mode -> state -> Int -> (state, [MidiMessage'])
- runPureApp :: GlobalConfig -> PureApp cfg mode state -> IO ()
- data MonadicApp cfg mode state = MonadicApp {
- mAppConfig :: cfg
- mAppIniState :: (mode, state)
- mAppStartStop :: cfg -> Bool -> state -> state
- mAppRender :: cfg -> mode -> state -> Maybe Int -> RenderMonad ()
- mAppButton :: cfg -> ButtonPress -> ButtonMonad mode state ()
- mAppSync :: cfg -> mode -> Int -> SyncMonad state ()
- runMonadicApp :: GlobalConfig -> MonadicApp cfg mode state -> IO ()
- data RenderMonad a
- data ButtonMonad mode state a
- data SyncMonad state a
- setButtonColor :: (Button, Color) -> RenderMonad ()
- setButtonColor' :: Button -> Color -> RenderMonad ()
- setButtonColors :: [(Button, Color)] -> RenderMonad ()
- getMode :: ButtonMonad mode state mode
- setMode :: mode -> ButtonMonad mode state ()
- class CanChangeState m where
- modifyState :: (CanChangeState m, Monad (m state)) => (state -> state) -> m state ()
- class Monad m => CanSendMessage m where
- sendMessages :: [MidiMessage'] -> m ()
- sendMessage :: MidiMessage' -> m ()
- data GlobalConfig = GlobalConfig {}
- defaultGlobalConfig :: GlobalConfig
simple colors
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.
PureApp | |
|
runPureApp :: GlobalConfig -> PureApp cfg mode state -> IO ()Source
Executes a pure application
monadic interface
data MonadicApp cfg mode state Source
Monadic application (equivalent to the above pure application, but may be more convenient to use)
MonadicApp | |
|
runMonadicApp :: GlobalConfig -> MonadicApp cfg mode state -> IO ()Source
Executes a monadic application
data RenderMonad a Source
data ButtonMonad mode state a Source
CanChangeState (ButtonMonad mode) | |
Monad (ButtonMonad mode state) | |
CanSendMessage (ButtonMonad mode state) |
CanChangeState SyncMonad | |
Monad (SyncMonad state) | |
CanSendMessage (SyncMonad state) |
setButtonColor :: (Button, Color) -> RenderMonad ()Source
setButtonColor' :: Button -> Color -> RenderMonad ()Source
setButtonColors :: [(Button, Color)] -> RenderMonad ()Source
getMode :: ButtonMonad mode state modeSource
setMode :: mode -> ButtonMonad mode state ()Source
class CanChangeState m whereSource
modifyState :: (CanChangeState m, Monad (m state)) => (state -> state) -> m state ()Source
class Monad m => CanSendMessage m whereSource
sendMessages :: [MidiMessage'] -> m ()Source
sendMessage :: MidiMessage' -> m ()Source
CanSendMessage (SyncMonad state) | |
CanSendMessage (ButtonMonad mode state) |
global configuration
data GlobalConfig Source
Global configuration of an app
GlobalConfig | |
|
defaultGlobalConfig :: GlobalConfigSource
A default global state