Module xBlockLoop
Methods for working with the Renoise loop-block.
About
In the Renoise API, the loop-block can be controlled via transport.loop_range(). But the implementation is a both quite strict (as values are restricted to coefficients) and bit fuzzy, as you can apply that does not strictly adhere to those coefficients. As a result, the looped range can 'shift' after it has been set.
This class tries to overcome those issues by providing a consistent interface and methods.
If you are planning to use this class for realtime manipulation of the block-loop, create an instance of the class and work with those properties. This is preferred over working directly on the values returned from the API, as those can change during the evaluation of code.
Functions
__init (...) | [Constructor] accepts a single argument for initializing the class |
get_length () | [Class] get length of loop |
get_block_lines (seq_idx) | [Static] Retrieve number of lines in a block using the current coefficient (e.g. |
get_block_index (seq_idx, line_idx) | [Static] Return the block index of a given line in a pattern |
get_start () | [Static] Return start line of the currently set block loop |
get_end () | [Static] Calculates end line of the currently set block loop |
within (seq_idx, line_idx, end_pos) | [Static] Determine if position is within currently set block loop |
exiting (seq_idx, line_idx, line_delta, end_pos) | [Static] Check if we are heading out of a block-loop |
get_previous_line_index () | Obtain the line number of the loop block previous to the current one |
get_next_line_index () | Obtain the line number of the loop block previous to the current one |
normalize_line_range (start_line, end_line, num_lines, coeffs) | Enforce range of lines to nearest valid coefficient. |
Fields
self.start_line | (number) where the loop starts |
self.end_line | (number) where the loop ends |
self.length | (number) length of loop (read-only) |
Functions
- __init (...)
-
[Constructor] accepts a single argument for initializing the class
Parameters:
- ...
- get_length ()
- [Class] get length of loop
- get_block_lines (seq_idx)
-
[Static] Retrieve number of lines in a block using the current coefficient
(e.g. a pattern with 64 lines and 4 as coeff would return 16)Parameters:
- seq_idx
Returns:
- number (number of lines in block) or nil
- number (number of lines in pattern) or nil
- get_block_index (seq_idx, line_idx)
-
[Static] Return the block index of a given line in a pattern
Parameters:
- seq_idx
- line_idx
Returns:
- number (the block index) or nil
- number (number of lines in pattern) or nil
- get_start ()
-
[Static] Return start line of the currently set block loop
Returns:
-
int, line index or nil
- get_end ()
-
[Static] Calculates end line of the currently set block loop
Returns:
- number (line index) or nil
- number (number of lines in pattern) or nil
- within (seq_idx, line_idx, end_pos)
-
[Static] Determine if position is within currently set block loop
Parameters:
- seq_idx (int)
- line_idx (int) line to check
- end_pos (int) optional, avoids having to calculate this
Returns:
-
bool
- exiting (seq_idx, line_idx, line_delta, end_pos)
-
[Static] Check if we are heading out of a block-loop
Parameters:
- seq_idx (int)
- line_idx (int)
- line_delta (int), #lines to add/subtract, negative when decreasing
- end_pos (int) optional, avoids having to calculate this
Returns:
-
line (int)
- get_previous_line_index ()
-
Obtain the line number of the loop block previous to the current one
Returns:
-
number or nil
- get_next_line_index ()
-
Obtain the line number of the loop block previous to the current one
Returns:
-
number or nil
- normalize_line_range (start_line, end_line, num_lines, coeffs)
-
Enforce range of lines to nearest valid coefficient. Supports 'shifted' ranges.
Parameters:
- start_line , number
- end_line , number
- num_lines , number - number of lines in pattern
- coeffs
], table
, valid coefficients (defaults to COEFFS_ALL)
Returns:
- number, start line
- number, end line
- number, coefficient
- boolean, when whole pattern should be looped