Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEES enhancements & features #283

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
1bb3cea
wrapper to compile BEES as pd external
boqs Apr 7, 2017
ccc4802
improved monome grid focus functionality
boqs Apr 14, 2017
7397ac0
fix bug in avr32lib software timers
boqs Apr 19, 2017
1e3eb24
fix up warnings in filter_svf
boqs Apr 20, 2017
cf9b807
pickling state for op_step
boqs Apr 19, 2017
51f5d29
correct alphabetic order for op_param
boqs Nov 7, 2016
96b1851
add op_iter
boqs Nov 7, 2016
d24634d
add op_mem2d
boqs Nov 7, 2016
9e4c6fe
add op_mem1d
boqs Nov 7, 2016
a5f7d38
add op_mem0D
boqs Feb 27, 2016
76b78a5
rename grid_raw to grid_classic
boqs Nov 7, 2016
284d163
rename op_life to op_life_classic
boqs Nov 7, 2016
daf6817
various fixes/enhancements to life_classic
boqs Apr 20, 2017
93cf036
new (x-y addressed) versions of grid & life
boqs Nov 7, 2016
88610c9
update pd makefile for new grid ops
boqs Apr 15, 2017
dae7f8f
pd example patches
boqs Apr 20, 2017
1b1df06
trigger play screen on bees outputs
boqs Apr 20, 2017
fdabba8
pickling meadowphysics state
boqs Apr 19, 2017
09e9f2b
pickling op_ww state
boqs Apr 19, 2017
27e6383
basic 'make tags' for bees
boqs Apr 14, 2017
c5c29b1
clean up duplicate variable definitions
boqs Apr 21, 2017
1dda0b7
fixup compiler warnings for bees_op & beekeep
boqs Apr 21, 2017
23cfb73
update grid ops pd example
boqs Apr 21, 2017
6297581
fix whitewhale op triggering
boqs Apr 21, 2017
9f553c5
make BEES split out insert Y after the op
boqs Apr 21, 2017
12badab
add label param scaler (aka patchmatrix)
boqs Apr 22, 2017
707e43c
fixup grains' patchmatrix params
boqs Apr 22, 2017
ba513ac
fix up bug with last label string loaded from .lab
boqs Apr 22, 2017
130676e
improve alt-enc behaviour on outs & in pages
boqs Apr 23, 2017
c23c125
inc to created op on op creation
boqs Apr 23, 2017
4ef7e4a
decrement oplist on op deletion
boqs Apr 23, 2017
b379bb3
fixup patchmatrix descriptor thingy
boqs Apr 23, 2017
996d1cb
add maginc op (will explode on dsp params)
boqs Apr 23, 2017
daf5ab4
improve op creation display in page_ops
boqs Apr 23, 2017
0df761f
make op_enc delta output scale with step input
boqs Apr 23, 2017
e52810c
make www param input track stored cv curves
boqs Apr 23, 2017
634680e
tidy up 'patchmatrix' scaler, rename -> 'label'
boqs Apr 23, 2017
e7f47b1
bigOps -> 8 to prevent bfin buffer alloc explosion
boqs Apr 25, 2017
a34ce58
typo in monome_grid_raw
boqs Apr 25, 2017
868232b
(mostly) working op_kria!
boqs Apr 27, 2017
b57651b
fix beekeep
boqs Apr 28, 2017
cf8c091
big cleanup in op_kria
boqs Apr 28, 2017
e6c0048
update pd for op_kria
boqs Apr 28, 2017
07ea0e9
keep bees-ifying op_kria
boqs Apr 28, 2017
7400b53
add octave & tuning inputs to op_kria
boqs Apr 28, 2017
2d77663
start resurrecting pitchtoy
boqs Apr 20, 2017
8814016
new fix16_mul using fract primitives
boqs Apr 20, 2017
6c4251e
fixup array dimensions in op_kria
boqs Apr 28, 2017
fab8a82
fix crackling on waves
boqs Apr 28, 2017
c4ea893
fix bug in op_mul
boqs Apr 28, 2017
5b5cff9
add osc16 & osc_triangle16, fix bfin_sim
boqs Apr 29, 2017
58253f2
improve polyblep functions (breaks voder, monosynth, fmsynth)
boqs Apr 29, 2017
4c73ca0
make waves work with polyblep *or* lookup table
boqs Apr 29, 2017
c191bda
add tonality diamond operator (aka harry)
boqs Apr 29, 2017
189d733
update op_grid example scene
boqs Apr 30, 2017
5a09efc
add picolisp app (encoders + screen only)
boqs Apr 14, 2016
16ef096
print op_sizes on beekeep boot, don't explode
boqs May 2, 2017
9d7b06c
move kria_set inside op_kria struct
boqs May 2, 2017
ec56368
wasteful inline declarations in kria
boqs May 2, 2017
30a2bfd
remove unused variables in kria
boqs May 2, 2017
a841455
add op_poly to BEES (note priority selection)
boqs May 4, 2017
b33204a
squash multiple definition of SCALES
boqs May 4, 2017
8f9878c
make bees_op external threadsafe
boqs May 4, 2017
ec43a9d
update LEDS every 20ms in PD BEES
boqs May 4, 2017
cd1e32a
decruft pd, timing correct bees execution time
boqs May 5, 2017
139a56f
grid raw pickle LEDs
boqs May 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/bees/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ deploy:
make -k R=1
cp $(project).hex ../../release/
cp $(project)-$(maj).$(min).$(rev).hex ../../release/
cp $(project)-$(maj).$(min).$(rev)-dbg.hex ../../release/
cp $(project)-$(maj).$(min).$(rev)-dbg.hex ../../release/

