Module xPhraseManager
Static methods for managing phrases, phrase mappings and presets .
Note that some methods only work with the selected instrument. This is a API limitation which would stands until we can determine the selected phrase without having to rely on the global 'selectedphrase/index' property
See also: http://forum.renoise.com/index.php/topic/26329-the-api-wishlist-thread/?p=221484
Functions
get_available_slot (instr_idx, keymap_range, keymap_offset) | Retrieve the next available phrase mapping |
get_empty_slot (instr_idx, keymap_offset) | retrieve existing, empty phrase, searching 'back-to-back' (no gaps) |
auto_insert_phrase (instr_idx, insert_at_idx, takeover, keymap_args) | Automatically add a new phrase to the specified instrument |
select_previous_phrase () | Select previous phrase |
can_select_previous_phrase () | |
set_selected_phrase_by_mapping_index (idx) | API5: Using the mapping index to specify the selected phrase |
select_next_phrase () | Select previous/next phrase |
can_select_next_phrase () | |
select_next_phrase_mapping () | Select next phrase mapping as it appears in phrase bar |
select_previous_phrase_mapping () | Select previous phrase mapping as it appears in phrase bar |
select_first_phrase () | Select first phrase |
select_last_phrase () | Select last phrase |
get_phrase_index_by_mapping_index (instr_idx, mapping_idx) | API5: Using the mapping index to retrieve the selected phrase |
get_mapping_index_by_phrase_index (instr_idx, phrase_idx) | API5: Using a phrase to retrieve the phrase-mapping index |
set_universal_property (instr_idx, phrase_idx, prop_name, prop_value) | API5: Assign a property value to both the phrase and it's mapping (if any) |
delete_selected_phrase () | Delete the currently selected phrase |
delete_selected_phrase_mapping () | Delete the currently selected phrase mapping TODO in API4+, delete phrase + mapping |
get_selected_mapping () | |
get_selected_mapping_index () | return the selected phrase-mapping index (when keymapped) |
set_playback_mode (mode, toggle) | |
cycle_playback_mode () | |
find_duplicates (instr) | locate duplicate phrases within instrument |
export_presets (folder, instr_idx, indices, overwrite, prefix) | export indicated phrases in the instrument |
import_presets (files, instr_idx, insert_at_idx, takeover, keymap_args, remove_prefix) | import one or more phrase presets into instrument |
Functions
- get_available_slot (instr_idx, keymap_range, keymap_offset)
-
Retrieve the next available phrase mapping
Parameters:
- instr_idx (int), index of instrument
- keymap_range (int), the size of the mapping in semitones
- keymap_offset (int), start search from this note [first, if nil]
Returns:
- table{} or nil (if not able to find room)
- int, the index where we can insert
- get_empty_slot (instr_idx, keymap_offset)
-
retrieve existing, empty phrase, searching 'back-to-back' (no gaps)
Parameters:
- instr_idx (int), index of instrument
- keymap_offset (int), start search from this note [first, if nil]
Returns:
- table{} or nil, note-range
- int or nil, the index where we can insert
- auto_insert_phrase (instr_idx, insert_at_idx, takeover, keymap_args)
-
Automatically add a new phrase to the specified instrument
Parameters:
- instr_idx (int), index of instrument [required]
- insert_at_idx (int), insert at this position [optional, default = end]
- takeover (bool), 'take over' empty phrases [optional]
- keymap_args (table), define to create keymapping [optional] keymaprange (int), size of mappings (in semitones) keymapoffset (int), starting note (0-120)
Returns:
- InstrumentPhrase, the resulting phrase object
- int, the phrase index or nil if failed
- select_previous_phrase ()
-
Select previous phrase
Returns:
- int (phrase index) or nil if no phrase was selected
- bool (true when able to select earlier phrase)
- can_select_previous_phrase ()
-
Returns:
-
bool (true when able to select earlier phrase)
- set_selected_phrase_by_mapping_index (idx)
-
API5: Using the mapping index to specify the selected phrase
Parameters:
- idx
- select_next_phrase ()
-
Select previous/next phrase
Returns:
- int (phrase index) or nil if no phrase was selected
- bool (true when able to select earlier phrase)
- can_select_next_phrase ()
-
Returns:
-
bool (true when able to select earlier phrase)
- select_next_phrase_mapping ()
- Select next phrase mapping as it appears in phrase bar
- select_previous_phrase_mapping ()
- Select previous phrase mapping as it appears in phrase bar
- select_first_phrase ()
-
Select first phrase
Returns:
-
boolean, true if phrase was selected
- select_last_phrase ()
-
Select last phrase
Returns:
-
boolean, true if phrase was selected
- get_phrase_index_by_mapping_index (instr_idx, mapping_idx)
-
API5: Using the mapping index to retrieve the selected phrase
Parameters:
- instr_idx
- mapping_idx
- get_mapping_index_by_phrase_index (instr_idx, phrase_idx)
-
API5: Using a phrase to retrieve the phrase-mapping index
Parameters:
- instr_idx
- phrase_idx
- set_universal_property (instr_idx, phrase_idx, prop_name, prop_value)
-
API5: Assign a property value to both the phrase and it's mapping (if any)
Parameters:
- instr_idx (number)
- phrase_idx (number)
- prop_name (string)
- prop_value (number/string/boolean)
- delete_selected_phrase ()
- Delete the currently selected phrase
- delete_selected_phrase_mapping ()
-
Delete the currently selected phrase mapping
TODO in API4+, delete phrase + mapping
Returns:
-
renoise.InstrumentPhraseMapping or nil
- get_selected_mapping ()
-
Returns:
-
renoise.InstrumentPhraseMapping or nil
- get_selected_mapping_index ()
-
return the selected phrase-mapping index (when keymapped)
Returns:
- int or nil
- boolean, true when mode was set
- string (error message when failed)
- set_playback_mode (mode, toggle)
-
Parameters:
- mode (int), renoise.Instrument.PHRASES_xxx
- toggle (bool), makes same mode toggle between off & mode
Returns:
- boolean, true when mode was set
- string (error message when failed)
- boolean, true when mode was set
- string (error message when failed)
- cycle_playback_mode ()
-
Returns:
- boolean, true when mode was set
- string (error message when failed)
- find_duplicates (instr)
-
locate duplicate phrases within instrument
Parameters:
- instr
Returns:
table, each entry having this form:
{ source_phrase_index=int, target_phrase_index=int, -- duplicate }
- export_presets (folder, instr_idx, indices, overwrite, prefix)
-
export indicated phrases in the instrument
Parameters:
- folder
- instr_idx
- indices
- overwrite
- prefix
Returns:
- bool, true when export was succesfull
- string, error message when a problem was encountered
- table, on problem, the indices not yet processed
- import_presets (files, instr_idx, insert_at_idx, takeover, keymap_args, remove_prefix)
-
import one or more phrase presets into instrument
Parameters:
- files (table)
- instr_idx (int)
- insert_at_idx (int) [optional]
- takeover (bool) [optional]
- keymap_args (table), see autoinsertphrase [optional]
- remove_prefix (bool), remove the "090A" prefix [optional]
Returns:
- bool, true when import was succesfull
- string, error message when failed