Sprites.Media.Sequencer.Tune
The tune: the arrangement of block slots. This module holds the slot operations that edit the tune - move, insert, clone, delete, and choose a slot's block - all composites returning new tune data, and the tune area of the editor: the horizontal strip of slot cards and the controls under it. Tune.Component builds the whole area.
- Sprites.Media.Sequencer.Tune.Component
- Sprites.Media.Sequencer.Tune.Strip
- Sprites.Media.Sequencer.Tune.Card
- Sprites.Media.Sequencer.Tune.Controls
- Sprites.Media.Sequencer.Tune.SelectWindow
- Sprites.Media.Sequencer.Tune.MoveSlot
- Sprites.Media.Sequencer.Tune.InsertSlot
- Sprites.Media.Sequencer.Tune.CloneSlot
- Sprites.Media.Sequencer.Tune.DeleteSlot
- Sprites.Media.Sequencer.Tune.SetSlotBlock
Sprites.Media.Sequencer.Tune.Component Void
Sprites.Media.Sequencer.Tune.Component(data, selectedSlot, model)
The tune area: the strip of slot cards over the controls bar. One call builds the whole top of the editor stage, above the block grid.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
selectedSlot | Sprites.Reactive.Value | The selected slot index. |
model | Object | The platform descriptor. |
Returns nothing.
const data = Sprites.Reactive.Binding{ tune: [0, 1, undefined, 2], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const selectedSlot = Sprites.Reactive.Value(1);
const model = {};
Sprites.Media.Sequencer.Tune.Component(data, selectedSlot, model);
Sprites.Media.Sequencer.Tune.Strip Void
Sprites.Media.Sequencer.Tune.Strip(tune, selectedSlot)
The tune strip: a horizontal scroll area holding a row of slot cards, one per tune slot.
| Input | Type | Description |
|---|---|---|
tune | Sprites.Reactive.Value | The list of block-index slots. |
selectedSlot | Sprites.Reactive.Value | The selected slot index. |
Returns nothing.
const tune = Sprites.Reactive.Value([0, 1, undefined, 2]);
const selectedSlot = Sprites.Reactive.Value(1);
Sprites.Media.Sequencer.Tune.Strip(tune, selectedSlot);
Sprites.Media.Sequencer.Tune.Card Void
Sprites.Media.Sequencer.Tune.Card(slotBlock, index, selectedSlot)
One slot card: its slot index and the block index it holds (or a dash when empty), highlighted when it is the selection, selecting itself on a click.
| Input | Type | Description |
|---|---|---|
slotBlock | Number, Sprites.Reactive.Value or undefined | The block index the slot holds. |
index | Number | The slot index. |
selectedSlot | Sprites.Reactive.Value | The selected slot. |
Returns nothing.
const selectedSlot = Sprites.Reactive.Value(0);
Sprites.Media.Sequencer.Tune.Card(0, 0, selectedSlot);
Sprites.Media.Sequencer.Tune.Controls Void
Sprites.Media.Sequencer.Tune.Controls(data, selectedSlot, model)
The tune controls: a button bar to move the selected slot left or right, insert an empty slot after it, clone it, delete it, and choose which block it holds through the Select block modal. Move and delete disable at the ends.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
selectedSlot | Sprites.Reactive.Value | The selected slot index. |
model | Object | The platform descriptor. |
Returns nothing.
const data = Sprites.Reactive.Binding{ tune: [0, 1, undefined, 2], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const selectedSlot = Sprites.Reactive.Value(1);
const model = {};
Sprites.Media.Sequencer.Tune.Controls(data, selectedSlot, model);
Sprites.Media.Sequencer.Tune.SelectWindow Void
Sprites.Media.Sequencer.Tune.SelectWindow(visible, data, selectedSlot, blocks)
The block-choice modal: a dropdown of the block indices with a blank option to empty the slot, over a lens onto the selected slot's block index.
| Input | Type | Description |
|---|---|---|
visible | Sprites.Reactive.Value | A boolean shown flag. |
data | Sprites.Reactive.Value | The tune data. |
selectedSlot | Sprites.Reactive.Value | The selected slot index. |
blocks | Sprites.Reactive.Value | The blocks list. |
Returns nothing.
const data = Sprites.Reactive.Binding{ tune: [0, 1, undefined, 2], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const selectedSlot = Sprites.Reactive.Value(1);
const blocks = Sprites.Object.Field(data, 'blocks');
const open = Sprites.Reactive.Value(false);
Sprites.Ui.Button.SetValue(open, true, 'Select block');
Sprites.Media.Sequencer.Tune.SelectWindow(open, data, selectedSlot, blocks);
Sprites.Media.Sequencer.Tune.MoveSlot Object
Sprites.Media.Sequencer.Tune.MoveSlot(data, from, dir)
New tune data with the slot at from and its neighbour one step over swapped, moving the block earlier or later. A composite over Sprites.Array and Sprites.Object.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
from | Number or Sprites.Reactive.Value | The slot. |
dir | String | 'left' or 'right'. |
Returns new tune data.
const data = Sprites.Reactive.Binding{ tune: [0, 1, 2, 3], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const moved = Sprites.Media.Sequencer.Tune.MoveSlot(data, 2, 'left');
const before = Sprites.Object.Field(data, 'tune');
const after = Sprites.Object.Field(moved, 'tune');
const beforeText = Sprites.Text.Join(before, ', ');
const afterText = Sprites.Text.Join(after, ', ');
Sprites.Ui.Dom.Text('before = ', beforeText, ' -> after = ', afterText);
Sprites.Media.Sequencer.Tune.InsertSlot Object
Sprites.Media.Sequencer.Tune.InsertSlot(data, at)
New tune data with an empty slot inserted after the given slot.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
at | Number or Sprites.Reactive.Value | The slot to insert after. |
Returns new tune data.
const data = Sprites.Reactive.Binding{ tune: [0, 1, 2, 3], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const inserted = Sprites.Media.Sequencer.Tune.InsertSlot(data, 1);
const before = Sprites.Object.Field(data, 'tune');
const after = Sprites.Object.Field(inserted, 'tune');
const beforeText = Sprites.Text.Join(before, ', ');
const afterText = Sprites.Text.Join(after, ', ');
Sprites.Ui.Dom.Text('before = ', beforeText, ' -> after = ', afterText);
Sprites.Media.Sequencer.Tune.CloneSlot Object
Sprites.Media.Sequencer.Tune.CloneSlot(data, at)
New tune data with the given slot duplicated, its block index copied into a new slot after it.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
at | Number or Sprites.Reactive.Value | The slot to clone. |
Returns new tune data.
const data = Sprites.Reactive.Binding{ tune: [0, 1, 2, 3], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const cloned = Sprites.Media.Sequencer.Tune.CloneSlot(data, 0);
const before = Sprites.Object.Field(data, 'tune');
const after = Sprites.Object.Field(cloned, 'tune');
const beforeText = Sprites.Text.Join(before, ', ');
const afterText = Sprites.Text.Join(after, ', ');
Sprites.Ui.Dom.Text('before = ', beforeText, ' -> after = ', afterText);
Sprites.Media.Sequencer.Tune.DeleteSlot Object
Sprites.Media.Sequencer.Tune.DeleteSlot(data, at)
New tune data with the given slot removed.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
at | Number or Sprites.Reactive.Value | The slot to remove. |
Returns new tune data.
const data = Sprites.Reactive.Binding{ tune: [0, 1, 2, 3], blocks: [ { id: 1 }, { id: 2 }, { id: 3 } ] });
const trimmed = Sprites.Media.Sequencer.Tune.DeleteSlot(data, 3);
const before = Sprites.Object.Field(data, 'tune');
const after = Sprites.Object.Field(trimmed, 'tune');
const beforeText = Sprites.Text.Join(before, ', ');
const afterText = Sprites.Text.Join(after, ', ');
Sprites.Ui.Dom.Text('before = ', beforeText, ' -> after = ', afterText);
Sprites.Media.Sequencer.Tune.SetSlotBlock Object
Sprites.Media.Sequencer.Tune.SetSlotBlock(data, slot, blockIndex)
New tune data with the given slot pointing at a block index, or undefined to empty it.
| Input | Type | Description |
|---|---|---|
data | Sprites.Reactive.Value | The tune data. |
slot | Number or Sprites.Reactive.Value | The slot to set. |
blockIndex | Number or undefined | The block index, or undefined to empty the slot. |
Returns new tune data.
const data = Sprites.Reactive.Binding{ tune: [0, 1, 2, 3], blocks: [ { id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 } ] });
const pointed = Sprites.Media.Sequencer.Tune.SetSlotBlock(data, 0, 4);
const before = Sprites.Object.Field(data, 'tune');
const after = Sprites.Object.Field(pointed, 'tune');
const beforeText = Sprites.Text.Join(before, ', ');
const afterText = Sprites.Text.Join(after, ', ');
Sprites.Ui.Dom.Text('before = ', beforeText, ' -> after = ', afterText);