# getNumdrivers failed return FMOD\_ERR\_INVALID\_PARAM

**URL:** <https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [November 8, 2022, 6:14am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489 "2022-11-08T06:14:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neople](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Neople](https://qa.fmod.com/u/Neople)\
**Post date:** [November 8, 2022, 6:14am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/1 "2022-11-08T06:14:39Z")

</div>

Using : FMOD Engine Core Api 2.02.09  
OS : Windows 10

It only occurs on a specific user’s PC.  
Unfortunately, the audio device information was not confirmed.

FMOD Init proceeded in order.

1. FMOD::System\_Create(&m\_system);

- success

1. m\_system-\>getVersion(&version);

- success

1. m\_system-\>getNumDrivers(&numdrivers);

- failed, FMOD\_ERR\_INVALID\_PARAM

Why does this happen?

When error situation, i use setOutput NOSOUND.  
m\_system-\>setOutput(FMOD\_OUTPUTTYPE\_NOSOUND);

Is there a better way?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [November 9, 2022, 12:07am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/2 "2022-11-09T00:07:24Z")

</div>

Hi,

The `FMOD_ERR_INVALID_PARAM` could be thrown for a couple of reasons, would it be possible to get a full code snippet? Some causes could be, if the `*int` passed into the function is null or the `m_system` fails a validation test in the `getNumDrivers()` function. Initializing the debug system will also help resolve the issue, further explained under [FMOD API | Common](https://fmod.com/docs/2.02/api/core-api-common.html#debug_initialize). To use the debug system you will have to link the fmodL logging dll in your project preferences. Then before calling `System_Create` call `Debug_Initialize(FMOD_DEBUG_LEVEL_LOG)`. This will print out FMOD logs to the output console of your IDE.  
The FMOD\_OUTPUTTYPE will impact the number of drivers used by the system, in reference to calling getNumDrivers(). Using NOSOUND and logging the errors from FMOD is the best way for now.

---

<div class="post-metadata">

**Author:** ![Neople](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Neople](https://qa.fmod.com/u/Neople)\
**Post date:** [November 9, 2022, 2:20am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/3 "2022-11-09T02:20:17Z")

</div>

Thanks for answer.

This is full code snippet.  
fmod api called only 3 times when failure occurs.

```auto
FMOD_RESULT result = FMOD_OK;
unsigned int version = 0;
int numdrivers = 0;

result = FMOD::System_Create(&m_system);
// success
result = m_system->getVersion(&version);
// success
result = m_system->getNumDrivers(&numdrivers);
// result failed, FMOD_ERR_INVALID_PARAM

```

I’m hard to understand that an error occurred FMOD\_ERR\_INVALID\_PARAM when simply calling the getNumDrivers api.  
Is there anything that could be a problem?

It seems that the parameter data types are not different.

```auto
FMOD_RESULT F_API getNumDrivers (int *numdrivers);

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [November 9, 2022, 4:05am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/4 "2022-11-09T04:05:59Z")

</div>

Hi,

No worries and thank you for the code snippet.  
Is it possible to get the [Debug system](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/2#:~:text=Initializing%20the%20debug,of%20your%20IDE) initialized to get some more information from the FMOD system? Also, could you run Dxdiag on the user’s computer to provide us with more information about their PC? This can be done by pressing the Windows key and searching “dxdiag”. After accepting the first prompt, select “Save All Information”, save the `.txt` file on your pc then Upload it to your FMOD profile.

---

<div class="post-metadata">

**Author:** ![Neople](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Neople](https://qa.fmod.com/u/Neople)\
**Post date:** [November 9, 2022, 4:29am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/5 "2022-11-09T04:29:17Z")

</div>

It seems difficult to collect FMOD debug information or dxdiag information because the problem occurred on an unidentified customer(a.k.a. end user)'s PC.  
I will check the contact to user, but we have not any detailed information, so it will take a much time.  
try to contact as soon as possible.

Thank you.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [November 9, 2022, 5:59am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/6 "2022-11-09T05:59:41Z")

</div>

How often is the crash occurring?  
Thank you for all the information you have provided so far. Any more information would be great. Thank you

---

<div class="post-metadata">

**Author:** ![Neople](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Neople](https://qa.fmod.com/u/Neople)\
**Post date:** [November 10, 2022, 12:31am UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/7 "2022-11-10T00:31:28Z")

</div>

Hi.  
I reproduce the problem situation in my computer.  
It’s not exactly the same, getNumDrivers returns FMOD\_ERR\_OUTPUT\_INIT.  
It happens every time in that situation.

I tested it following this way. (OS : Windows 11)  
Computer has multiple audio devices. (NVIDIA High Definition Auido, Headset, USB Audio etc)  
I removed directly the headset earphone audio device from windows device manager.  
But In Setting → System → Sound → Output, still remains that removed device.  
Device detailed information looks like invalid dummy device. but It is not automatically erased.  
It would be strange, removed headset earphone device is a DualShock 4. (3 - wireless controller)

```auto
FMOD_RESULT result = FMOD_OK;
unsigned int version = 0;
int numdrivers = 0;

result = FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG, FMOD_DEBUG_MODE_FILE, nullptr, "fmod.log");
// success
result = FMOD::System_Create(&m_system);
// success
result = m_system->getVersion(&version);
// success
result = m_system->getNumDrivers(&numdrivers);
// result failed, FMOD_ERR_OUTPUT_INIT

```

same as before.  
But getNumDrivers returns FMOD\_ERR\_OUTPUT\_INIT.  
numdrivers is 0.

In this situation, USB Audio device is working normaly so i can listen some audio using it. (music player, video player etc)

FMOD error log (getNumDrivers)  
[ERR] OutputWASAPI::storeDeviceInfo : IPropertyStore::GetValue returned 0xE000020B.

Dxdiag also throws an error.  
DxDiag error  
Error: A problem was detected while obtaining additional sound information.

I upload fmod log and dixdiag information my FMOD profile.  
I’m sorry, I cannot change windows language setting. so dxdiag infomation has include korean.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [November 10, 2022, 10:24pm UTC](https://qa.fmod.com/t/getnumdrivers-failed-return-fmod-err-invalid-param/19489/9 "2022-11-10T22:24:26Z")

</div>

Hi,

Thank you for all the information.  
Unfortunately, I was not able to reproduce the issue. I have passed on the bug to our development team to look into it further.
