Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json: faust generates duplicate shortname for bargraph used multiple times #1100

Closed
crop2000 opened this issue Dec 26, 2024 · 6 comments
Closed

Comments

@crop2000
Copy link
Contributor

in the following example the bargraph is used twice.
faust identifies that the name is used twice and prefixes the shortname with P1_ but it uses the same prefix for both shortnames.
i expect that short names are unique.

declare name "VolumeControl";

import("stdfaust.lib");

process(l,r) =  (l : meter_l), (r : meter_r) with {
        left_vol =  vbargraph("left",0,1);
        meter_l(l) = attach(l, l : abs  : left_vol );
        meter_r(r) = attach(r, r : abs  : left_vol );
    
};
	"ui": [
		{
			"type": "vgroup",
			"label": "VolumeControl",
			"items": [
				{
					"type": "vbargraph",
					"label": "left",
					"varname": "fVbargraph0",
					"shortname": "P1_VolumeControl_left",
					"address": "/VolumeControl/left",
					"min": 0,
					"max": 1
				},
				{
					"type": "vbargraph",
					"label": "left",
					"varname": "fVbargraph1",
					"shortname": "P1_VolumeControl_left",
					"address": "/VolumeControl/left",
					"min": 0,
					"max": 1
				}
			]
		}
	]

I am on master-dev.
But the problem has not been introduced by recent changes.
It is also present in 2.74...

@sletz
Copy link
Member

sletz commented Dec 26, 2024

This is actually a "feature", see here:

const std::string& insertInputsPath(const std::string& path)

and
const std::string& insertOutputsPath(const std::string& path)

I'll add something in the FAQ ASAP.

Look also at: https://faustdoc.grame.fr/manual/errors/#warning-messages

@crop2000
Copy link
Contributor Author

crop2000 commented Dec 27, 2024

I still think it is strange that it is prefixed because of the duplicate use it introduced, but the prefix is twice the same.
the issue is solveable if the shortname is not associated with the path but with the varname.

crop2000 added a commit to crop2000/faust that referenced this issue Dec 27, 2024
@sletz
Copy link
Member

sletz commented Jan 2, 2025

@sletz sletz closed this as completed Jan 2, 2025
@crop2000
Copy link
Contributor Author

crop2000 commented Jan 2, 2025

The documentation doesn't deal with shortnames and the issue is about shortnames.
A pr to solve this issue can be made.
But i think you don't have interest that this gets solved.

@sletz
Copy link
Member

sletz commented Jan 2, 2025

shortnames are built for pathnames, so if pathnames are the same, so are shortnames. You can always decide to restructure the code to have different pathnames.

@crop2000
Copy link
Contributor Author

crop2000 commented Jan 2, 2025

I think in that case an error should be raised. Because there is no way to access the duplicate path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants