Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
- xSongPos: add methods for converting between beats and regular posi…
Browse files Browse the repository at this point in the history
…tions

+ fix: always enforced looping in `enforce_boundary`
+ supply boundaries as a table (+ update affected classes)
+ add "previous" methods for beat/bar/etc.
  • Loading branch information
bjorn-nesby committed Jul 14, 2018
1 parent 2af3b01 commit e08ccf7
Show file tree
Hide file tree
Showing 2 changed files with 366 additions and 132 deletions.
20 changes: 16 additions & 4 deletions classes/xSequencerSelection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,14 @@ function xSequencerSelection.shift_forward(seq_range)
local start_pos = {sequence = seq_range.start_sequence, line = seq_range.start_line}
local end_pos = {sequence = seq_range.end_sequence, line = seq_range.end_line}

xSongPos.increase_by_lines(range_num_lines,start_pos,BOUNDS_MODE,LOOP_MODE,BLOCK_MODE)
xSongPos.increase_by_lines(range_num_lines,end_pos,BOUNDS_MODE,LOOP_MODE,BLOCK_MODE)
local pos_args = {
bounds_mode = BOUNDS_MODE,
loop_boundary = LOOP_MODE,
block_boundary = BLOCK_MODE
}

xSongPos.increase_by_lines(range_num_lines,start_pos,pos_args)
xSongPos.increase_by_lines(range_num_lines,end_pos,pos_args)

return {
start_sequence = start_pos.sequence,
Expand All @@ -273,8 +279,14 @@ function xSequencerSelection.shift_backward(seq_range)
local start_pos = {sequence = seq_range.start_sequence,line = seq_range.start_line}
local end_pos = {sequence = seq_range.end_sequence,line = seq_range.end_line}

xSongPos.decrease_by_lines(range_num_lines,start_pos,BOUNDS_MODE,LOOP_MODE,BLOCK_MODE)
xSongPos.decrease_by_lines(range_num_lines,end_pos,BOUNDS_MODE,LOOP_MODE,BLOCK_MODE)
local pos_args = {
bounds_mode = BOUNDS_MODE,
loop_boundary = LOOP_MODE,
block_boundary = BLOCK_MODE
}

xSongPos.decrease_by_lines(range_num_lines,start_pos,pos_args)
xSongPos.decrease_by_lines(range_num_lines,end_pos,pos_args)

return {
start_sequence = start_pos.sequence,
Expand Down
Loading

0 comments on commit e08ccf7

Please sign in to comment.