Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: request to find the slot number ?

This topic is old and might contain outdated or incorrect information.

Is there any request with GetInfo to find the slot number of a plugin ?
 

Posted Sun 04 Oct 20 @ 12:29 pm
locodogPRO InfinityModeratorMember since 2013
No, I've asked this before, I worked around this by querying the fx name against the effect selected in each slot.
 

Posted Sun 04 Oct 20 @ 1:35 pm
NicotuxHome userMember since 2014
No there is not !
In fact the slot number is not something to take care about:
- plugins can be loaded even out of in any slot
- plugin can go to many slot at any time
- plugin instance can only be one per bus, (this can enable a plugin two times on a deck by the use of release bus)
- plugin can stay in many slots simultaneously

of course it is now the possiblility to get some "slot" by iterating "get_effect_name <slot>" and using "get_effects_used" but :
- depending on "bus" there are are not the same number of slots
- depending on load order and location, there may not be any slot (autostart)
- plugin can load out of slot

What is missing is the plugin order

What is really important (and often missing) is the bus:
- Master, Master release, Deck n, Deck n release, mic, mic release, sampler, aux, aux release, mixfx, colorfx, video fx, audiovisualisation...

The verb "get_plugindeck" can be used for that but in AND ONLY IN OnGetPluginInfos() after what it returns dummy

Here is an extract of what i use to get the "real location" of a plugin:

/** Detect the real deck the plugin was loaded on */
inline int detect_deck() {
return (MyDeck = nan("")) ? (GetInfo("get_plugindeck", &MyDeck) == S_OK) ? (int)MyDeck : MININT : (int)MyDeck;
}

/** Try to detect the bus type the plugin was loaded on Live/Release/Source only, audio/video only sometimes detectable */
int detect_bus(int deck) {
double query = nan("");
return (
(GetInfo("is_releasefx ? true : false", &query) != S_OK ? MININT : (query ? FX_BUS_RELEASE : 0)) |
(GetInfo("is_audioonlyvisualisation ? true : false", &query) != S_OK ? MININT : (query ? FX_BUS_V_SOURCE | FX_BUS_VIDEO : 0)) |
(GetInfo("is_colorfx ? true : false", &query) != S_OK ? MININT : (query ? FX_BUS_COLORFX : 0))
);
}

/** construct the Full qualified deck name [[deck <deck>|Master|Mic|Sampler][_[Audio|Colorfx|Video]]|unknown] */
// Only usable to display Name or external settings
std::string deck_name(int deck, int bus = MININT) {
std::stringstream dk;
dk << ((deck > 0) ? "Deck " + std::to_string((int)deck)
: ((deck >= -3) ? std::array <std::string, 4> { "Master", "Sampler", "Mic", "Aux" }.at(-(int)deck)
: "unknown" + std::to_string(deck))
);
if (bus != MININT && bus >= 0)
dk << (bus & FX_BUS_RELEASE ? "_Release" : "")
<< (bus & FX_BUS_VIDEO ? (bus & FX_BUS_V_SOURCE ? "_VSource" : "_Video")
: (bus & FX_BUS_COLORFX ? "_Colorfx" : "_Audio"));
return dk.str();
}


Because bus number can be negative, positive or null, i use MININT to specify bus as unknown yet
 

Posted Sun 04 Oct 20 @ 1:35 pm
ok. Thank you for your answers and your ideas !

Deun
 

Posted Sun 04 Oct 20 @ 3:17 pm
locodogPRO InfinityModeratorMember since 2013
question; why do you need to know the slot, there are for sure reasons, I'm interested to know.
 

Posted Sun 04 Oct 20 @ 5:38 pm
You'll see in my next plugins ;-)
 

Posted Sun 04 Oct 20 @ 6:00 pm
The idea is to load a pad file according to slot : plugin loaded on slot 2, corresponding pad file loaded on page 2.

To find the slot number, I tested the program below but it doesn't work.
Tried in HRESULT VDJ_API CMyPlugin8::OnGetPluginInfo(TVdjPluginInfo8* infos) and tried in HRESULT VDJ_API CMyPlugin8::OnLoad()

The problem is when I load the plugin (called essai01) in slot 2 for example, at that time, the name of the plugin isn't essai01 in slot 2, but the name of the previous plugin in slot 2 (replaced by essai01).
for instance : in slot 2 there is BeatGrid plugin. I load my plugin essai01 in slot2. GetStringInfo("get_effect_name 1", EffectFind, 50) returns BeatGrid.

char NameFX[50], EffectFind[50];
sprintf(NameFX, "essai01");

int nbSlotScan = 3;
for (int k = 1; k <= nbSlotScan; k++)
{
if (k == 1)
{
GetStringInfo("get_effect_name 1", EffectFind, 50);
}
else if (k == 2)
{
GetStringInfo("get_effect_name 2", EffectFind, 50);
}
else //if (k == 3)
{
GetStringInfo("get_effect_name 3", EffectFind, 50);
}

if ((strcmp(NameFX, EffectFind)))
{
intSlot = k;
break;
}
}

 

