FMOD_STUDIO_PARAMETER_FLAGS confusing response

When I use:

FMOD_STUDIO_PARAMETER_DESCRIPTION
{
name,
id,
minimum,
maximum,
defaultvalue,
type,
flags,
guid
};

The “flags” return a number “5”. It’s not clear to me whether this is the total number of flags possible, or number of flags assigned, or THE flag assigned. There are five flags listed. My Studio setting should have this parameter set as GLOBALS

STUDIO_PARAMETER_READONLY 0x00000001
STUDIO_PARAMETER_AUTOMATIC 0x00000002
STUDIO_PARAMETER_GLOBALS 0x00000004
STUDIO_PARAMETER_DISCRETE 0x00000008
STUDIO_PARAMETER_LABELED 0x00000010

This code:

var paramDesc = {};
CHECK_RESULT(eventDescription.val.getParameterDescriptionByName(“Synths”, paramDesc));
gSurfaceID = paramDesc.id;
gSurfaceType = paramDesc.type;
console.log(gSurfaceType);
gSurfaceMin = paramDesc.minimum;
console.log(gSurfaceMin);
gSurfaceMax = paramDesc.maximum;
console.log(gSurfaceMax);
gSurfaceDefault = paramDesc.defaultvalue;
console.log(gSurfaceDefault);
gSurfaceFlags = paramDesc.flags;
console.log(gSurfaceFlags);

Retuens:

0
0
1
0.5
5

All but the “5” makes sense to me.

The problem I’m trying to solve is that when I try to change this parameter, I’m told the parameter is invalid, so I’m trying to debug that by checking the parameter description. I’m using the “event parameter” example as a place to learn how to do this.

“event_parameter.js:35 Uncaught Error!!! ‘An invalid parameter was passed to this function.’”

Ok, I haven’t answered the Flag number question but have solved my issue,

I was trying to change a global parameter at the instance level, rather than system level. My bad.

1 Like

Hi,

Good to hear the issue is solved, to answer your question about the flags would it be possible to get the full script that you used? I am not sure how you got those values.

I had deleted from my project but I just downloaded the HTML5 example again to test:

I printed paramterDesc.flags to the console log using the below, starting line 158, I added lines 164 and 165:

// Find the parameter once and then set by ID
// Or we can just find by name every time but by ID is more efficient if we are setting lots of parameters
var paramDesc = {};
CHECK_RESULT( eventDescription.val.getParameterDescriptionByName("Surface", paramDesc) );
gSurfaceID = paramDesc.id;
//trying to discover what flag is assigned to the parameter
gSurfaceFlags = paramDesc.flags;
console.log("flags", gSurfaceFlags);

I get this response in the console:

flags 24

I’m not sure how this corresponds to the flag type assigned. Is this maybe the number of flags? I was trying to verify that assigned flags to a particular parameter was global to aid in it’s value manipulation

Hi,

This has been a bit of a learning experience for me as well.
The flags can be a combination of more than 1, so when getting the result of 24 and looking at the list of possible flags

public enum PARAMETER_FLAGS : uint
{
    READONLY  = 0x00000001,
    AUTOMATIC = 0x00000002,
    GLOBAL    = 0x00000004,
    DISCRETE  = 0x00000008,
    LABELED   = 0x00000010,
}

We can determine which flags are being used

ATUOMATIC + GLOBAL + DISCRETE + LABELED

This way we can list multiple flags in one variable without corrupting the information. Hope this helps!