Pages

Pages

What are pages?

In Monolith, pages are special interactive interfaces. They are specifically designed so that multiple monome-y apps can exist at once.

Only one page can be actively selected at a time. When a page is selected, they are able access to the hardware peripherals like the monome arc and grid.

Pages are referred to as unique names.

Creating a page

Every page has their own custom page creator. Usually it takes the form monolith:FOO-new, and it takes in the name as an argument. For instance, to create a new grid page:

(monolith:grid-new "g")

Selecting a page

Any page can be selected with monolith:page-select.

For instance, to select a page called "g":

(monolith:page-select "g")

Loading/Saving Pages

Pages are loaded/saved with the use of what are known as state files. State files need to be loaded with monolith:state-open before any load/save operations happen. After, the state can be closed with monolith/state-close.

Pages are referenced with a unique name known as a "key". These need to be unique. It is not possible, for instance, to have two grid pages with the key "grid". It is, however, possible (but not advised) to have two pages of different types with the same name.

Saving a single page

Pages can be saved to a state file with monolith:page-save. It takes in two arguments: the name of the page, and then the key of the page to save it as. The key should be unique.

This example below attempts to save the current state of page "g" into a state file with the key "gridstate".

(monolith:state-open "state.db")
(monolith:page-save "g" "gridstate")
(monolith:state-close)

Loading a single page

Page data can be loaded using monolith:page-load. These take in the same ordered arguments as monolith:page-save: the page name (as it is seen in monolith), and the key as stored in the state file. Both the key and the page name need to exist for this to work.

This example below attempts to load the data stored in "gridstate" into the page named "g".

(monolith:state-open "state.db")
(monolith:page-load "g" "gridstate")
(monolith:state-close)

Loading/Saving Many Pages

Use monolith:save-pages to save many pages at once. This will preprend each page with a prefix in an attempt to prevent name collisions.

(monolith:state-open "state.db")
(monolith:save-pages "test-patch" (list "grid" "seq"))
(monolith:state-close)

A similar process for loading is done with monolith:load-pages. This makes the assumption that the same prefix is used, and that the pages have been created beforehand.

(monolith:state-open "state.db")
(monolith:load-pages "test-patch" (list "grid" "seq"))
(monolith:state-close)

Source code

The underlying source code for pages can be found in the main monolith code in the section 11. Pages.