Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Thread Tools Display Modes
Old 06-15-2019, 04:16 PM   #1
Kostik Vento
Human being with feelings
Join Date: Nov 2013
Location: Yekaterinburg, Russia
Posts: 11
Default [Reascript] CreateNewMIDIItemInProj seems to misinterpret qnIn parameter

CreateNewMIDIItemInProj's docs state that the last parameter qnIn indicates whether parameters start and end are in seconds (qnIn=false) or beats (qnIn=true).

In fact it behaves in a strange manner. The code that follows is supposed to create two items on different tracks:

reaper.InsertTrackAtIndex(0, false)
reaper.InsertTrackAtIndex(1, false)

t1 = reaper.GetTrack(0, 0)
t2 = reaper.GetTrack(0, 1)

reaper.CreateNewMIDIItemInProj(t1, 0, 7, false)
reaper.CreateNewMIDIItemInProj(t2, 3, 7, true)
The first tracks's item should start at second 3, and end at second 7 beind 4 seconds long.
The second track's item should start at beat 3, and end at beat 7 being 4 beats long.

What actually does this script do? The first item is ok.
The second tracks's item starts at second 3, ends at second 7, beind 4 seconds long!
The difference is that the second item's loop is just 4 beats long!

It is even better visible if we start off second 0, and try to insert 8 beats:

reaper.CreateNewMIDIItemInProj(t1, 0, 8, false)
reaper.CreateNewMIDIItemInProj(t2, 0, 8, true)
Second item's length is 8 seconds, but the loop mark is right at beat 8.

P.S. The Python version behaves the same way (actually, I run into the bug playing exactly with Python API).
P.P.S. The setting Loop source for new MIDI items in REAPER Preferences -> Project -> Media Item Defaults does not affect MIDI items created via Reascript (( They're always looped.
P.P.P.S. REAPER 5.978 on Mac OS Sierra 10.12.6 (16G2016).
Kostik Vento is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 07:50 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.