Skip to content

Commit

Permalink
bucket assignment: use fewer buckets for short repeat rounds
Browse files Browse the repository at this point in the history
If a round repeats quickly enough, people in later buckets will not be heard by the leader. Take this into account, and use fewer buckets.
  • Loading branch information
jeffkaufman committed Jan 18, 2021
1 parent a63c857 commit 204ed17
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def run_backing_track() -> None:
def assign_delays(userid_lead) -> None:
initial_position = 0

repeat_length_s = None
if state.bpr and state.bpm and state.repeats:
beat_length_s = 60 / state.bpm
repeat_length_s = beat_length_s * state.bpr
Expand All @@ -495,7 +496,20 @@ def assign_delays(userid_lead) -> None:
leader.send("delay_seconds", state.first_bucket)
sendall("first_bucket", state.first_bucket)

n_follow_buckets = max(min(LAYERING_DEPTH - 1, len(followers)), 1)
max_follow_buckets = LAYERING_DEPTH - 1
print("max_follow_buckets: %s" % max_follow_buckets)
if repeat_length_s:
print("repeat_length_s: %s" % repeat_length_s)
layers_audible_to_leader = repeat_length_s // DELAY_INTERVAL
print("layers_audible_to_leader: %s" % layers_audible_to_leader)
if layers_audible_to_leader < 1:
layers_audible_to_leader = 1
max_follow_buckets = min(max_follow_buckets, layers_audible_to_leader)
print("max_follow_buckets: %s" % max_follow_buckets)

n_follow_buckets = int(max(min(max_follow_buckets, len(followers)), 1))
print("n_follow_buckets: %s" % n_follow_buckets)

follow_positions = [
initial_position + (x+2)*DELAY_INTERVAL
for x in range(n_follow_buckets)]
Expand Down

0 comments on commit 204ed17

Please sign in to comment.