|
|
|
09-11-2020, 05:23 AM
|
#1
|
Human being with feelings
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
|
The function reaper.CreateNewMIDIItemInProj does not create .MID files
If I activate the "Create new MIDI items as .MID files" setting, then the function CreateNewMIDIItemInProj does not create .MID files in project directory.
|
|
|
09-20-2020, 04:17 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I can confirm that, no MIDI-file is created, unlike the action "Insert new MIDI item...".
In addition to that, when I duplicate the MIDI-items, no additional MIDI-files are created. I would expect that being the case.
|
|
|
09-20-2020, 04:49 PM
|
#3
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Seems reasonable to me as the function's purpose is to create new in project MIDI items (edit: that's what I gather from its name at least, otherwise the function could just have been named "CreateNewMIDIItem") which is disabled via Preferences, so the function does nothing.
edit2:
I think the confusion may come from OP is taking InProj for 'in project directory' but I think it actually refers to 'in project MIDI' (as opposed to .MID files).
edit3:
I can only guess though as the API doc doesn't clarify this.
Last edited by nofish; 09-20-2020 at 05:17 PM.
|
|
|
09-21-2020, 12:02 AM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Not necessarily. The OP set the option, that new Midi items shall be created as modi-files in the prefs.
It's only natural to assume, that this function obeys this setting and creates a new midi item as .mid-file.
It works with the action I mentioned but not in other cases.
I think an optional parameter would help:
integer Create_Mid - 0 or nil, don't create it as midifile, 1, create as midifile, 2, obey preference's setting
|
|
|
09-21-2020, 06:36 AM
|
#5
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Quote:
Originally Posted by Meo-Ada Mespotine
It works with the action I mentioned but not in other cases.
|
But the action doesn't contain the InProj suffix (or a similar wording), unlike the API function, that's the difference imo.
I.e. the action doesn't specify if a new MIDI item should be created as in project MIDI or .MID file, but the API function does (to my understanding), hence it's no-op if the Preference is set to only create MIDI items as .MID files.
|
|
|
09-21-2020, 11:05 AM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
The action obeys the preferences setting which is totally fine.
I think the problem is that, despite the prefs-setting set, certain parts of Reaper do their own stuff. In regards of the function in the OP, there's no chance to insert with it a midi item, that obeys the prefs setting. So you can't insert midi items who are stored as mid-files, despite the setting and you have no alternative to do it via Api, unless you make a hack.
Speaking of which, I have an idea that could help Yanick, thanks to your responses.
|
|
|
09-21-2020, 11:54 AM
|
#7
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Quote:
Originally Posted by Meo-Ada Mespotine
In regards of the function in the OP, there's no chance to insert with it a midi item, that obeys the prefs setting. So you can't insert midi items who are stored as mid-files, despite the setting and you have no alternative to do it via Api, unless you make a hack.
|
I didn't deny that, in fact I fully agree.
But I still think the function behaves correctly in its current form (even if quite limited in functionality, as noted by you), so this would be better suited for feature requests than nitpicks imo.
|
|
|
09-21-2020, 01:49 PM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I agree that this thread should be moved to FR.
|
|
|
09-23-2020, 07:17 AM
|
#9
|
Human being with feelings
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
|
I'm not really using this, I just helped people tune the Reaper, and I accidentally discovered this moment. Because I have been creating the item for a long time using the following script on double click like in Studio one
PHP Code:
reaper.Undo_BeginBlock() reaper.PreventUIRefresh(1) if reaper.GetToggleCommandState(1013) == 0 then local get_track,_,_ = reaper.BR_TrackAtMouseCursor() if get_track then local _, track_name = reaper.GetTrackName(get_track, 0) if track_name ~= "MASTER" then local _, name = reaper.GetSetMediaTrackInfo_String(get_track, 'P_NAME', 0, false) local num_cursor = reaper.BR_PositionAtMouseCursor(true) if num_cursor then local QN_cursor = reaper.TimeMap_timeToQN(num_cursor) local _, measure_start, measure_end = reaper.TimeMap_QNToMeasures(0, QN_cursor) local QN_start = reaper.TimeMap_QNToTime(measure_start) local QN_end = reaper.TimeMap_QNToTime(measure_end) local item_at_cursor = reaper.CreateNewMIDIItemInProj( get_track, QN_start, QN_end, false) reaper.SetMediaItemInfo_Value(item_at_cursor, 'B_LOOPSRC', 0) local take = reaper.GetActiveTake(item_at_cursor) reaper.GetSetMediaItemTakeInfo_String(take, 'P_NAME', name, true) reaper.SetMediaItemSelected(item_at_cursor, 1) end end end end
reaper.Undo_EndBlock('Insert item', -1) reaper.PreventUIRefresh(-1)
Last edited by Yanick; 09-23-2020 at 07:22 AM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:17 AM.
|