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

Commit

Permalink
- xLib: use xPatternSequencer methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn-nesby committed Jul 12, 2018
1 parent 285f005 commit 9a695db
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions classes/xCursorPos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cLib.require(_xlibroot.."xLine")
cLib.require(_xlibroot.."xTrack")
cLib.require(_xlibroot.."xColumns")
cLib.require(_xlibroot.."xPatternPos")
cLib.require(_xlibroot.."xPatternSequencer")

---------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -73,8 +74,7 @@ function xCursorPos:resolve()
return nil, "Line index is out of bounds"
end

local patt_idx = rns.sequencer:pattern(self.sequence)
local patt = rns.patterns[patt_idx]
local patt, patt_idx = xPatternSequencer.get_pattern_at_index(self.sequence)
if not patt_idx then
return nil, "Could not resolve pattern"
end
Expand Down
5 changes: 2 additions & 3 deletions classes/xLine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ See also:

--=================================================================================================

--require(_xlibroot.."xLinePattern")
cLib.require(_xlibroot.."xLinePattern")
cLib.require(_xlibroot.."xPatternSequencer")

---------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -288,8 +288,7 @@ end

function xLine.resolve_pattern_line(sequence,line,track_idx)

local patt_idx = rns.sequencer:pattern(sequence)
local rns_patt = rns.patterns[patt_idx]
local rns_patt,patt_idx = xPatternSequencer.get_pattern_at_index(sequence)
local rns_track = rns.tracks[track_idx]
assert(rns_patt,"The specied track does not exist")
local rns_ptrack = rns_patt.tracks[track_idx]
Expand Down
9 changes: 7 additions & 2 deletions classes/xPatternSelection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Static methods for working with pattern-selections
]]

--=================================================================================================

cLib.require(_xlibroot.."xPatternSequencer")

---------------------------------------------------------------------------------------------------

class 'xPatternSelection'

-------------------------------------------------------------------------------
Expand All @@ -34,8 +40,7 @@ class 'xPatternSelection'
function xPatternSelection.get_pattern_track(seq_idx,trk_idx)
TRACE("xPatternSelection.get_pattern_track(seq_idx,trk_idx)",seq_idx,trk_idx)

local patt_idx = rns.sequencer:pattern(seq_idx)
local patt = rns.patterns[patt_idx]
local patt,_patt_idx = xPatternSequencer.get_pattern_at_index(seq_idx)
local track = rns.tracks[trk_idx]
if not patt or not track then
return false, "Could not locate track or pattern"
Expand Down
3 changes: 1 addition & 2 deletions classes/xStreamBuffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,7 @@ end
function xStreamBuffer:resolve_automation(seq_idx)
TRACE("xStreamBuffer:resolve_automation(seq_idx)",seq_idx)

local patt_idx = rns.sequencer:pattern(seq_idx)
local patt = rns.patterns[patt_idx]
local patt,_patt_idx = xPatternSequencer.get_pattern_at_index(seq_idx)
if not patt then
LOG("*** xStreamBuffer:resolve_automation - Could not find pattern")
return
Expand Down
9 changes: 6 additions & 3 deletions classes/xTrack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Static Methods for working with renoise.Track objects

--=================================================================================================

cLib.require(_xlibroot.."xPatternSequencer")

---------------------------------------------------------------------------------------------------

class 'xTrack'

---------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -320,11 +324,10 @@ end
function xTrack:get_pattern_track(seq_idx,trk_idx)
TRACE("xTrack:get_pattern_track(seq_idx,trk_idx)",seq_idx,trk_idx)

local patt_idx = rns.sequencer:pattern(seq_idx)
if not patt_idx then
local patt = xPatternSequencer.get_pattern_at_index(seq_idx)
if not patt then
return false,"Could not locate pattern"
end
local patt = rns.patterns[patt_idx]
local ptrack = patt:track(trk_idx)
if not ptrack then
return nil,"Could not locate pattern-track"
Expand Down
8 changes: 3 additions & 5 deletions classes/xVoiceRunner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ See also:

cLib.require (_xlibroot.."cTable")
cLib.require (_xlibroot.."xPatternSelection")
cLib.require (_xlibroot.."xPatternSequencer")
cLib.require (_xlibroot.."xNoteColumn")

---------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -214,8 +215,7 @@ function xVoiceRunner:collect(ptrack_or_phrase,collect_mode,selection,trk_idx,se
local num_lines,visible_note_columns,vol_visible,pan_visible,dly_visible
if collecting_from_pattern then
local track = rns.tracks[trk_idx]
local patt_idx = rns.sequencer:pattern(seq_idx)
local patt = rns.patterns[patt_idx]
local patt,_patt_idx = xPatternSequencer.get_pattern_at_index(seq_idx)
num_lines = patt.number_of_lines
visible_note_columns = track.visible_note_columns
vol_visible = track.volume_column_visible
Expand Down Expand Up @@ -596,9 +596,7 @@ function xVoiceRunner:collect_below_cursor()
local ptrack_or_phrase = rns.selected_pattern_track
local col_idx = rns.selected_note_column_index
local line_idx = rns.selected_line_index
local seq_idx = rns.selected_sequence_index
local patt_idx = rns.sequencer:pattern(seq_idx)
local patt = rns.patterns[patt_idx]
local patt,_patt_idx = xPatternSequencer.get_pattern_at_index(rns.selected_sequence_index)

self:reset()
self:collect(ptrack_or_phrase,xVoiceRunner.COLLECT_MODE.CURSOR)
Expand Down

0 comments on commit 9a695db

Please sign in to comment.