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:
EventHandlermodule:- Extend
AppStatedata type with your new field; - You may need to add a constructor of
EventToHandleto change a value of your new field; - Add default value of your new field to
Default AppStateinstance; - Add transform for new value of your new field to
runEventHandler; - If your field could shift current pitch:
- Check if it's changed in
updateStateMiddlewareto update pitch mapping; - Add shift logic to
getPitchMapping.
- Check if it's changed in
- Extend
Mainmodule:- Add handler to
evListener(usually it updates a value in GUI), don't forget to update key mapping by sendingSetPitchMappingevent 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
guiIfacethat will trigger change toEventHandler.
- Add initial value to
- Add handler to
GUImodule (if your new field has GUI representation):- Add field of handler to
GUIContextdata type which would handle of updating your value fromGUIto somewhere else (when value changed fromGUIthis handler will be called) (you may not need this if a value can't be changed from theGUI); - Call that handler from some
GUIelement change handler (you may not need this if a value can't be changed from theGUI); - Add
GUIrepresentation of your field toGUIStatedata type; - Use that
GUIstate field somewhere to show it to the user; - Extend
GUIStateUpdatedata type with setter of new value for your field to update a value inGUIwhen it changes from somewhere else; - Go to place starts with
takeMVar stateUpdateBuswhere theseGUIstate updates are handled and add proper handler for update of your new field value.
- Add field of handler to