Module xVoiceSorter
Advanced sorting of pattern-data (including selections) .
See also: xVoiceRunner
Functions
reset () | call before a sort operation |
sort (ptrack_or_phrase, selection, trk_idx, seq_idx) | main function - sort a pattern-track, or part thereof |
sort_line_runs (t, line_idx) | sort line runs according to note and (optionally) instrument |
sort_by_note (line_runs, line_idx) | sorting by note-value, one line at a time |
find_note_column (note_value, line_idx, num_lines) | look for a matching note column (with or without available space) |
shift_runs (note_value, source_col_idx, target_col_idx, line_idx) | look for previous notes which are equal/higher, move to target column (important: target should be empty or voice-runs could be overwritten) return bool (true when shifting took place) |
clear_temp_run (col_idx, run_idx) | convenience method, clear a given run + will also remove the column if no runs are left... |
remove_temp_column (col_idx) | remove temp column, maintain high/low table |
insert_temp_column (col_idx, voice_run) | insert temp column, maintain high/low table |
set_high_low_column (col_idx, high_note, low_note, force, line_idx) | maintain high/low note-values in column |
insert_note_run (col_idx, voice_run, line_idx) | insert a voice-run, and shift existing entries if needed invoked by sortbynote() - |
sort_unique (line_runs, line_idx) | sort note-values, unique style |
find_unique_column (notecol, line_idx, num_lines) | look for remap column (matching note) with free space |
matches_unique_column (notecol, col_idx) | check if a notecol belongs to a given unique column |
sort_compact (line_runs, line_idx) | sort note-values, compact style |
find_compact_column (line_idx, num_lines) | |
__tostring () | Meta-methods |
Tables
self.high_low_columns | table, defines the high/low note values in each column
(used when sorting by note)
{
} |
self.sorted | table, sorted voice from one line of voice-runs (see xVoiceRunner.getrunson_line()...) |
self.temp_runs | table, structure similar to that of xVoiceRunner.voice_runs |
Fields
self.runner | xVoiceRunner |
self.sort_mode | xVoiceSorter.SORT_MODE |
self.sort_method | xVoiceSorter.SORT_METHOD |
self.merge_unique | bool |
self.unique_instrument | bool, decide if instrument is considered when sorting |
self.selection | table |
self.unique_map | table, specifies unique/remapped notes
[column] = {
} |
self.required_cols | int, the columns that would be required to successfully complete a sorting operation (copy of unique_map) |
Functions
- reset ()
- call before a sort operation
- sort (ptrack_or_phrase, selection, trk_idx, seq_idx)
-
main function - sort a pattern-track, or part thereof
Parameters:
- ptrack_or_phrase (renoise.PatternTrack or renoise.InstrumentPhrase)
- selection (table), pattern-selection
- trk_idx (number)
- seq_idx (number)
Returns:
-
bool, true or false if failed/require user input
- sort_line_runs (t, line_idx)
-
sort line runs according to note and (optionally) instrument
Parameters:
- t
- line_idx
- sort_by_note (line_runs, line_idx)
-
sorting by note-value, one line at a time
Parameters:
- line_runs (table), see getrunson_line()
- line_idx (int) the line index
- find_note_column (note_value, line_idx, num_lines)
-
look for a matching note column (with or without available space)
Parameters:
- note_value
- line_idx
- num_lines
Returns:
- bool, true when column has space
- int, column index (when no space, "where to create column")
- bool, when true, column is 'after'
- shift_runs (note_value, source_col_idx, target_col_idx, line_idx)
-
look for previous notes which are equal/higher, move to target column
(important: target should be empty or voice-runs could be overwritten)
return bool (true when shifting took place)
Parameters:
- note_value
- source_col_idx
- target_col_idx
- line_idx
- clear_temp_run (col_idx, run_idx)
-
convenience method, clear a given run
+ will also remove the column if no runs are left...
Parameters:
- col_idx
- run_idx
- remove_temp_column (col_idx)
-
remove temp column, maintain high/low table
Parameters:
- col_idx
- insert_temp_column (col_idx, voice_run)
-
insert temp column, maintain high/low table
Parameters:
- col_idx
- voice_run
- set_high_low_column (col_idx, high_note, low_note, force, line_idx)
-
maintain high/low note-values in column
Parameters:
- col_idx (int)
- high_note (int)
- low_note (int)
- force (bool), if defined the high/low values are explicitly set (otherwise they will expand the already existing range)
- line_idx (int), set to high/low of existing runs until this line
- insert_note_run (col_idx, voice_run, line_idx)
-
insert a voice-run, and shift existing entries if needed
invoked by sortbynote() -
Parameters:
- col_idx
- voice_run
- line_idx
- sort_unique (line_runs, line_idx)
-
sort note-values, unique style
Parameters:
- line_runs (table)
- line_idx (int)
Returns:
-
bool, false when too many unique/overlapping notes
- find_unique_column (notecol, line_idx, num_lines)
-
look for remap column (matching note) with free space
Parameters:
- notecol
- line_idx
- num_lines
Returns:
- bool, true when column exist + has available space
- int, column index (last matching column or column with room)
- matches_unique_column (notecol, col_idx)
-
check if a notecol belongs to a given unique column
Parameters:
- notecol (xNoteColumn)
- col_idx (int)
Returns:
-
bool, true when matched
- sort_compact (line_runs, line_idx)
-
sort note-values, compact style
Parameters:
- line_runs (table)
- line_idx (int)
Returns:
- bool, false when too many unique/overlapping notes
- int, column index
- find_compact_column (line_idx, num_lines)
-
Parameters:
- line_idx
- num_lines
Returns:
-
int, column index
- __tostring ()
- Meta-methods
Tables
- self.high_low_columns
-
table, defines the high/low note values in each column
(used when sorting by note)
{
low_note = int, high_note = int,
}
- self.sorted
- table, sorted voice from one line of voice-runs (see xVoiceRunner.getrunson_line()...)
- self.temp_runs
- table, structure similar to that of xVoiceRunner.voice_runs
Fields
- self.runner
- xVoiceRunner
- self.sort_mode
- xVoiceSorter.SORT_MODE
- self.sort_method
- xVoiceSorter.SORT_METHOD
- self.merge_unique
- bool
- self.unique_instrument
- bool, decide if instrument is considered when sorting
- self.selection
- table
- self.unique_map
-
table, specifies unique/remapped notes
[column] = {
note_value = int, instrument_value = int,
}
- self.required_cols
- int, the columns that would be required to successfully complete a sorting operation (copy of unique_map)