Posted Mon 05 Oct 20 @ 1:33 pm
locodogPRO InfinityModeratorMember since 2013
you could use a repeat_start script to give vdj a second to catch up,
SendCommand("repeat_start 'smallDelay1' 100ms 1 & param_equal `get_effect_name` `get_effect_name 1` ? pad_page 1 'essai01page' : param_equal `get_effect_name` `get_effect_name 2` ? pad_page 2 'essai01page' : param_equal `get_effect_name` `get_effect_name 3` ? pad_page 3 'essai01page' : ");

There's likely smarter ways, but it's a way.
What happens if the fx isn't called to a slot, what then? :P
 

Posted Mon 05 Oct 20 @ 7:02 pm
there is a load of pad page only if the plugin is loaded in slot 1 to 3.
 

Posted Tue 06 Oct 20 @ 7:01 am
I've just tried the repeat_start but it doesn't work :-(
 

Posted Tue 06 Oct 20 @ 7:38 pm
locodogPRO InfinityModeratorMember since 2013
Ah yeah, I see where I went wrong, in the script you could compare as a string instead, switch out
`get_effect_name`
to
'yourFXname'
 

Posted Tue 06 Oct 20 @ 8:29 pm
NicotuxHome userMember since 2014
change account, for more lisibility
 

Posted Wed 07 Oct 20 @ 2:49 am
1) if (strcmp(NameFX, EffectFind) ) ... will 0 if true ... when they do not match, script won't work
to be good : if (!strcmp(NameFX, EffectFind) )...

2) BUT...

Slot concept is something VDJ have lost with v8
there are too many way to load fx where they never appear anywhere or no slot ^^:
script, release, aux, sampler, mic, master, mixfx, autostart, colorfx, videofx, audioonlyvisualization, transition...
- 1 2 or 3 slots at a times can display the same fx (but only the same instance as opposite with v7)
- display slot can change at anytime
- fx can run out of a visible slot, out of a saved slots (not registered in setting -> controls -> effects or masterEffects)
- only 7 slots per decks are saved for Effects and 9 for masterEffects but only 3 expose as "slots"
- slot can display anything as long as it registrer as an addon (bugs in chain with selectors...)
- same name, other folder, VDJ selects the first one encountered (even it is not right type)

only relevant in a skin for what it shows (with related selection issues)

loop script may work in some specific situations
when loop script gives answer back, it can already be obsolete...

getting the 3 names, and testing is only relevant in deck click button situation
all other cases will never work
- there are not 3 slots
- effect can be out of a slot - multieffects > 3 is preventing all effects to appear on a slot


3) other thing : VDJ can handle strings :


for (int k = 1; k <= nbSlotScan; k++)
{
double res;
sprintf_s(EffectFind, outParamSize, "get_effect_name %d & param_cast text & param_equal '%s'", k, NameFX);
if (GetInfo(EffectFind, &res) == S_OK) {
if ( res != 0 ) {
intSlot = k;
break;
}
} else {
// here, either the deck or the slot are irrelevant or something goes wrong
}
}

 

Posted Wed 07 Oct 20 @ 2:52 am
Tried all your ingenious proposals but it doesn't work.

I even simulated an activation of the plugin, a search for the slot followed by an activation stop, but nothing to do... it doen't find the slot number.
 

Posted Sat 10 Oct 20 @ 11:23 am
locodogPRO InfinityModeratorMember since 2013
[really] crap code but it works

void whichSlot()
{
GetStringInfo("get_effect_name", &me[0], 32);
std::stringstream cmd1;
cmd1 << "param_equal \"`get_effect_name 1`\" \"" << me << "\"";
GetInfo(cmd1.str().c_str(), &slotInfo);
if (slotInfo == 1) { slot = 1; }
else
{
std::stringstream cmd1;
cmd1 << "param_equal \"`get_effect_name 2`\" \"" << me << "\"";
GetInfo(cmd1.str().c_str(), &slotInfo);
if (slotInfo == 1) { slot = 2; }
else
{
std::stringstream cmd1;
cmd1 << "param_equal \"`get_effect_name 3`\" \"" << me << "\"";
GetInfo(cmd1.str().c_str(), &slotInfo);
if (slotInfo == 1) { slot = 3; }
else
{
std::stringstream cmd1;
cmd1 << "param_equal \"`get_effect_name 4`\" \"" << me << "\"";
GetInfo(cmd1.str().c_str(), &slotInfo);
if (slotInfo == 1) { slot = 4; }
else slot = 0;
}
}
}
}
 

Posted Sat 10 Oct 20 @ 12:04 pm


(Old topics and forums are automatically closed)