Old 08-02-2016, 03:12 PM   #1
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default API features

There are a few features I'd like that are either not in the API, or I just haven't tracked them down yet.

So maybe someone can tell me if they exist.

Is there a command to load a particular VST into a particular slot?
Is there a command to load a particular FXP or FXB to a particular slot?
Is there a command to get the complete list of preset names from a VST?

Thanks!
-eric
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 08-02-2016, 06:49 PM   #2
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

OK re-reading The API, I found the following:

Lua: boolean retval, string programName reaper.EnumTrackMIDIProgramNames(integer track, integer programNumber, string programName)

This looks like if he is able to provide a list of all a vst's program names.

It's a bit confusing that it has Midi in the name....

Doesn't seem to have a means to address a particular slot in the fx chain
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 08-03-2016, 04:21 AM   #3
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,560
Default

Quote:
Originally Posted by woodslanding View Post
Is there a command to load a particular VST into a particular slot?
The closest you'll get is:

integer reaper.TrackFX_AddByName(MediaTrack track, string fxname, boolean recFX, integer instantiate)

Reaper doesn't think in terms of slots the way Pro Tools does - you can't put all your EQs in the third slot, for example, because new plugins are just added to whatever's there.

Some people have used empty JS plugins to fill up their tracks' FX chains and then be able to work as if there were slots, so that's an option for you.

Quote:
Is there a command to load a particular FXP or FXB to a particular slot?
Not that I can see.

Quote:
Is there a command to get the complete list of preset names from a VST?
I imagine it's just giving you the first one, since most people are only going to have one synthesizer per track. If it helps, there's also:

string reaper.HasTrackMIDIPrograms(integer track)

to give you the name of the plugin those programs are for.
__________________
Currently enrolled in a coding bootcamp; don't expect timely responses from me.
Default 5.0 Nitpicky Edition / GUI tutorial for Lua / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate / ReaPack
Lokasenna is offline   Reply With Quote
Old 08-03-2016, 04:53 AM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,527
Default

Quote:
Originally Posted by woodslanding View Post
Is there a command to get the complete list of preset names from a VST?
If I recall right, there's a way to get that. However, it will only work for the standard preset list in the plugins. Many plugins implement their own preset management and Reaper won't be able to do anything with that.

edit : It looks like getting the preset names is going to be painful. It will probably involve switching to each preset in the plugin and getting the current preset name, so it would in some cases be very slow.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 08-03-2016 at 04:58 AM.
Xenakios is online now   Reply With Quote
Old 08-03-2016, 04:14 PM   #5
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default Some Context

Some context:

I'm looking at implementing my live host in REAPER, that's why I ask. Currently I'm using Hollyhock, but it has some serious limitations. Especially that new versions force a complete rewrite of my code. I've done a lot of the work of porting it to MAX, but I'm frustrated by certain limitations in the scripting mechanism. I like the idea of having a full-featured DAW running behind my interface. And MAX is insanely slow to start up. I looked into JUCE, and actually wrote a working program in it, but I think the needs of a complex audio host are well beyond my C++ skills. The (new) reaper scripting engine caught my attention.

My program abstracts out all the different vst patch selecting mechanisms via an 'instrument' construct. The user creates a set of instructions (wrote a gui for it in MAX) that would tell REAPER how to load an instrument.

I like to choose presets from a grid. I use a touchscreen. The model is the POS kiosks at restaurants. I want to give the user (myself) a consistent patch selecting mechanism. What I'm most happy with is a set of buttons for selecting 'instruments' and a set of buttons for selecting presets, with paging buttons for each. There are three methods I want to implement for selecting patches within an instrument:

1. Get the preset list from the VST. This works for Reaktor, Massive and Guitar Rig. This is the ideal method, since it dynamically adapts to adding new presets. I also need to tell some VSTs (such as Reaktor) to load an fxb when an instrument is selected.

2. I've implemented something like Reabanks where I read preset names from a file. Lots of VST developers force me to do this, although I avoid such VSTs, if I can find something similar that implements #1. (usually reaktor.)

3. Instruments like Kontakt require loading an FXP with every preset selection. I have Kontakt FXPs sorted into folders, and MAX gets a list of filenames in a folder (named for the instrument) and populates the grid with those names. When the user selects one, the appropriate FXP is loaded from disk.

So selecting an instrument from a button would need to instruct Reaper to:
1.Load a particular VST on the track (I suppose it could load a whole chain)
2.Sometimes load an FXB for that (the first) VST
3.Sometimes read the preset list from the (first) VST
4.Sometimes read a Reabanks file, or similar, for the particular FXB loaded for that instrument.

Then when a preset button is selected, Reaper would need to be able to:
1.Select the appropriate preset in the VST by number OR
2.Instruct the VST to load an FXP found in a subfolder named after the instrument (I currently have about 300 of these in 16 folders for Kontakt)

There's a lot more the host needs to do, but this part of it seems the most crux-ey to me as I'm looking over the API.


More broadly, my gui currently is hardwired to 12 channels. The preset selection matrix is viewed inspector style, so there is only one. There is an abstraction similar to 'instrument' called 'noteSource' that encapsulates a bunch of things like midi input channel, velocity scaling, and note range into a preset, one of which can be selected for any channel, much like an instrument is.

