From 30e635ab83cbc92ddb0ec5b4740fd33c48b199cb Mon Sep 17 00:00:00 2001 From: Zly Date: Sat, 25 May 2024 22:53:32 +0300 Subject: [PATCH] Fixed weird track creation for generated MIDI. --- MIDI/Items_To_MIDI/Zly_Items_To_MIDI.lua | 4 ++-- MIDI/meta_Items_To_MIDI.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MIDI/Items_To_MIDI/Zly_Items_To_MIDI.lua b/MIDI/Items_To_MIDI/Zly_Items_To_MIDI.lua index e848f36..264b1b7 100644 --- a/MIDI/Items_To_MIDI/Zly_Items_To_MIDI.lua +++ b/MIDI/Items_To_MIDI/Zly_Items_To_MIDI.lua @@ -11,8 +11,8 @@ function main() local track = reaper.GetMediaItemTrack(first_item) local _, track_name = reaper.GetTrackName(track) local track_index = reaper.GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER") - reaper.InsertTrackAtIndex(track_index+1, true) - local new_midi_track = reaper.GetTrack(0, track_index+1) + reaper.InsertTrackAtIndex(track_index, true) + local new_midi_track = reaper.GetTrack(0, track_index) reaper.GetSetMediaTrackInfo_String(new_midi_track, "P_NAME", track_name..(track_name ~= "" and "_" or "").."MIDI", true) -- Create MIDI item diff --git a/MIDI/meta_Items_To_MIDI.lua b/MIDI/meta_Items_To_MIDI.lua index b905349..01797ff 100644 --- a/MIDI/meta_Items_To_MIDI.lua +++ b/MIDI/meta_Items_To_MIDI.lua @@ -2,7 +2,7 @@ @metapackage @description Items -> MIDI @author Zly -@version 1.0.1 +@version 1.0.2 @provides [main] .\Items_To_MIDI\Zly_Items_To_MIDI.lua @about @@ -10,5 +10,5 @@ - Creates MIDI based on selected items pitches. @changelog - - Fixed the script sometimes providing non integer values to note creation functions. + - Fixed weird track creation for generated MIDI. --]] \ No newline at end of file