# Get Fmod Studio tracks order c++

**URL:** <https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481>\
**Category:** Unreal Engine\
**Tags:** ue4\
**Created:** [July 27, 2021, 2:47am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481 "2021-07-27T02:47:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nosestudiokr](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/nosestudiokr/32/2179_2.png) [@nosestudiokr](https://qa.fmod.com/u/nosestudiokr)\
**Post date:** [July 27, 2021, 2:47am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/1 "2021-07-27T02:47:31Z")

</div>

I could get each tracks rms level using ChannelGroup.

But I can’t get Fmod Studio Tracks order.  
How can I get the order of Studio?

Thanks in advance  
using UE4.25  
Here is source code.

.H  
TArrayFMOD::ChannelGroup\* ChannelGroupArray;

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FMOD", meta = (AllowPrivateAccess = "true"))
TArray<class UFMODEvent*>	EventArray;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FMOD", meta = (AllowPrivateAccess = "true"))
TArray<FString> EventNameArray;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FMOD", meta = (AllowPrivateAccess = "true"))
TArray<float>	TrackLeftRMSVolumeArray;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FMOD", meta = (AllowPrivateAccess = "true"))
TArray<float>	TrackRightRMSVolumeArray;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FMOD", meta = (AllowPrivateAccess = "true"))
TArray<FString>	TrackName;

```

.CPP  
int ChannelCount = 0;

```
pChannelGroup->getNumGroups(&ChannelGroupCount);

for (int i = 0; i < ChannelGroupCount; ++i)
{
	FMOD::ChannelGroup* SubGroup = nullptr;
	pChannelGroup->getGroup(i, &SubGroup);

	char	ChannelName[128] = {};
	SubGroup->getName(ChannelName, 128);

	FString	NameStr = ChannelName;

	TrackName.Add(NameStr);

	//GEngine->AddOnScreenDebugMessage(-1, 100.f, FColor::Red, NameStr);

	ChannelGroupArray.Add(SubGroup);

	TrackLeftRMSVolumeArray.Add(0.f);
	TrackRightRMSVolumeArray.Add(0.f);

	FMOD::DSP* pSubDSP = nullptr;

	SubGroup->getDSP(0, &pSubDSP);

	DSPArray.Add(pSubDSP);

	ErrCheck(pSubDSP->setMeteringEnabled(true, true), TEXT("setMeteringEnabled"));
}

```

 ![fmod_studio](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/5/56c6e0e5994bd7345b83a9254bf3680cc68faaa7.png)  
 ![unreal](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/6/6585a2e8b307754efd8f40bffc3b6df2c41df65d.png)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 28, 2021, 6:30am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/2 "2021-07-28T06:30:11Z")

</div>

Unfortunately the track order is immaterial to the API so there is no easy way to get the order of tracks as they appear in FMOD Studio. If you let me know what the high level concept is that you’re trying to achieve here / why you need the track order, I can help come up with a workaround?

---

<div class="post-metadata">

**Author:** ![nosestudiokr](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/nosestudiokr/32/2179_2.png) [@nosestudiokr](https://qa.fmod.com/u/nosestudiokr)\
**Post date:** [July 28, 2021, 6:46am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/3 "2021-07-28T06:46:32Z")

</div>

I just want to check which instrument(tracks in studio) is getting metering.  
I want to use each track’s metering data but When I add tracks in studio, order of Array(in UE) is changing.  
Or can i get the name of tracks?

Thanks for feedback.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 29, 2021, 4:44am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/4 "2021-07-29T04:44:19Z")

</div>

After digging around through our API, I haven’t found any easy way to get the name of a track- ChannelGroup::getName() doesn’t return the name of the track, and as you have found the track order can change any time and has no relationship to the track order in Studio.  
At this time I don’t think there is any direct way of achieving what you are after. That said, I can see that individual track metering info isn’t useful by itself so there really should be some kind of identifier letting you know where it came from; I will add it as a suggestion and hopefully get it added in a future release.

---

<div class="post-metadata">

**Author:** ![nosestudiokr](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/nosestudiokr/32/2179_2.png) [@nosestudiokr](https://qa.fmod.com/u/nosestudiokr)\
**Post date:** [July 29, 2021, 5:35am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/5 "2021-07-29T05:35:51Z")

</div>

I got it. I will be helpful if you add in future release.  
Thanks

---

<div class="post-metadata">

**Author:** ![apfelbaum](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/apfelbaum/32/4843_2.png) [@apfelbaum](https://qa.fmod.com/u/apfelbaum)\
**Post date:** [June 29, 2023, 2:38pm UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/6 "2023-06-29T14:38:56Z")

</div>

I think this is exactly what I am after too. I need something to identifier a Channel in Code (Unreal Engine 5.2), if it is the index that is equal to the order of the events(although this is dangerous), the name of the track you entered in fmod or another variable you can set in fmod, a number or a string field.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 5, 2023, 1:36am UTC](https://qa.fmod.com/t/get-fmod-studio-tracks-order-c/17481/7 "2023-07-05T01:36:51Z")

</div>

Perhaps you could try setting [User Properties](https://fmod.com/docs/2.02/studio/advanced-topics.html#user-properties) to map the audio file names on each instrument to their respective tracks in the event?

 ![explanation](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/5/5bae37beb388c6d593170066c633af227384a6c6.png)  
It would be a little fiddly with high track or asset counts, but this would allow you to identify the track each sound is playing back on. Here is an example of how you might access the user properties at runtime via an [`FMOD_STUDIO_EVENT_CALLBACK_SOUND_PLAYED`](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_callback_sound_played) callback:

```ruby
FMOD_RESULT CallbackSoundStarted(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE *event, void *parameters)
{
    FMOD::Studio::EventInstance *instance = (FMOD::Studio::EventInstance *)event;
    FMOD::Sound *sound = (FMOD::Sound *)parameters;
    FMOD::Studio::EventDescription *description;
    FMOD_STUDIO_USER_PROPERTY prop;
    int numproperties;

    instance->getDescription(&description);
    description->getUserPropertyCount(&numproperties);

    for (int i = 0; i < numproperties; ++i)
    {  
        description->getUserPropertyByIndex(i, &prop);
        if (prop.type == FMOD_STUDIO_USER_PROPERTY_TYPE_STRING)
        {
            char name[256];
            sound->getName(name, 256);

            if (strstr(name, prop.stringvalue) != NULL)
            {
                UE_LOG(LogFMOD, Display, TEXT("%s playing back on %s track."),
                    UTF8_TO_TCHAR(name), UTF8_TO_TCHAR(prop.name));
            }
        }
    }
    return FMOD_OK;
}

```
