# How to get a list of all of a parameter's lables

**URL:** https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704
**Category:** Unity
**Tags:** csharp, cpp
**Created:** [April 26, 2022, 10:38pm UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704 "2022-04-26T22:38:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![regularfriend](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@regularfriend](https://qa.fmod.com/u/regularfriend)
#### Post date: [April 26, 2022, 10:38pm UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/1 "2022-04-26T22:38:30Z")

</div>

Hey all,

A pattern I like to do for handling game ambience sound is to have a singular ambience event that is always playing and then have a label parameter on it that gets set depending on which ambience effects you want to be playing.

I am attempting to auto generate an Enum of all possible labels for this parameter to avoid string comparison issues and just make the process a little bit easier for our sound and level designers. Is there a way I can get a list of all valid IDs or values for a PARAMETER\_DESCRIPTION struct. It is pretty straight forward to get the parameter itself from the event instance, but I am struggling to see how to find a list of valid values that the parameter can be set in.

This data definitely exists as I can see the name and ID appear in the metadata for the parameter when i add new labels to the parmeter in fmod studio, but I am struggling to get this data to my unity editor script to bake out the enum. Push comes to shove I can probably find and read directly from the parameter meta data .xml file but I would like to avoid that for the sake of this tool’s future maintainability.

TL;DR is a list of the valid label values of a parameter exposed unity side in any way or do i have to parse the metadata xml to obtain this data. I will be running this script in editor (doesn’t need to work during runtime).

My bad if a thread for this exists, i did a search but only found people searching for a list of all parameters (which I am able to do), not a list of all label values within a parameter.

EDIT: so it looks like I can get a label by index from the parameter. Now i think the last piece of the puzzle I need to find is how to figure out the number of labels in the parameter (so i can iterate through all indices and get them all)

EDIT 2: Was able to roughly accomplish this with a (fairly jank) while loop. If there is a way to find the count of the labels on a parameter that would be cleaner. Posting pseudocode in case anyone else has a similar question. it errors that the last index is invalid (cpp plugin side), which isn’t great, but is fine for an editor only script for now.

```auto
public static void GetParamEnums(EventReference e, string paramName) {
            EventDescription eventDescription = RuntimeManager.GetEventDescription(e);
            if (eventDescription.isValid()) {
                PARAMETER_DESCRIPTION param ;
                FMOD.RESULT paramResult = eventDescription.getParameterDescriptionByName(paramName, out param);
                Debug.Log("Result was: " + paramResult.ToString());

                bool exitCase = false;
                List<string> labelList = new List<string>();
                int itr = 0;

                while (!exitCase) {
                    string toAdd = null;
                    FMOD.RESULT result = eventDescription.getParameterLabelByID(param.id, itr, out toAdd);
                    if (result == FMOD.RESULT.OK) {
                        labelList.Add(toAdd);
                        itr++;
                    }
                    else {
                        exitCase = true;
                    }
                }
        }

```

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [April 27, 2022, 4:48am UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/2 "2022-04-27T04:48:18Z")

</div>

You should be able to use `EventDescription.getParameterDescriptionCount(out int count)` and then loop through the parameter with `EventDescription.getParameterLabelByID(int id, out string)` to get a list of all parameter labels.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio\_eventdescription\_getparameterdescriptioncount](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio_eventdescription_getparameterdescriptioncount)

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio\_eventdescription\_getparameterlabelbyid](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio_eventdescription_getparameterlabelbyid)

---

<div class="post-metadata">

### Author: ![regularfriend](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@regularfriend](https://qa.fmod.com/u/regularfriend)
#### Post date: [April 28, 2022, 6:37pm UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/3 "2022-04-28T18:37:16Z")

</div>

tyty, much cleaner.

---

<div class="post-metadata">

### Author: ![regularfriend](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@regularfriend](https://qa.fmod.com/u/regularfriend)
#### Post date: [April 28, 2022, 7:27pm UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/4 "2022-04-28T19:27:15Z")

</div>

oh actually I dont believe that would work. Tthe getParameterDescriptionCount would return a count of all the parameters on the event. this event has both label parameters and other parameters but I only want to iterate through the labels. Its like i want a count of the labels on a single parameter, not the count of all the parameters on the event.

What i really want is like a ‘GetLabelCount’ function to call on the specific parameter. in my project getParameterDescriptionCount returns 3 (which is the number of parameters on the event) but the count of labels on the first parameter (what im iterating through) is 52.

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [May 4, 2022, 6:03am UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/5 "2022-05-04T06:03:52Z")

</div>

Ah you are correct, I misread the documentation sorry.

Instead what you can do is to get the parameter description and then check the parameter descriptions `maximum` value. It returns a float, but each whole number (eg. `1.00`, `2.00`) is a label. You can then use `getParameterLabelByID` to get the labels as strings.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio\_eventdescription\_getparameterdescriptionbyname](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventdescription.html#studio_eventdescription_getparameterdescriptionbyname)

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-common.html#fmod\_studio\_parameter\_description\_maximum](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-common.html#fmod_studio_parameter_description_maximum)

---

<div class="post-metadata">

### Author: ![regularfriend](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@regularfriend](https://qa.fmod.com/u/regularfriend)
#### Post date: [May 4, 2022, 5:56pm UTC](https://qa.fmod.com/t/how-to-get-a-list-of-all-of-a-parameters-lables/18704/6 "2022-05-04T17:56:54Z")

</div>

works perfectly tyvm!