tags:
find . ../../avr32_lib/ ../../common -name '*.[ch]' | etags -
13 changes: 12 additions & 1 deletion apps/bees/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ CSRCS += \
$(APP_DIR)/src/ops/op_enc.c \
$(APP_DIR)/src/ops/op_fade.c \
$(APP_DIR)/src/ops/op_gate.c \
$(APP_DIR)/src/ops/op_harry.c \
$(APP_DIR)/src/ops/op_hid_word.c \
$(APP_DIR)/src/ops/op_history.c \
$(APP_DIR)/src/ops/op_is.c \
$(APP_DIR)/src/ops/op_life.c \
$(APP_DIR)/src/ops/op_iter.c \
$(APP_DIR)/src/ops/op_kria.c \
$(APP_DIR)/src/ops/op_life_classic.c \
$(APP_DIR)/src/ops/op_life_raw.c \
$(APP_DIR)/src/ops/op_list2.c \
$(APP_DIR)/src/ops/op_list8.c \
$(APP_DIR)/src/ops/op_list16.c \
$(APP_DIR)/src/ops/op_logic.c \
$(APP_DIR)/src/ops/op_maginc.c \
$(APP_DIR)/src/ops/op_mem0d.c \
$(APP_DIR)/src/ops/op_mem1d.c \
$(APP_DIR)/src/ops/op_mem2d.c \
$(APP_DIR)/src/ops/op_metro.c \
$(APP_DIR)/src/ops/op_midi_cc.c \
$(APP_DIR)/src/ops/op_midi_out_note.c \
Expand All @@ -73,7 +81,9 @@ CSRCS += \
$(APP_DIR)/src/ops/op_mod.c \
$(APP_DIR)/src/ops/op_mul.c \
$(APP_DIR)/src/ops/op_monome_arc.c \
$(APP_DIR)/src/ops/op_monome_grid_classic.c \
$(APP_DIR)/src/ops/op_monome_grid_raw.c \
$(APP_DIR)/src/ops/op_poly.c \
$(APP_DIR)/src/ops/op_preset.c \
$(APP_DIR)/src/ops/op_random.c \
$(APP_DIR)/src/ops/op_route.c \
Expand Down Expand Up @@ -108,6 +118,7 @@ CSRCS += \
$(APP_DIR)/src/scalers/scaler_integrator.c \
$(APP_DIR)/src/scalers/scaler_integrator_short.c \
$(APP_DIR)/src/scalers/scaler_note.c \
$(APP_DIR)/src/scalers/scaler_label.c \
$(APP_DIR)/src/scalers/scaler_short.c \
$(APP_DIR)/src/scalers/scaler_svf_fc.c

