Some useful hints to make development of the project easier.
Field such as baseKey
, basePitch
, octave
, etc.
Last update of this instruction was in 29.04.2018.
When you add new app state field you'd probably need to handle it in different modules, such
MIDIPlayer
or GUI
. Here's a list of places you probably would handle your new field:
EventHandler
module:- Extend
AppState
data type with your new field; - You may need to add a constructor of
EventToHandle
to change a value of your new field; - Add default value of your new field to
Default AppState
instance; - Add transform for new value of your new field to
runEventHandler
; - If your field could shift current pitch:
- Check if it's changed in
updateStateMiddleware
to update pitch mapping; - Add shift logic to
getPitchMapping
.
- Check if it's changed in
- Extend
Main
module:- Add handler to
evListener
(usually it updates a value in GUI), don't forget to update key mapping by sendingSetPitchMapping
event to theGUI
(if your new field could affect key mapping); - If GUI supposed to have representation of your new field:
- Add initial value to
guiInitValues
; - Add GUI user interaction handler to
guiIface
that will trigger change toEventHandler
.
- Add initial value to
- Add handler to
GUI
module (if your new field has GUI representation):- Add field of handler to
GUIContext
data type which would handle of updating your value fromGUI
to somewhere else (when value changed fromGUI
this handler will be called) (you may not need this if a value can't be changed from theGUI
); - Call that handler from some
GUI
element change handler (you may not need this if a value can't be changed from theGUI
); - Add
GUI
representation of your field toGUIState
data type; - Use that
GUI
state field somewhere to show it to the user; - Extend
GUIStateUpdate
data type with setter of new value for your field to update a value inGUI
when it changes from somewhere else; - Go to place starts with
takeMVar stateUpdateBus
where theseGUI
state updates are handled and add proper handler for update of your new field value.
- Add field of handler to