- session file format modifier : json or self-invoking function

- session history handling modified, session opening function moved to utils
This commit is contained in:
jean-emmanuel 2015-09-17 18:06:50 +02:00 • committed by bordun
parent 60967e0e89
commit 84e7303bb7
10 changed files with 143 additions and 131 deletions

View file

@ -2,10 +2,10 @@
### Session file structure
A valid session file is just a javascript file that defines the global variable `TABS` as an array of tab objects :
A valid session file is a javascript file that returns, when eval'd, an array of tab objects. It can be written as a standard json file (except for double quotes around names which are not required) :
```
TABS = [
[
{
id:"my_tab_id", // [string] optional, default unique tab id
label:"My tab", // [string] default to id
@ -15,55 +15,84 @@ TABS = [
// A tab cannot contain widgets and tabs simultaneously
},
{
etc...
// etc
}
]
```
It can also be a self invoking function that returns an array of objects :
```
(function(){
var tabs = []
for (for i in [0,1,2,3]) {
tabs.push({
id:'tab'+i,
widgets: [
{
id:'tab'+i+'fader',
type:'fader'
}
// etc
]
})
}
}()
```
### Widgets
```
{
id:"my_widget_id", // [string] widgets with same id will be synchronized
label:"My widget", // [string] default to id
target:false, // [string] List of target hosts (ip:port pairs), separated by spaces
path:false, // [string] osc path, default to '/widget_id'
widget_option:value // each widget type has specific options
}
```
#### Strip
```
horizontal:false, // [bool] set to true to display widgets horizontally
widgets: [] // [array] of widget objects
horizontal:false, // [bool] set to true to display widgets horizontally
widgets: [] // [array] of widget objects
```
#### Fader
```
horizontal:false, // [bool] set to true to display fader horizontally
range: {min:0,max:1}, // [object] defining the breakpoints of the fader
// keys can be percentages or 'min' / 'max'
unit: false, // [string] value suffix
horizontal:false, // [bool] set to true to display fader horizontally
range: {min:0,max:1}, // [object] defining the breakpoints of the fader
// keys can be percentages or 'min' / 'max'
unit: false, // [string] value suffix
```
#### Knob
```
range: {min:0,max:1}, // [object] minimum and maximum values
unit: false, // [string] value suffix
```
#### Toggle
```
on: 1,
off:0
```
#### Switch
```
values:[] // [array] of values (string or number)
range: {min:0,max:1}, // [object] minimum and maximum values
unit: false, // [string] value suffix
```
#### XY pad
```
range:{ // [object] minimum and maximum values for x and y axis
range:{ // [object] minimum and maximum values for x and y axis
x:{min:0,max:1},
y:{min:0,max:1}
}
```
#### RGB pad
```
no option
```
#### Toggle
```
on: 1, // [string|number] value sent when toggle is on
off:0 // [string|number] value sent when toggle is off
```
#### Switch
```
values:[] // [array] of values (string or number)
```