# Getting audio device name using getDriverInfo

**URL:** <https://qa.fmod.com/t/getting-audio-device-name-using-getdriverinfo/21950>\
**Category:** FMOD Engine\
**Tags:** unity, csharp\
**Created:** [July 31, 2024, 12:10pm UTC](https://qa.fmod.com/t/getting-audio-device-name-using-getdriverinfo/21950 "2024-07-31T12:10:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ojabim](https://avatars.discourse-cdn.com/v4/letter/o/a5b964/32.png) [@ojabim](https://qa.fmod.com/u/ojabim)\
**Post date:** [July 31, 2024, 12:10pm UTC](https://qa.fmod.com/t/getting-audio-device-name-using-getdriverinfo/21950/1 "2024-07-31T12:10:27Z")

</div>

Hi there,

I am trying to add a setting in my game where players can change the active audio device used in-game.

The game is written in C# using Unity and the FMOD Unity integration.

My code uses the _RuntimeManager.Coresystem_ functions _getDriver_, _getDriverInfo_ and _setDriver_ and successfully returns the correct amount of audio devices with FMOD.RESULT being OK at all times.  
However, the encoding of the audio devices names returned are a delicious mix of characters that I am unable to print out without Unity crashing.

See attached image of a GetActiveAudioDrivers-function implementing this logic:

 ![FMODForumQuestion](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c5835657b57ca23fa037a791ad6b5147936a47a9.jpeg)

Is there a way to decode the names returned by the FMOD API so I can display the correct names in my audio settings?

For example, the default audio device with id 0 should be called “Focusrite USB Audio”, the same way it is displayed in my audio device list in Windows.

Thank you for your help and for making an awesome product

---

<div class="post-metadata">

**Author:** ![ojabim](https://avatars.discourse-cdn.com/v4/letter/o/a5b964/32.png) [@ojabim](https://qa.fmod.com/u/ojabim)\
**Post date:** [July 31, 2024, 12:43pm UTC](https://qa.fmod.com/t/getting-audio-device-name-using-getdriverinfo/21950/2 "2024-07-31T12:43:39Z")

</div>

Problem solved!

By manually assigning a value to the name length parameter in getDriverInfo to **256** the API now returns the correct name of the audio device, in this case “Focusrite USB Audio”.

This might be common knowledge to some, but for me it was a bit tricky figuring this out.  
Perhaps the documentation could be updated with an example of what values work well with this parameter?

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [August 1, 2024, 7:15am UTC](https://qa.fmod.com/t/getting-audio-device-name-using-getdriverinfo/21950/3 "2024-08-01T07:15:50Z")

</div>

The `namelen` parameter needs to be equal or greater than the length of the driver name; the longer the name, the larger `namelen` needs to be.  
“Focusrite USB Audio” is nineteen characters long, so setting `namelen` to 19 would be sufficient to see the full name of that particular driver. Other drivers’ names may have other lengths, but a `namelen` of 256 should be more than enough for any of them.

You’re right that we should include this information in our documentation. I’ll add that suggestion to our feature/improvement tracker so that it can be incorporated into future versions of the FMOD Engine User Manual.
