Skip to content

Commit 0412210

Browse files
committed
Spider - modify docs to emphasise that the beat no longer starts at 0
This is because the beat is now defined by Link
1 parent 31a823e commit 0412210

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

app/server/ruby/lib/sonicpi/lang/core.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4085,13 +4085,13 @@ def beat
40854085
opts: nil,
40864086
accepts_block: false,
40874087
examples: ["
4088-
use_bpm 120 # The current BPM makes no difference
4089-
puts beat #=> 0
4090-
sleep 1
4091-
puts beat #=> 1
4092-
use_bpm 2000
4093-
sleep 2
4094-
puts beat #=> 3"]
4088+
use_bpm 120 #=> The initial beat does not start at 0
4089+
puts beat #=> 109252.703125
4090+
sleep 1
4091+
puts beat #=> 109253.703125
4092+
use_bpm 2000 # Changing the BPM makes no difference
4093+
sleep 2
4094+
puts beat #=> 109255.703125"]
40954095

40964096

40974097

app/server/ruby/test/lang/core/test_sleep.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ def test_bpm_scaled_sleep
4242
end
4343
end
4444

45+
def test_beat
46+
@lang.run do
47+
use_bpm 60
48+
assert_equal beat, 0
49+
sleep 2
50+
assert_equal beat, 2
51+
end
52+
end
53+
4554
end
4655
end

0 commit comments

Comments
 (0)