|
|
|
01-05-2019, 09:02 PM
|
#1
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
How to use EnumTrackMIDIProgramNames?
Does anybody know? From the docs:
boolean retval, string programName = reaper.EnumTrackMIDIProgramNames(integer track, integer programNumber, string programName)
I'm assuming it would get the preset list for an FX, although there is not a setting for which fx slot to check.... so maybe not?
It says "returns false if there are no plugins on the track that support MIDI programs,or if all programs have been enumerated". So maybe this means it gets all the programs for all the fx in the chain on that track that support it, indiscriminately? I guess that's okay, as I can limit myself to one such vst per track.
I tried:
retval, programName = reaper.EnumTrackMIDIProgramNames( track, programNumber, programName )
But retval always returns FALSE, even when there is an fx with programs on the track.
Just wondering if anybody has a piece of sample code using it that I could dissect....
Thanks in Advance!
-eric
Last edited by woodslanding; 01-05-2019 at 11:35 PM.
|
|
|
01-08-2019, 04:01 AM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
use a while loop like
Quote:
track = reaper.GetSelectedTrack(0,0) -- Get first selected track, you can put that into a track loop too
programNumber = 0 -- First index
retval = true -- Start loop
while retval then
retval, programName = reaper.EnumTrackMIDIProgramNames( track, programNumber, '' )
programNumber = programNumber + 1
if retval then
-- DO WHAT YOU WANT HERE
end
end -- this will stop once there is no value returned
|
(not tested bu you get the idea)
|
|
|
01-08-2019, 10:26 PM
|
#3
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
definitely not tested
The method is looking for a track number, not a track! Which seems strange, as all similar methods take a track....
Problem I'm having is that retval always returns false, even when there is a vst with midi programs on the track (programs that are showing up just fine in the dropdown menu, and successfully addressed with MPL's script.) This is the part I don't understand.
It also seems an odd limitation to me that it does not ask for an fx slot, and will only furnish programs for the 1st fx that supports them. I put my compliant fx in the first slot, but even then the method returns false.
It could well be the method is broken. I can find 0 examples of anybody using it ever, but I wanted to make sure it wasn't my ignorance before filing a bug report.
Here is my code:
Code:
-- Console Message
function Msg(g)
reaper.ShowConsoleMsg(tostring(g).."\n")
end
Msg('in action')
--track = reaper.GetSelectedTrack(0,0) -- Get first selected track, you can put that into a track loop too
--method needs a track number, not a track?
local _, track, _, fx_id = reaper.GetFocusedFX()
--track = 3;
programNumber = 0 -- First index
Msg('track = '..track)
retval = true -- Start loop
while retval
do
retval, programName = reaper.EnumTrackMIDIProgramNames( track, programNumber, '' )
programNumber = programNumber + 1
if retval then
Msg(programNumber..programName)
else Msg('retval is false')
end
end -- this will stop once there is no value returned
Thanks for your help!
Last edited by woodslanding; 01-08-2019 at 10:45 PM.
|
|
|
01-12-2019, 02:10 PM
|
#4
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Okay.... Guess I'll file that bug report.
|
|
|
01-13-2019, 06:20 AM
|
#5
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
I think that function is only meant for use with a virtual instrument plugin that is first in the track's FX chain.
There is a painful way to enumerate the preset names of any effect that involves going through all the presets one by one (making the plugin load the preset, which can take a considerable time) and then getting the name of the current preset.
edit : code to do it that way :
Code:
local track = reaper.GetTrack(0,0)
local fxindex = 2
local retval, numberOfPresets = reaper.TrackFX_GetPresetIndex(track, fxindex)
for i=0,numberOfPresets-1 do
reaper.TrackFX_SetPresetByIndex(track, fxindex, i)
local retval, presetname = reaper.TrackFX_GetPreset(track, fxindex, "")
reaper.ShowConsoleMsg(presetname.."\n")
end
This is certainly not optimal, not only because it needs to change the actual preset in the plugin as many times as there are presets, but it also of course leaves the plugin's state at the last available preset.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Last edited by Xenakios; 01-13-2019 at 07:16 AM.
|
|
|
01-17-2019, 08:10 PM
|
#6
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
And it crashes reaper under Guitar Rig, and probably any other vsts that take time to change presets!
But whatever the original method is supposed to do, it doesn't work. I did try with a vsti plugin in the first slot (not ideal, as I need a midi processing plugin in the first slot), and it still didn't work.
Last edited by woodslanding; 01-17-2019 at 08:18 PM.
|
|
|
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 11:40 AM.
|