aboutsummaryrefslogtreecommitdiff
path: root/BUG9/bid.udo
diff options
context:
space:
mode:
authorRichard <richard@1bpm.net>2025-02-28 02:08:19 +0000
committerRichard <richard@1bpm.net>2025-02-28 02:08:19 +0000
commit0f09f0882ed87bea9ff3e745c73f5d4743854fbb (patch)
tree62d04024200a4942ce4e012227822fdaae6a2e25 /BUG9/bid.udo
parent6a8342a78bb65afbec9eac5693438a3107ff1dd3 (diff)
downloadcsd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.gz
csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.bz2
csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.zip
added bug6HEADmaster
Diffstat (limited to 'BUG9/bid.udo')
-rw-r--r--BUG9/bid.udo157
1 files changed, 121 insertions, 36 deletions
diff --git a/BUG9/bid.udo b/BUG9/bid.udo
index 17e9be2..a31a603 100644
--- a/BUG9/bid.udo
+++ b/BUG9/bid.udo
@@ -1,7 +1,7 @@
#ifndef UDO_BID
#define UDO_BID ##
/*
- Debugger - Unfixed Bugs : BUG #5
+ Debugger - Unfixed Bugs : BUG #9
Bug Infested Directive file parser v1 and tools
@@ -9,7 +9,7 @@
*/
-#define BID_VERSION #1.1#
+#define BID_VERSION #1.3#
#include "txt_tools.udo"
@@ -23,7 +23,7 @@ gkbid_chordlength init -1 ; current chord length
; BID internals
gibid_sectionlengths ftgen 0, 0, -64, -7, 0 ; section lengths
gibid_sections[][] init 64, 64 ; section pointers to data
-gibid_sectiondata[][] init 99, 6 ; section data, ftables contained
+gibid_sectiondata[][] init 99, 8 ; section data, ftables contained
gibid_chordgroups[][] init 16, 12 ; chord groups, pointers to sectionchords by section
gibid_sectionchords[] init 16 ; ftables of section chords
@@ -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.
@@ -192,8 +161,8 @@ endop
_bid_parserow Sline, ix1, ix2, imode
Sline line to parse
- ix1 array dimension 1 index of target storage
- ix2 array dimension 2 index of target storage
+ ix1 array dimension 1 index of target storage
+ ix2 array dimension 2 index of target storage
imode 1=section patterns, 2=chords
*/
opcode _bid_parserow, 0, Siii
@@ -345,6 +314,122 @@ 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.