I can do most of this with JS midi processors (or roll my own) provided I can send them patch changes via script. Ideally I could get a preset list from it as well. The only complication I see with implementing notesource as it exists in MAX is that a notesource also can change the output channel for a track. This is so all instruments being controlled by keyboard 2 can be set to go out output #2, for instance. Or a noteSource called LH Bass Key 1 can be sent out output #3, etc. Not sure if JS plugins can make Reaper API calls. There was a question on the forums about that, and it was not clear what the conclusion was. But it seems like a master script could just call up a JS preset, and also simultaneously change the outputs... so maybe trivial.

I'm pretty tired of graphic development environments like max, and the lua language looks really cool!

So any thoughts on any of this are welcomed....

Thanks,
-eric
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<

Last edited by woodslanding; 08-03-2016 at 04:44 PM.
woodslanding is offline   Reply With Quote
Old 08-03-2016, 04:52 PM   #6
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

Quote:
Originally Posted by woodslanding View Post
OK re-reading The API, I found the following:

Lua: boolean retval, string programName reaper.EnumTrackMIDIProgramNames(integer track, integer programNumber, string programName)

This looks like it is able to provide a list of all a vst's program names.
So what DOES this method do?? Anybody know?
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 08-04-2016, 06:04 PM   #7
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

I note that REAPER itself populates the dropdown menu above a vst in the FX window with all the FXs presets, without having to select each one. So the program itself implements this functionality.

Should be fairly easy to assign it to an API command..... ??

Also, there are commands for importing and exporting fxbs and fxps in the menu to the right... they work perfectly, if I could only script them!
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 08-05-2016, 12:44 PM   #8
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

Okay, I tried this code:

Code:
local function getPresetName(trackidx, presetidx)
  local val, name = reaper.EnumTrackMIDIProgramNames(trackidx, presetidx, "what goes here?")
  reaper.ShowConsoleMsg("name = " .. name)
  return name
end

getPresetName(0,0)
getPresetName(1,1)
There is a vst on track 2, which has 128 programs with names. Of course I'm not at all sure that matters, since I don't know that's what this does anyway.

This method just returns whatever I put in for presetName. Why would a method that is supposed to return a preset name require one on input?

confused....

Also, I'm wondering if an enum function needs to be called or used in a different way??
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<

Last edited by woodslanding; 08-05-2016 at 12:52 PM.
woodslanding is offline   Reply With Quote
Old 08-12-2016, 01:04 AM   #9
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

Just a bump....

Can anybody tell me what this method does and/or how to use it??

reaper.EnumTrackMIDIProgramNames

Thanks,
-eric
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 08-21-2016, 08:01 AM   #10
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

Can somebody at least explain to me how to use it so I can figure out what it does?
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 09-05-2016, 09:45 PM   #11
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

alright, seems like this is a dead-end... maybe I'll check back in a year or so.
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 09-06-2016, 03:28 AM   #12
moss
Human being with feelings
 
moss's Avatar
 
Join Date: Mar 2007
Location: Germany
Posts: 209
Default

Since I like your idea I did some experiments.

From my understanding the EnumTrackMIDIProgramNames should return the programs used in a midi clip (e.g. a loaded midi file) and/or from a ReaControlMIDI plugin. But it always returns 0. It seems to me that this function is simply broken.

Then I experimented with the preset functions, which seem also to be largely broken (or I just do not understand what they should do). I tested both with a VST and a Cockos plugin.
The only function which works reliably is TrackFX_GetPreset.

Test code in EEL:

project = 0;
track = GetTrack (project, 0);

fx = 0;
result = TrackFX_GetPreset (track, fx, programName);
index = TrackFX_GetPresetIndex(track, fx, numberOfPresetsOut);

ShowMessageBox (sprintf (#, "%d - %d (of %d): %s\n", result, index, numberOfPresetsOut, programName),"Result", 0);

// result = TrackFX_NavigatePresets (track, fx, 1);

result = TrackFX_SetPresetByIndex (track, fx, 5);


(result > 0) ?
(
result = TrackFX_GetPreset (track, fx, programName);
index = TrackFX_GetPresetIndex(track, fx, numberOfPresetsOut);

ShowMessageBox (sprintf (#, "%d - %d (of %d): %s\n", result, index, numberOfPresetsOut, programName),"Result", 0);
);
moss is offline   Reply With Quote
Old 11-02-2016, 03:14 PM   #13
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

Well, now this is frustrating.

Is there nobody who knows what this code does, and how to make it do it?
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<
woodslanding is offline   Reply With Quote
Old 01-05-2019, 08:48 PM   #14
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 265
Default

BUMP???

Does anybody know what we have been doing wrong in trying to get this feature to work? (Screaming year in and year out to an unfeeling universe....)

Actually looking at how long and invovled (and old) this thread is, I'm going to start a fresh one....
__________________
e moon
http://ericmoonmusic.com
>>{ Very Stable Genius }<<

Last edited by woodslanding; 01-05-2019 at 08:53 PM.
woodslanding is offline   Reply With Quote
Reply

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:27 AM.


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