diff options
author | Richard <richard@1bpm.net> | 2025-02-28 02:08:19 +0000 |
---|---|---|
committer | Richard <richard@1bpm.net> | 2025-02-28 02:08:19 +0000 |
commit | 0f09f0882ed87bea9ff3e745c73f5d4743854fbb (patch) | |
tree | 62d04024200a4942ce4e012227822fdaae6a2e25 /BUG10/bid.udo | |
parent | 6a8342a78bb65afbec9eac5693438a3107ff1dd3 (diff) | |
download | csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.gz csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.bz2 csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.zip |
Diffstat (limited to 'BUG10/bid.udo')
-rw-r--r-- | BUG10/bid.udo | 154 |
1 files changed, 120 insertions, 34 deletions
diff --git a/BUG10/bid.udo b/BUG10/bid.udo index 17e9be2..3c96bdc 100644 --- a/BUG10/bid.udo +++ b/BUG10/bid.udo @@ -1,15 +1,15 @@ #ifndef UDO_BID #define UDO_BID ## /* - Debugger - Unfixed Bugs : BUG #5 + Debugger - Unfixed Bugs : BUG #10 - Bug Infested Directive file parser v1 and tools + Bug Infested Directive file parser v1.2 and tools Designed to create a reusable loop based score format in the Unfixed Bugs project and beyond. */ -#define BID_VERSION #1.1# +#define BID_VERSION #1.2# #include "txt_tools.udo" @@ -118,37 +118,6 @@ opcode _bid_parserowitems, i, Siii endop -/* - Read BID data for specified element and trigger accordingly. - - bid_seq Splayer, kposition, ksection - - Splayer name of BID element - kposition position in pattern provided by master sequencer - ksection section in composition provided by master sequencer - -*/ -opcode bid_seq, 0, Skk - Splayer, kpos, ksection xin - Sinstrument = sprintf("play_%s", Splayer) - instrindex = _bid_gettextindex(Splayer) - kdata = gibid_sections[ksection][instrindex] - - if (kdata != -1) then ; null section - kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) - - if (kon == 1) then - kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) - if (random:k(0, 1) < kchance) then - ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime - kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime - ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) - event "i", Sinstrument, ktime, kdur, kpos, kdata - endif - endif - endif -endop - /* Get a parameter for the specified pattern position. @@ -345,6 +314,123 @@ complete: endop + +/* + Read BID data for specified element and trigger accordingly. + + bid_seq Splayer, kposition, ksection + + Splayer name of BID element + kposition position in pattern provided by master sequencer + ksection section in composition provided by master sequencer + +*/ +opcode bid_seq, 0, Skk + Splayer, kpos, ksection xin + Sinstrument = sprintf("play_%s", Splayer) + instrindex = _bid_gettextindex(Splayer) + kdata = gibid_sections[ksection][instrindex] + + if (kdata != -1) then ; null section + kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) + + if (kon == 1) then + kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) + if (random:k(0, 1) < kchance) then + ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime + kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime + ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) + event "i", Sinstrument, ktime, kdur, kpos, kdata + endif + endif + endif +endop + + +instr _bid_exit + exitnow +endin + +/* + Print notification of performance time since last notification + or if isection is -1, print completion notification +*/ +gibid_timetrack times +instr bid_notify_change + isection = p4 + itime times + if (isection == -1) then + tt_notify(sprintf"Complete, runtime: %s", tt_parsetime(itime))) + exitnow + else + isectiontime = itime - gibid_timetrack + tt_notify(sprintf("%s : section %d complete in %s", tt_parsetime(itime), isection, tt_parsetime(isectiontime))) + gibid_timetrack = itime + endif + turnoff +endin + + +opcode bid_seq_all, k, oo + istartsection, index xin + ksection init istartsection + kpos init 0 + kposabs init 0 + kposchord init 0 + imaxinstruments = lenarray(gSbid_sequenced) + + kmetro metro (gibid_tempo / 60) * 4 + + if (kmetro == 1) then + if (ksection > gibid_maxsection) then + schedulek("bid_notify_change", 0, 1, -1) + endif + + kindex = 0 + while (kindex < imaxinstruments) do + kdata = gibid_sections[ksection][kindex] + if (kdata != -1) then ; null section + kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) + + if (kon == 1) then + kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) + if (random:k(0, 1) < kchance) then + ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime + kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime + ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) + schedulek(sprintfk("play_%s", gSbid_sequenced[kindex]), ktime, kdur, kpos, kdata) + endif + endif + endif + kindex += 1 + od + + kpos = (kpos < 31) ? kpos + 1 : 0 + ksection16ths = bid_getsectionlength(ksection) * 4 + + if (kposabs + 1 < ksection16ths) then + kposabs += 1 + else + schedulek("bid_notify_change", 0, 1, ksection) + ksection += 1 + kposchord = 0 + kpos = 0 + kposabs = 0 + schedulek("bid_setcurrentchord", 0, 1, ksection, 1) + endif + + if (kposchord + 1 < gkbid_chordlength * 4) then + kposchord += 1 + else + kposchord = 0 + schedulek("bid_setcurrentchord", 0, 1, ksection, 1) + endif + endif + xout ksection +endop + + + /* Parse a Bug Infested Directive Format string to global arrays, ftables and variables. Handles patterns, tempo, chord groups and sections etc accordingly. |