Skip to content
Permalink
Browse files

added SCENE.G op

  • Loading branch information
scanner-darkly committed Mar 28, 2019
1 parent 75eda8b commit e27f64012ebc8ae6e6b967b50be206a3bec35742
@@ -10,6 +10,7 @@
- **NEW**: new variables: J & K local script variables
- **FIX**: [metro rate not updated after `INIT.SCENE`](https://github.com/monome/teletype/issues/174)
- **NEW**: new ops: SEED, R.SEED, TOSS.SEED, DRUNK.SEED, P.SEED, PROB.SEED
- **NEW**: new op: SCENE.G

## v3.0

@@ -180,6 +180,15 @@ Will _not_ execute from the `I` script on scene load. Will execute on subsequen
**WARNING**: You will lose any unsaved changes to your scene.
"""

[SCENE.G]
prototype_set = "SCENE.G x"
short = "load scene `x` (0-31) without loading grid control states"
description = """
Load scene `x` (0-31) without loading grid button and fader states.
**WARNING**: You will lose any unsaved changes to your scene.
"""

[KILL]
prototype = "KILL"
short = "clears stack, clears delays, cancels pulses, cancels slews, disables metronome"
@@ -2,9 +2,23 @@

## Version 3.x

### New operators

DEVICE.FLIP
DEL.X
DEL.R
J & K local script variables
SEED, R.SEED, TOSS.SEED, DRUNK.SEED, P.SEED, PROB.SEED
SCENE.G

### Changes

DELAY_SIZE increased to 16 from 8

### Bug fixes

[some keyboards losing keystrokes](https://github.com/monome/teletype/issues/156)
[metro rate not updated after `INIT.SCENE`](https://github.com/monome/teletype/issues/174)

## Version 3.0

@@ -106,14 +106,16 @@ void flash_write(uint8_t preset_no, scene_state_t *scene,
}

void flash_read(uint8_t preset_no, scene_state_t *scene,
char (*text)[SCENE_TEXT_LINES][SCENE_TEXT_CHARS]) {
char (*text)[SCENE_TEXT_LINES][SCENE_TEXT_CHARS], uint8_t init_grid) {
memcpy(ss_scripts_ptr(scene), &f.scenes[preset_no].scripts,
// Exclude size of TEMP script as above
ss_scripts_size() - sizeof(scene_script_t));
memcpy(ss_patterns_ptr(scene), &f.scenes[preset_no].patterns,
ss_patterns_size());
memcpy(&grid_data, &f.scenes[preset_no].grid_data, sizeof(grid_data_t));
unpack_grid(scene);
if (init_grid) {
memcpy(&grid_data, &f.scenes[preset_no].grid_data, sizeof(grid_data_t));
unpack_grid(scene);
}
memcpy(text, &f.scenes[preset_no].text,
SCENE_TEXT_LINES * SCENE_TEXT_CHARS);
// need to reset timestamps
@@ -12,7 +12,7 @@
u8 is_flash_fresh(void);
void flash_prepare(void);
void flash_read(uint8_t preset_no, scene_state_t *scene,
char (*text)[SCENE_TEXT_LINES][SCENE_TEXT_CHARS]);
char (*text)[SCENE_TEXT_LINES][SCENE_TEXT_CHARS], uint8_t init_grid);
void flash_write(uint8_t preset_no, scene_state_t *scene,
char (*text)[SCENE_TEXT_LINES][SCENE_TEXT_CHARS]);
uint8_t flash_last_saved_scene(void);
@@ -94,7 +94,7 @@ const char* help2[HELP2_LENGTH] = { "2/13 VARIABLES",
"Q.AVG|AVERAGE OF ALL Q",
"J, K|UNIQUE PER SCRIPT" };

#define HELP3_LENGTH 26
#define HELP3_LENGTH 27
const char* help3[HELP3_LENGTH] = { "3/13 PARAMETERS",
" ",
"TR A-D|SET TR VALUE (0,1)",
@@ -120,6 +120,7 @@ const char* help3[HELP3_LENGTH] = { "3/13 PARAMETERS",
" ",
"SCRIPT A|GET/RUN SCRIPT",
"SCENE|GET/SET SCENE #",
"SCENE.G|SET SCENE (EXCL GRID)",
"LAST N|GET SCRIPT LAST RUN" };

#define HELP4_LENGTH 11
@@ -908,9 +908,10 @@ void tele_ii_rx(uint8_t addr, uint8_t* data, uint8_t l) {
i2c_master_rx(addr, data, l);
}

void tele_scene(uint8_t i) {
void tele_scene(uint8_t i, uint8_t init_grid) {
preset_select = i;
flash_read(i, &scene_state, &scene_text);
flash_read(i, &scene_state, &scene_text, init_grid);
if (init_grid) scene_state.grid.scr_dirty = scene_state.grid.grid_dirty = 1;
}

void tele_kill() {
@@ -1010,7 +1011,7 @@ int main(void) {
// load preset from flash
preset_select = flash_last_saved_scene();
ss_set_scene(&scene_state, preset_select);
flash_read(preset_select, &scene_state, &scene_text);
flash_read(preset_select, &scene_state, &scene_text, 1);

// setup daisy chain for two dacs
spi_selectChip(DAC_SPI, DAC_SPI_NPCS);
@@ -107,7 +107,7 @@ uint8_t screen_refresh_preset_r() {

void do_preset_read() {
ss_grid_init(&scene_state);
flash_read(preset_select, &scene_state, &scene_text);
flash_read(preset_select, &scene_state, &scene_text, 1);
flash_update_last_saved_scene(preset_select);
ss_set_scene(&scene_state, preset_select);

@@ -82,7 +82,7 @@ void tele_usb_disk() {
font_string_region_clip_tab(&line[0], input_buffer, 2, 0, 0xa, 0);
region_draw(&line[0]);

flash_read(i, &scene, &text);
flash_read(i, &scene, &text, 1);

if (!nav_file_create((FS_STRING)filename)) {
if (fs_g_status != FS_ERR_FILE_EXIST) {
@@ -77,7 +77,7 @@ void tele_ii_rx(uint8_t addr, uint8_t *data, uint8_t l) {
printf("\n");
}

void tele_scene(uint8_t i) {
void tele_scene(uint8_t i, uint8_t init_grid) {
printf("SCENE i:%" PRIu8, i);
printf("\n");
}
@@ -240,6 +240,7 @@
"$" => { MATCH_OP(E_OP_SYM_DOLLAR); };
"KILL" => { MATCH_OP(E_OP_KILL); };
"SCENE" => { MATCH_OP(E_OP_SCENE); };
"SCENE.G" => { MATCH_OP(E_OP_SCENE_G); };
"BREAK" => { MATCH_OP(E_OP_BREAK); };
"BRK" => { MATCH_OP(E_OP_BRK); };
"SYNC" => { MATCH_OP(E_OP_SYNC); };
@@ -35,6 +35,8 @@ static void op_SCENE_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_SCENE_set(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_SCENE_G_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_SCRIPT_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_SCRIPT_set(const void *data, scene_state_t *ss, exec_state_t *es,
@@ -61,6 +63,7 @@ const tele_mod_t mod_OTHER = MAKE_MOD(OTHER, mod_OTHER_func, 0);
const tele_op_t op_SCRIPT = MAKE_GET_SET_OP(SCRIPT, op_SCRIPT_get, op_SCRIPT_set, 0, true);
const tele_op_t op_SYM_DOLLAR = MAKE_ALIAS_OP($, op_SCRIPT_get, op_SCRIPT_set, 0, true);
const tele_op_t op_KILL = MAKE_GET_OP(KILL, op_KILL_get, 0, false);
const tele_op_t op_SCENE_G = MAKE_GET_OP(SCENE.G, op_SCENE_G_get, 1, false);
const tele_op_t op_SCENE = MAKE_GET_SET_OP(SCENE, op_SCENE_get, op_SCENE_set, 0, true);
const tele_op_t op_BREAK = MAKE_GET_OP(BREAK, op_BREAK_get, 0, false);
const tele_op_t op_BRK = MAKE_ALIAS_OP(BRK, op_BREAK_get, NULL, 0, false);
@@ -210,7 +213,16 @@ static void op_SCENE_set(const void *NOTUSED(data), scene_state_t *ss,
int16_t scene = cs_pop(cs);
if (!ss->initializing) {
ss->variables.scene = scene;
tele_scene(scene);
tele_scene(scene, 1);
}
}

static void op_SCENE_G_get(const void *NOTUSED(data), scene_state_t *ss,
exec_state_t *NOTUSED(es), command_state_t *cs) {
int16_t scene = cs_pop(cs);
if (!ss->initializing) {
ss->variables.scene = scene;
tele_scene(scene, 0);
}
}

@@ -16,6 +16,7 @@ extern const tele_mod_t mod_OTHER;
extern const tele_op_t op_SCRIPT;
extern const tele_op_t op_KILL;
extern const tele_op_t op_SCENE;
extern const tele_op_t op_SCENE_G;
extern const tele_op_t op_BREAK;
extern const tele_op_t op_BRK;
extern const tele_op_t op_SYNC;
@@ -94,8 +94,8 @@ const tele_op_t *tele_ops[E_OP__LENGTH] = {
&op_S_ALL, &op_S_POP, &op_S_CLR, &op_S_L,

// controlflow
&op_SCRIPT, &op_SYM_DOLLAR, &op_KILL, &op_SCENE, &op_BREAK, &op_BRK,
&op_SYNC,
&op_SCRIPT, &op_SYM_DOLLAR, &op_KILL, &op_SCENE, &op_SCENE_G, &op_BREAK,
&op_BRK, &op_SYNC,

// delay
&op_DEL_CLR,
@@ -209,6 +209,7 @@ typedef enum {
E_OP_SYM_DOLLAR,
E_OP_KILL,
E_OP_SCENE,
E_OP_SCENE_G,
E_OP_BREAK,
E_OP_BRK,
E_OP_SYNC,
@@ -31,7 +31,7 @@ extern void tele_has_stack(bool has_stack);
extern void tele_cv_off(uint8_t i, int16_t v);
extern void tele_ii_tx(uint8_t addr, uint8_t *data, uint8_t l);
extern void tele_ii_rx(uint8_t addr, uint8_t *data, uint8_t l);
extern void tele_scene(uint8_t i);
extern void tele_scene(uint8_t i, uint8_t init_grid);

// called when a pattern is updated
extern void tele_pattern_updated(void);
@@ -25,7 +25,7 @@ void tele_has_stack(bool i) {}
void tele_cv_off(uint8_t i, int16_t v) {}
void tele_ii_tx(uint8_t addr, uint8_t *data, uint8_t l) {}
void tele_ii_rx(uint8_t addr, uint8_t *data, uint8_t l) {}
void tele_scene(uint8_t i) {}
void tele_scene(uint8_t i, uint8_t init_grid) {}
void tele_pattern_updated() {}
void tele_kill() {}
void tele_mute() {}

0 comments on commit e27f640

Please sign in to comment.