forked from njanssen/Orca
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add documentation and sborca collection
- Loading branch information
1 parent
3cc6a1f
commit 6672d47
Showing
5 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Orca language is a "library" of operators (everything that is not a command) that together define its behavior. Orca has the ability to dynamically load and combine multiple operator libraries at runtime, effectively allowing you to reconfigure the language. For example, you may want this for playing older compositions that are no longer compatible with the current Orca, or to experiment with alternative operators without affecting mainline Orca. Language reconfiguration lets you tailor the language to your individual composition. | ||
|
||
Orca starts with a `default` library, additional libraries can be loaded and combined via the `lang` command. Library loading is incremental, that is, operators defined in the new library are added to runtime, replacing existing operators. A given library may define all operators or only some. To completely clear the runtime library and start with the blank slate use the `clr` library. | ||
|
||
## Available libraries | ||
|
||
"Complete" means you get a fully functioning Orca by loading just that library, "incremental" means it only defines a subset of operators and you need something loaded before that to get a full Orca (usually `default`). | ||
|
||
* `clr`: a special library that unloads all definitions | ||
* `default`: mainline Orca language, loaded at startup (complete) | ||
* `orca157`: Orca before the BFL breaking change (complete) (TODO) | ||
* `base`: not a very useful library by itself, defines the basics such as comments and numbers | ||
* `sb*`: Sborca collection of alternative operators (see `sborca.md`) | ||
|
||
## Usage examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
`use strict` | ||
|
||
/* global Operator */ | ||
/* global library */ | ||
|
||
library.sbz = { | ||
'z': function OperatorZ (orca, x, y, passive) { | ||
Operator.call(this, orca, x, y, 'z', passive) | ||
|
||
this.name = 'lerp' | ||
this.info = 'Transitions operand to target by duration' | ||
|
||
this.ports.stepped = { x: -2, y: 0, default: '0' } | ||
this.ports.duration = { x: -1, y: 0, default: '8' } | ||
this.ports.target = { x: 1, y: 0 } | ||
this.ports.output = { x: 0, y: 1, sensitive: true, reader: true, output: true } | ||
|
||
this.operation = function (force = false) { | ||
const duration = this.listen(this.ports.duration, true) | ||
const target = this.listen(this.ports.target, true) | ||
const val = this.listen(this.ports.output, true) | ||
var stepped = this.listen(this.ports.stepped, true) | ||
if (stepped >= duration) { | ||
stepped = duration | ||
this.output(stepped, this.ports.stepped) | ||
} | ||
if (val !== target) { | ||
if (stepped === duration) { stepped = 0 } // previous iteration done, ok to restart | ||
const steps = duration - stepped | ||
const remaining = target - val | ||
const mod = Math.round(remaining / steps) | ||
this.output(orca.keyOf(val + mod), this.ports.output) | ||
this.output(orca.keyOf(stepped + 1), this.ports.stepped) | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Sborca collection of alternative operators | ||
|
||
## `sbz` (incremental) | ||
|
||
Defines: | ||
|
||
* `Z` **lerp**(*step* *duration* target): duration-based variant of `Z` | ||
|
||
TODO |