Skip to content

Commit 9712060

Browse files
committed
starting record(^) & alternate repeats
1 parent fe152a0 commit 9712060

File tree

8 files changed

+46
-12
lines changed

8 files changed

+46
-12
lines changed

test/alternate_repeats.txbt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
%t80
2+
; make sure there's something in the callstack
3+
|e:
4+
1'
5+
:e|
6+
2'
7+
|start:
8+
1
9+
||
10+
2
11+
:start|
12+
3

test/modes.txbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
;ionian
12
%s1
23
1
34
2
@@ -6,6 +7,7 @@
67
5
78
6
89
7
10+
;dorian
911
%s2
1012
1
1113
2
@@ -14,6 +16,7 @@
1416
5
1517
6
1618
7
19+
;relative shift
1720
%k2
1821
1
1922
2

test/record.txbt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
1^^
2+
2
3+
3^^!
4+
^
5+
6+
7+
^!

test/tabs.txbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; tab syntax
22
; not yet impl
3-
|||
3+
||||
44
%c20,-2
55

66
|0 |

textbeat/defs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
RANGE = 109
3939
OCTAVE_BASE = 5
4040
DRUM_WORDS = ['drum','drums','drumset','drumkit','percussion']
41-
CCHAR = ' <>=~.\'`,_&|!?*\"$(){}[]%@;'
41+
CCHAR = ' <>=~.\'`,_&|!?*\"$(){}[]%@;^'
4242
CCHAR_START = 'TV' # control chars
4343
PRINT = True
4444

textbeat/player.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,9 @@ async def run(self):
717717
cells = fullline.split(' ')
718718
pos = 0
719719
for cell in cells:
720-
if cell:
721-
if pos:
722-
self.separators.append(pos)
720+
# if cell:
721+
# if pos:
722+
# self.separators.append(pos)
723723
# log(cell)
724724
pos += len(cell) + 1
725725
# log( "self.separators " + str(self.separators))
@@ -1510,13 +1510,15 @@ async def run(self):
15101510
# vel = int((float(num) / float('9'*len(num)))*127)
15111511
# ch.cc(7,vel)
15121512
# RECORD SEQ
1513-
elif cell.startswith('^^'):
1513+
# elif cell.startswith('^^'):
1514+
elif c2=='^^':
15141515
cell = cell[2:]
15151516
r,ct = peel_uint(cell,0)
15161517
ch.record(r)
15171518
cell = cell[ct:]
15181519
# REPLAY SEQ
1519-
elif cell.startswith('^'):
1520+
elif c=='^':
1521+
# elif cell.startswith('^'):
15201522
cell = cell[1:]
15211523
r,ct = peel_uint(cell,0)
15221524
if self.showtext:

textbeat/schedule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ async def logic(self, t):
5353
# log(self.clock)
5454

5555
pending_events_count = sum(1 for e in self.events if e.t > 0.0 and e.t < 2.0)
56-
print(pending_events_count)
57-
56+
# print(pending_events_count)
57+
5858
try:
5959
self.events = sorted(self.events, key=lambda e: e.t)
6060
for ev in self.events:

textbeat/track.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import math
33

44
class Recording(object):
5-
def __init__(self, name, slot):
6-
self.name = slot
5+
def __init__(self, name):
6+
self.name = name
77
self.content = []
88

99
class Tuplet(object):
@@ -90,8 +90,9 @@ def reset(self):
9090
# self.muted = False
9191
self.volval = 1.0
9292
self.slots = {} # slot -> Recording
93+
self.recording_slots = set() # slots currently recording
9394
self.slot = None # careful, this can be 0
94-
self_slot_idx = 0
95+
self.slot_idx = 0
9596
self.lane = None
9697
self.lanes = []
9798
self.ccs = {}
@@ -103,6 +104,15 @@ def reset(self):
103104
self.vibrato_freq = 0.0
104105
# self.vibrato_offset = 0.0 # value that gets added to pitch
105106

107+
def record(self, label):
108+
self.slots[label] = Recording(label)
109+
self.recording_slots.add(label)
110+
def record_stop(self, label):
111+
self.recording_slots.remove(label)
112+
def recording(self):
113+
return self.recording_slots
114+
def replay(self, label):
115+
pass
106116
def vibrato(self, b, amp=0.0, freq=0.0):
107117
self.vibrato_amp = amp
108118
self.vibrato_freq = freq

0 commit comments

Comments
 (0)