#ifndef UDO_SCSS_SEQTABLES #define UDO_SCSS_SEQTABLES ## /* ; temp scratch replacement tables iscratchnum = 8 gistfn_scratch[] init iscratchnum index = 0 while (index < iscratchnum) do gistfn_scratch[index] = ftgen(0, 0, -16, -2, 0) index += 1 od */ ; statics /* gistfn_all ftgen 0, 0, -giscss_seqtable_size, -2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 gistfn_offbeat ftgen 0, 0, -giscss_seqtable_size, -2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0 gistfn_onbeat ftgen 0, 0, -giscss_seqtable_size, -2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 gisfn_2ndbeat ftgen 0, 0, -giscss_seqtable_size, -2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 */ /* gSseq_names[] fillarray "Kick", "Snare", "Clap", "Hat", "Hat2", "Bass", "Sine", "OPL" giscss_stfn_src[][] init lenarray(gSseq_names), 4 index = 0 while (index < lenarray(giscss_stfn_src, 1)) do index2 = 0 while (index2 < lenarray(giscss_stfn_src, 2)) do giscss_stfn_src[index][index2] = ftgen(0, 0, -giscss_seqtable_size, -2, 0) index2 += 1 od index += 1 od */ ; automation tables for arbitrary assignment giscss_fn_automation[] init 8 giscss_stfn_trig[][] init 1, 1 giscss_stfn_dur[][] init 1, 1 giscss_stfn_params[][] init 1, 1 giscss_st_size = -1 giscss_st_slots = -1 giscss_stfn_temp = -1 giscss_stfn_param_temp = -1 giscss_st_paramnumber = -1 opcode scss_st_boot, 0, ijj icategorynum, iseqtable_size, islots xin iseqtable_size = (iseqtable_size == -1) ? 16 : iseqtable_size islots = (islots == -1) ? 4 : islots iparamnumber = 4 giscss_st_size = iseqtable_size giscss_st_slots = islots giscss_st_paramnumber = iparamnumber giscss_stfn_temp = ftgen(0, 0, -iseqtable_size, -2, 0) giscss_stfn_param_temp = ftgen(0, 0, -(iseqtable_size*iparamnumber), -2, 0) giscss_stfn_trig[][] init icategorynum, islots giscss_stfn_dur[][] init icategorynum, islots giscss_stfn_params[][] init icategorynum, islots index1 = 0 while (index1 < icategorynum) do index2 = 0 while (index2 < islots) do giscss_stfn_trig[index1][index2] = ftgen(0, 0, -iseqtable_size, -2, 0) giscss_stfn_dur[index1][index2] = ftgen(0, 0, -iseqtable_size, -2, 0) giscss_stfn_params[index1][index2] = ftgen(0, 0, -(iseqtable_size*iparamnumber), -2, 0) index2 += 1 od index1 += 1 od ; automation tables iautomationtablesize = 1024 index = 0 while (index < lenarray(giscss_fn_automation)) do giscss_fn_automation[index] = ftgen(0, 0, -iautomationtablesize, -7, 0) index += 1 od endop ; called from category instrument to get parameter opcode scss_seqparam, i, i iparam xin icategoryid = p4 itimeindex = p5 xout table:i((iparam * giscss_st_paramnumber) + itimeindex, giscss_stfn_params[icategoryid][0]) endop opcode seqtable_copyin, 0, iijjj icategoryid, islot, ifntrig, ifndur, ifnparam xin if (ifntrig != -1) then tableicopy giscss_stfn_trig[icategoryid][islot], ifntrig endif if (ifndur != -1) then tableicopy giscss_stfn_dur[icategoryid][islot], ifndur endif if (ifnparam != -1) then tableicopy giscss_stfn_params[icategoryid][islot], ifnparam endif endop opcode scss_st_swap, 0, ii icategoryid, islot xin ; triggers tableicopy giscss_stfn_temp, giscss_stfn_trig[icategoryid][0] tableicopy giscss_stfn_trig[icategoryid][0], giscss_stfn_trig[icategoryid][islot] tableicopy giscss_stfn_trig[icategoryid][islot], giscss_stfn_temp ; durations tableicopy giscss_stfn_temp, giscss_stfn_dur[icategoryid][0] tableicopy giscss_stfn_dur[icategoryid][0], giscss_stfn_dur[icategoryid][islot] tableicopy giscss_stfn_dur[icategoryid][islot], giscss_stfn_temp ; parameters tableicopy giscss_stfn_param_temp, giscss_stfn_params[icategoryid][0] tableicopy giscss_stfn_params[icategoryid][0], giscss_stfn_params[icategoryid][islot] tableicopy giscss_stfn_params[icategoryid][islot], giscss_stfn_param_temp endop opcode scss_st_swapall, 0, p isrcslot xin index = 0 while (index < lenarray(giscss_stfn_trig, 1)) do scss_st_swap(index, isrcslot) index += 1 od endop ; host call instrument instr seqtable_swap imode = p4 ; 0 = all, 1 = specified category id isrcslot = p5 ; source index in giscss_stfn_src (eg 1 to 3) icategoryid = p6 ; category ID to replace by, if mode is 1 if (imode == 0) then scss_st_swapall isrcslot else scss_st_swap icategoryid, isrcslot endif turnoff endin /* Add table numbers with names to a specified key in a target JSON object opcode seqtable_appendjson, 0, i iJsontarget xin iJson = jsoninit() index = 0 while (index < lenarray(gSseq_names)) do jsoninsertval(iJson, gSseq_names[index], getrow(giscss_stfn_src, index)) index += 1 od jsoninsert(iJsontarget, "trigtables", iJson) jsondestroy(iJson) endop */ #end