Skip to content

Commit

Permalink
Merge branch 'MIDI/MIDI_To_Items'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zly-u committed Feb 17, 2024
2 parents a1bb469 + 4975d45 commit 93be0e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions MIDI/MIDI_To_Items/Zly_MIDI_To_Items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ function M2I:ProcessMIDI(midi_take)
local current_chords_list
local current_chord

if current_note == nil then goto skip end
if current_note == nil then goto skip_filtered_note end

current_channel = self.chords_channels[current_note.channel]
current_chords_list = current_channel.chords
Expand Down Expand Up @@ -519,9 +519,9 @@ function M2I:ProcessMIDI(midi_take)

::skip::
self.widget.midi_notes_read = self.widget.midi_notes_read + 1
::skip_filtered_note::
end


-- Sort chords and assign base pitch
for channel_index, chords_channel in pairs(self.chords_channels) do
if #chords_channel.chords == 0 then goto skip_sort_for_empty end
Expand Down Expand Up @@ -557,7 +557,7 @@ function M2I:ProcessMIDI(midi_take)

--[[============================================]]--
--[[============================================]]--
---[=[

-- Search for a free spot in tracks for each Note Item
self.n_channels = 0
for channel_index, chords_channel in pairs(self.chords_channels) do -- [1, 16]
Expand Down Expand Up @@ -646,7 +646,6 @@ function M2I:ProcessMIDI(midi_take)
end
end
end

return true
end

Expand Down Expand Up @@ -871,15 +870,20 @@ function M2I:LoadSelectedMIDI()

local item_count = reaper.CountSelectedMediaItems()
if item_count == 0 then
reaper.MB("No MIDI was selected", "Error", 0)
reaper.MB("No MIDI Item was selected on the timeline!", "Error", 0)
return nil
end

if item_count > 1 then
reaper.MB("Select only one Item!", "Error", 0)
return nil
end

local midi_item = reaper.GetSelectedMediaItem(0, 0)
local midi_take = reaper.GetActiveTake(midi_item)

if not reaper.TakeIsMIDI(midi_take) then
reaper.MB("The selected Item is not a MIDI", "Error", 0)
reaper.MB("The selected Item is not a MIDI Item.", "Error", 0)
return nil
end

Expand Down
4 changes: 2 additions & 2 deletions MIDI/meta_MIDI_To_Items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@metapackage
@description MIDI To Items Converter
@author Zly
@version 2.4.1
@version 2.4.2
@provides
[main] .\MIDI_To_Items\Zly_MIDI_To_Items.lua
@about
Expand All @@ -24,5 +24,5 @@
@donation
Donate https://boosty.to/zly
@changelog
- Forgot to add the redirection to the ReaPack's Website if the user doesn't have one lol.
- Made the MIDI error message more obvious.
--]]

0 comments on commit 93be0e1

Please sign in to comment.