free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.77k stars 100 forks source link

Clarify whether port stable indices must be unique between input and output ports or if they may be reused #125

Closed robbert-vdh closed 2 years ago

robbert-vdh commented 2 years ago

In places like this:

https://github.com/free-audio/clap/blob/55ee06f776669b94d63247a9c1dcb7dfa6056587/include/clap/ext/audio-ports.h#L43

Can you have both an input port with ID 400 and output port with ID 400?

abique commented 2 years ago

I think it is easy to ensure for the plugin that they won't overlap: just set a bit in the id to indicate input or output. But even if they overlap that should not be a problem because they belong to different space.

abique commented 2 years ago

I think that the host always have the context (input/output) when looking at ports.

robbert-vdh commented 2 years ago

I'm also making sure they don't overlap in my own plugins, but I was curious about this within the context of clapval. Right now it throws all of a plugin's audi port IDs in a single hashset to check for collisions. In theory there should be no problem when the input and output sides share the same IDs, but the docs don't mention this, and I can see some hosts also being confused when the IDs are shared between input and output ports. Hence why I thought this might need some more clarification.

abique commented 2 years ago

I think you should have distinct collections for input ports and output ports.

abique commented 2 years ago

My point is that if you should do getPortInfoById(isInput, portId).