@@ -95,11 +95,11 @@ local function loop()
9595 reaper .ImGui_PushFont (ctx ,font )
9696 reaper .ImGui_PushStyleColor (ctx ,reaper .ImGui_Col_WindowBg (),0x222222FF )
9797
98- local drumTrack = getDrumbruteTrack ()
99- local patternCount = reaper .CountTrackMediaItems (drumTrack )
98+ local sequencerTrack = getSequencerTrack ()
99+ local patternCount = reaper .CountTrackMediaItems (sequencerTrack )
100100
101101 currentPatternIndex = math.min (currentPatternIndex or 1 , patternCount );
102- local currentPattern = getPattern (drumTrack , currentPatternIndex - 1 )
102+ local currentPattern = getPattern (sequencerTrack , currentPatternIndex - 1 )
103103
104104 if currentPattern then
105105 -- top bar
@@ -158,7 +158,7 @@ local function loop()
158158 end
159159
160160 if addedPattern then
161- createPattern (currentPattern .steps > 0 and currentPattern .steps or 16 )
161+ createPattern (sequencerTrack , currentPattern .steps > 0 and currentPattern .steps or 16 )
162162 changedPattern = true
163163 if followCursor then
164164 currentPatternIndex = patternCount + 1
@@ -167,7 +167,7 @@ local function loop()
167167
168168 -- Jump to step
169169 if changedPattern and followCursor then
170- currentPattern = getPattern (drumTrack , currentPatternIndex - 1 )
170+ currentPattern = getPattern (sequencerTrack , currentPatternIndex - 1 )
171171 jumpToStep (currentPattern .item , 0 )
172172 end
173173
@@ -180,26 +180,26 @@ local function loop()
180180 end
181181 resizeItem (currentPattern .item , currentPattern .times )
182182 if ripple then
183- rippleFollowingItems (drumTrack , currentPattern .item , originalLength )
183+ rippleFollowingItems (sequencerTrack , currentPattern .item , originalLength )
184184 end
185185 reaper .Undo_EndBlock (' Resize pattern' ,- 1 )
186186 end
187187
188188 -- Change time selection
189189 if changedPattern or changedLoopPatternOption or changedLoopSongOption or changedSteps or changedTimes then
190- currentPattern = getPattern (drumTrack , currentPatternIndex - 1 )
190+ currentPattern = getPattern (sequencerTrack , currentPatternIndex - 1 )
191191 if loopPattern then
192192 setTimeSelectionFromItem (currentPattern .item )
193193 elseif loopSong then
194- setTimeSelectionFromTrack (drumTrack )
194+ setTimeSelectionFromTrack (sequencerTrack )
195195 end
196196 end
197197
198198 -- Follow cursor
199- local itemIndexAtCursor = getItemIndexAtCursor (drumTrack )
199+ local itemIndexAtCursor = getItemIndexAtCursor (sequencerTrack )
200200 if followCursor and itemIndexAtCursor and itemIndexAtCursor ~= currentPatternIndex - 1 then
201201 currentPatternIndex = itemIndexAtCursor + 1
202- currentPattern = getPattern (drumTrack , currentPatternIndex - 1 )
202+ currentPattern = getPattern (sequencerTrack , currentPatternIndex - 1 )
203203 end
204204
205205 reaper .ImGui_Separator (ctx )
@@ -211,7 +211,7 @@ local function loop()
211211
212212 reaper .ImGui_PushStyleVar (ctx , reaper .ImGui_StyleVar_ItemSpacing (), 2 , 2 ) -- (x,y)
213213
214- reaper . ImGui_Image (ctx , images .Channel_button_on . i , images . Channel_button_on . w , images . Channel_button_on . h )
214+ drawTrackLabel (ctx , images .Channel_button_on , " Sequencer " )
215215 for s = 1 , currentPattern .steps do
216216 reaper .ImGui_SameLine (ctx )
217217 local isCurrent = currentStep and s == currentStep
@@ -243,15 +243,7 @@ local function loop()
243243 local sprite = selected and images .Channel_button_on
244244 or images .Channel_button_off
245245
246- reaper .ImGui_Image (ctx , sprite .i , sprite .w , sprite .h )
247-
248- local minX ,minY = reaper .ImGui_GetItemRectMin (ctx )
249- local maxX ,maxY = reaper .ImGui_GetItemRectMax (ctx )
250- local tw ,th = reaper .ImGui_CalcTextSize (ctx , trk .name )
251- local cx = (minX + maxX - tw ) * 0.5
252- local cy = (minY + maxY - th ) * 0.5
253- local dl = reaper .ImGui_GetWindowDrawList (ctx )
254- reaper .ImGui_DrawList_AddText (dl , cx , cy , 0xFFFFFFFF , trk .name )
246+ drawTrackLabel (ctx , sprite , trk .name )
255247 reaper .ImGui_SameLine (ctx )
256248
257249 for s = 1 , currentPattern .steps do
@@ -288,7 +280,7 @@ local function loop()
288280 reaper .ImGui_Text (ctx , " Add a pattern to start" )
289281 reaper .ImGui_SameLine (ctx )
290282 if reaper .ImGui_Button (ctx , " Add Pattern" ) then
291- createPattern (16 )
283+ createPattern (sequencerTrack , 16 )
292284 currentPatternIndex = 1
293285 end
294286 end
0 commit comments