Expand Down
7 changes: 7 additions & 0 deletions apps/bees/src/app_timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,18 @@ static softTimer_t hidPollTimer = { .next = NULL, .prev = NULL };
// event data is a pointer to an arbitrary object/
// here we use it for polled operators like op_metro.
static void app_custom_event_callback(void* obj) {
// XXX look out - PD/beekeep has no event loop, so directly call
// from the timer thread into the poll handler (not very threadsafe)
#ifdef BEEKEEP
op_poll_t* op_poll = (op_poll_t*)obj;
(*(op_poll->handler))(op_poll->op);
#else
event_t e = { .type=kEventAppCustom, .data=(s32)obj };
e.type = kEventAppCustom;
// post the object's address in the event data field
e.data = (s32)obj;
event_post(&e);
#endif
}

// screen refresh callback
Expand Down
40 changes: 39 additions & 1 deletion apps/bees/src/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ u8 files_load_dsp_name(const char* name) {
// write module name in global scene data
scene_set_module_name(name);

render_boot("loading labels descriptor...");
files_load_labels(name);
render_boot("loading module descriptor...");

ret = files_load_desc(name);

} else {
Expand Down Expand Up @@ -510,6 +511,43 @@ void* list_open_file_name(dirList_t* list, const char* name, const char* mode, u
return fp;
}

// search for named .lab file and load into network param desc memory
// return 1 on success, 0 on failure
extern u8 files_load_labels(const char* name) {
char path[64] = DSP_PATH;
void * fp;
u8 nbuf;
u8 ret = 1;

app_pause();

print_dbg("\r\n files_load_labels(): name = ");
print_dbg(name);

strcat(path, name);
strip_ext(path);
strcat(path, ".lab");

print_dbg("\r\n ...path = ");
print_dbg(path);

fp = fl_fopen(path, "r");
if(fp == NULL) {
print_dbg("\r\n file_load_labels(): fl_fopen(...) => NULL");
ret = 0;
} else {
// get number of parameters
scaler_start_parse_labels();
do {
fake_fread(&nbuf, 1, fp);
scaler_parse_labels_char(nbuf);
} while (nbuf != 255);
}
fl_fclose(fp);
app_resume();
return ret;
}

// search for named .dsc file and load into network param desc memory
// return 1 on success, 0 on failure
extern u8 files_load_desc(const char* name) {
Expand Down
4 changes: 4 additions & 0 deletions apps/bees/src/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ extern u8 files_load_scaler_name(const char* name, s32* dst, u32 dstSize);
// search for named .dsc file and load into network param desc memory
extern u8 files_load_desc(const char* name);

// load in a \n-separated list of patchmatrix labels from a .lab file
// (if present on sdcard)
extern u8 files_load_labels(const char* name);

// check for extension
extern bool check_ext(char* str, const char* ext );

Expand Down
144 changes: 140 additions & 4 deletions apps/bees/src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,87 @@ void net_init_onode(u16 idx) {
net->outs[idx].opIdx = -1;
net->outs[idx].target = -1;
}
#ifndef PD
// activate an input node with a value
void net_activate(void *op_void, s16 outIdx, const io_t val) {
static inode_t* pIn;
s16 pIndex;
u8 visIn, visOut;
op_t *op = (op_t *)op_void;
s16 inIdx = op->out[outIdx];

/* print_dbg("\r\n net_activate, input idx: "); */
/* print_dbg_hex(inIdx); */
/* print_dbg(" , value: "); */
/* print_dbg_hex(val); */

/* print_dbg(" , op index: "); */
/* print_dbg_ulong(net->ins[inIdx].opIdx); */
/* print_dbg(" , input idx: "); */
/* print_dbg_ulong(net->ins[inIdx].opInIdx); */

if(!netActive) {
if(op != NULL) {
// if the net isn't active, dont respond to requests from operators
print_dbg(" ... ignoring node activation from op.");
return;
}
}

if(outIdx < MAX_PLAY_OUTS) {
visOut = op->playOuts[outIdx];
}
else {
visOut = 0;
}

if(pageIdx == ePagePlay) {
if(opPlay) {
// operators have focus, do nothing
} else {
if(visOut) {
play_output(op, outIdx, val);
}
}
}

if(inIdx < 0) {
return;
}

visIn = net_get_in_play(inIdx);

if(inIdx < net->numIns) {
// this is an op input
pIn = &(net->ins[inIdx]);

op_set_in_val(net->ops[pIn->opIdx],
pIn->opInIdx,
val);

} else {
// this is a parameter
//// FIXME this is horrible
pIndex = inIdx - net->numIns;
if (pIndex >= net->numParams) { return; }
set_param_value(pIndex, val);
}

/// only process for play mode if we're in play mode
if(pageIdx == ePagePlay) {
if(opPlay) {
// operators have focus, do nothing
} else {
// process if play-mode-visibility is set on this input
if(visIn) {
play_input(inIdx);
}
}
}
}

// activate an input node with a value
void net_activate(s16 inIdx, const io_t val, void* op) {
void net_activate_in(s16 inIdx, const io_t val, void* op) {
static inode_t* pIn;
s16 pIndex;
u8 vis;
Expand Down Expand Up @@ -351,6 +429,7 @@ void net_activate(s16 inIdx, const io_t val, void* op) {
}

}
#endif

// attempt to allocate a new operator from the static memory pool, return index
s16 net_add_op(op_id_t opId) {
Expand Down Expand Up @@ -600,7 +679,7 @@ s16 net_add_op_at(op_id_t opId, int opIdx) {

}

return net->numOps - 1;
return opIdx;
}

// destroy last operator created
Expand Down Expand Up @@ -1066,6 +1145,62 @@ u8 net_get_in_play(u32 inIdx) {
}


// toggle play inclusion for output
u8 net_toggle_out_play(u32 outIdx) {
if(outIdx > net->numOuts) {
print_dbg("\r\nrequested out-of-range output for play screen display toggling");
return 0;
}
else {
s32 opIdx = net->outs[outIdx].opIdx;
s32 opOutIdx = net->outs[outIdx].opOutIdx;
if(opOutIdx < MAX_PLAY_OUTS) {
net->ops[opIdx]->playOuts[opOutIdx] ^= 1;
} else {
print_dbg("\r\nrequested out-of-range op output for play screen display toggling");
return 0;
}
}
return 0;
}

// set play inclusion for output
void net_set_out_play(u32 outIdx, u8 val) {
if(outIdx > net->numOuts) {
print_dbg("\r\nrequested out-of-range output for play screen display setting");
return;
}
else {
s32 opIdx = net->outs[outIdx].opIdx;
s32 opOutIdx = net->outs[outIdx].opOutIdx;
if(opOutIdx < MAX_PLAY_OUTS) {
net->ops[opIdx]->playOuts[opOutIdx] = val;
}
else {
print_dbg("\r\nrequested out-of-range op output for play screen display setting");
}
}
}

// get play inclusion for output
u8 net_get_out_play(u32 outIdx) {
if(outIdx > net->numOuts) {
print_dbg("\r\nrequested out-of-range output for play screen display getting");
return 0;
}
else {
s32 opIdx = net->outs[outIdx].opIdx;
s32 opOutIdx = net->outs[outIdx].opOutIdx;
if(opOutIdx < MAX_PLAY_OUTS) {
return net->ops[opIdx]->playOuts[opOutIdx];
} else {
print_dbg("\r\nrequested out-of-range op output for play screen display getting");
return 0;
}
}
}


//------------------------------------
//------ params

Expand Down Expand Up @@ -1303,11 +1438,12 @@ void net_disconnect_params(void) {
s16 net_split_out(s16 outIdx) {
// saved target
s16 target = net->outs[outIdx].target;
s16 opIdx = net->outs[outIdx].opIdx;
// index of added split operator
s16 split;
if( target < 0) {
// no target
split = net_add_op(eOpSplit);
split = net_add_op_at(eOpSplit, opIdx);
if(split < 0) {
// failed to add, do nothing
return outIdx;
Expand All @@ -1318,7 +1454,7 @@ s16 net_split_out(s16 outIdx) {
} // add ok
} else {
// had target; reroute
split = net_add_op(eOpSplit);
split = net_add_op_at(eOpSplit, opIdx);
// get the target again, because maybe it was a DSP param
// (if it was, its index will have shifted.
// patch and presets have been updated, but local var has not.)
Expand Down
12 changes: 11 additions & 1 deletion apps/bees/src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ extern s16 net_pop_op(void);
extern s16 net_remove_op(const u32 idx);

//! activate an input node with some input data
extern void net_activate(s16 inIdx, const io_t val, void* srcOp);
extern void net_activate(void* op, s16 outIdx, const io_t val);
extern void net_activate_in(s16 inIdx, const io_t val, void* srcOp);

//! get current count of operators
extern u16 net_num_ops(void);
Expand Down Expand Up @@ -152,6 +153,15 @@ extern void net_set_in_play(u32 inIdx, u8 val);
//! get play inclusion for input
extern u8 net_get_in_play(u32 inIdx);

//! toggle play inclusion for output
extern u8 net_toggle_out_play(u32 outIdx);

//! set play inclusion for output
extern void net_set_out_play(u32 outIdx, u8 val);

//! get play inclusion for output
extern u8 net_get_out_play(u32 outIdx);

//! add a new parameter
extern void net_add_param(u32 idx, const ParamDesc* pdesc);

Expand Down
18 changes: 15 additions & 3 deletions apps/bees/src/net_monome.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ void net_monome_set_focus(op_monome_t* op_monome, u8 focus) {
// if(monomeOpFocus != NULL ) {
if((monomeOpFocus != NULL) && (monomeOpFocus != op_monome)) {
/// stealing focus, inform the previous holder
monomeOpFocus->focus = 0;
*(monomeOpFocus->focus) = 0;
}
if(dev == eDeviceGrid) {
print_dbg("\r\n setting grid_key handler");
monome_grid_key_handler = op_monome->handler;
monomeLedBuffer = op_monome->opLedBuffer;
monome_set_quadrant_flag(0);
monome_set_quadrant_flag(1);
} else if(dev == eDeviceArc) {
print_dbg("\r\n setting ring_enc handler");
monome_ring_enc_handler = op_monome->handler;
Expand All @@ -80,17 +83,26 @@ void net_monome_set_focus(op_monome_t* op_monome, u8 focus) {
monome_ring_enc_handler = op_monome->handler;
}
monomeOpFocus = op_monome;
op_monome->focus = 1;
*(op_monome->focus) = 1;
} else {
if(dev == eDeviceGrid) {
monome_grid_key_handler = (monome_handler_t)&dummyHandler;
monomeLedBuffer = dummyLedBuffer;
} else if(dev == eDeviceArc) {
monome_ring_enc_handler = (monome_handler_t)&dummyHandler;
} else {
;;
}
monomeOpFocus = NULL;
op_monome->focus = 0;
*(op_monome->focus) = 0;
}
}

void net_monome_init(op_monome_t *op_monome, void *op) {
op_monome->op = op;
int i;
for(i=0; i<MONOME_MAX_LED_BYTES; ++i) {
op_monome->opLedBuffer[i] = 0;
}
}

Expand Down
Loading