# getRecordNumDrivers value never change

**URL:** <https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514>\
**Category:** Unreal Engine\
**Created:** [June 1, 2016, 2:02pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514 "2016-06-01T14:02:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 1, 2016, 2:02pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/1 "2016-06-01T14:02:25Z")

</div>

Hello,

After some testing, I found out that the results of **getRecordNumDrivers** never changes.  
For example if I run the code with two microphones plugged in, the value of numdrivers and numconnected will always be “2”, even if one is unplugged or if another microphone is added after initialization.

I also noticed that the value of the FMOD\_DRIVER\_STATE given by **getRecordDriverInfo** is “3”. This is weird as the documentation only gives two possible values (1 or 2): [https://www.fmod.org/docs/content/generated/FMOD\_DRIVER\_STATE.html](https://www.fmod.org/docs/content/generated/FMOD_DRIVER_STATE.html)

Here is the code I use for testing in the Tick function of my actor.

```
void AMicrophoneManager::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	result = system->update();
	checkResult(result);

	result = system->getRecordNumDrivers(&numdrivers, &numconnected);
	checkResult(result);
	int count, speakermodechannels, systemrate;
	FMOD_SPEAKERMODE speakermode;
	FMOD_DRIVER_STATE state;

	for (count = 0; count < numdrivers; count++)
	{
		char name[256];
		FMOD_GUID guid;
		result = system->getRecordDriverInfo(count, name, 256, &guid, &systemrate, &speakermode, &speakermodechannels, &state);
		UE_LOG(LogTemp, Warning, TEXT("numdrivers : %d %d\n"), numdrivers, (unsigned int)state);
		checkResult(result);
	}
}

```

Is there something wrong with this code?

Edit: Using Fmod 1.08.04 and UE4.12 Preview 4 with simple usb microphones

**EDIT Solution:**

Mathew found out that the problem was due to a part of my code that was explicitly setting DSound. I removed it and it worked properly after this.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [June 1, 2016, 10:46pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/2 "2016-06-01T22:46:53Z")

</div>

> [@](#):
>
> Hello,
> 
> After some testing, I found out that the results of **getRecordNumDrivers** never changes.  
> For example if I run the code with two microphones plugged in, the value of numdrivers and numconnected will always be “2”, even if one is unplugged or if another microphone is added after initialization.
> 
> I also noticed that the value of the FMOD\_DRIVER\_STATE given by **getRecordDriverInfo** is “3”. This is weird as the documentation only gives two possible values (1 or 2): [https://www.fmod.org/docs/content/generated/FMOD\_DRIVER\_STATE.html](https://www.fmod.org/docs/content/generated/FMOD_DRIVER_STATE.html)
> 
> Here is the code I use for testing in the Tick function of my actor.
> 
> ```
> void AMicrophoneManager::Tick( float DeltaTime )
> {
> Super::Tick( DeltaTime );
> result = system->update();
> checkResult(result);
> 
> result = system->getRecordNumDrivers(&numdrivers, &numconnected);
> checkResult(result);
> int count, speakermodechannels, systemrate;
> FMOD_SPEAKERMODE speakermode;
> FMOD_DRIVER_STATE state;
> 
> for (count = 0; count < numdrivers; count++)
> {
> char name[256];
> FMOD_GUID guid;
> result = system->getRecordDriverInfo(count, name, 256, &guid, &systemrate, &speakermode, &speakermodechannels, &state);
> UE_LOG(LogTemp, Warning, TEXT("numdrivers : %d %d\n"), numdrivers, (unsigned int)state);
> checkResult(result);
> }
> }
> 
> ```
> 
> Is there something wrong with this code?
> 
> Edit: Using Fmod 1.08.04 and UE4.12 Preview 4 with simple usb microphones
> 
> **EDIT Solution:**
> 
> Mathew found out that the problem was due to a part of my code that was explicitly setting DSound. I removed it and it worked properly after this.

Can you link with the logging version of FMOD? You should see information in the TTY output whenever a microphone is added or removed.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [June 1, 2016, 10:45pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/3 "2016-06-01T22:45:47Z")

</div>

It is expected that when calling System::getRecordNumDrivers the value of ‘numdrivers’ will only ever grow (disconnected microphones are still in the list). The other value ‘numconnected’ should be a real indication of the number of connected microphones.

FMOD\_DRIVER\_STATE can encompass multiple states at the same time, the defines are bitwise ORd together to give you the final number, i.e. 3 is the bitwise OR of CONNECTED and DEFAULT.

EDIT: For Windows, detection of microphone add/remove is currently only available with the WASAPI output mode (default on Windows Vista and up). DirectSound (default for Windows XP) does not have this feature.

I can log this as a request for improvement if you like?

---

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 2, 2016, 7:26am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/4 "2016-06-02T07:26:57Z")

</div>

> [@](#):
>
> It is expected that when calling System::getRecordNumDrivers the value of ‘numdrivers’ will only ever grow (disconnected microphones are still in the list). The other value ‘numconnected’ should be a real indication of the number of connected microphones.
> 
> FMOD\_DRIVER\_STATE can encompass multiple states at the same time, the defines are bitwise ORd together to give you the final number, i.e. 3 is the bitwise OR of CONNECTED and DEFAULT.
> 
> EDIT: For Windows, detection of microphone add/remove is currently only available with the WASAPI output mode (default on Windows Vista and up). DirectSound (default for Windows XP) does not have this feature.
> 
> I can log this as a request for improvement if you like?

Thank you for the answer. The value of the state makes sense now.

In my tests, numconnected value never changes when a microphone is plugged in or out.

About the logs, I only have Warning log at the moment, for example:

> LogFMOD:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_file.cpp(537) - File offset: 0 + length: 64000 \> actual file size 0, truncating length.

I’m looking at how to have more detailed logs.

---

<div class="post-metadata">

**Author:** ![yourk](https://avatars.discourse-cdn.com/v4/letter/y/0ea827/32.png) [@yourk](https://qa.fmod.com/u/yourk)\
**Post date:** [February 26, 2018, 9:29am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/5 "2018-02-26T09:29:03Z")

</div>

Hello, can you help me solve a problem? After the initialization method, the getRecordNumDrivers method is called, returning numDrivers as 0.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [February 26, 2018, 10:58pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/6 "2018-02-26T22:58:35Z")

</div>

Answered here: [http://www.fmod.org/questions/question/android-the-getrecorddriverinfo-method-callback-is-0-android/](http://www.fmod.org/questions/question/android-the-getrecorddriverinfo-method-callback-is-0-android/)

---

<div class="post-metadata">

**Author:** ![cgripeos](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@cgripeos](https://qa.fmod.com/u/cgripeos)\
**Post date:** [September 12, 2018, 7:36pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/7 "2018-09-12T19:36:12Z")

</div>

Hello,

I’m on Unity 2018.2.0f2 using the FMOD plugin 1.10.07 and running on Windows 10 with WASAPI and ‘getRecordNumDrivers’ values for ‘connected’ drivers does not change when I unplug my microphone.

---

<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:** [September 16, 2018, 11:43pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/8 "2018-09-16T23:43:47Z")

</div>

Hi Chris,

Are you seeing the same issue when using the “record\_enumeration” example in the lowlevel API examples?

---

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 2, 2016, 1:23pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/9 "2016-06-02T13:23:53Z")

</div>

I defined a callback to show the log in the ue4 Output Log window:

```
FMOD_RESULT fmodLogCallback(FMOD_DEBUG_FLAGS flags, const char *file, int line, const char *func, const char *message)
{
	UE_LOG(LogTemp, Warning, TEXT("%s : line %d | %s\n"), *(FString(ANSI_TO_TCHAR(file))), line, *(FString(ANSI_TO_TCHAR(message))));
	return FMOD_OK;
}

 .
 .
 .

result = FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG, FMOD_DEBUG_MODE_CALLBACK, fmodLogCallback);

```

Here are the logs: [http://pastebin.com/Kj7uFk4T](http://pastebin.com/Kj7uFk4T)

Nothing is printed when I add or remove a microphone. When I start the game, all the logs are printed up to

> LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4910 | Enumerating 2 record drivers  
> LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4936 | 0. Found record driver: ‘Microphone (2- USB Microphone)’  
> LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4936 | 1. Found record driver: ‘Microphone (USB Microphone)’

Then there is no more log until I stop the game.

EDIT: It seems to work properly on PS4. The number of recorded drivers follows the number of devices when I add or remove them. The problem remains on Windows.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [June 5, 2016, 10:35pm UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/10 "2016-06-05T22:35:22Z")

</div>

> [@](#):
>
> I defined a callback to show the log in the ue4 Output Log window:
> 
> ```
> FMOD_RESULT fmodLogCallback(FMOD_DEBUG_FLAGS flags, const char *file, int line, const char *func, const char *message)
> {
> UE_LOG(LogTemp, Warning, TEXT("%s : line %d | %s\n"), *(FString(ANSI_TO_TCHAR(file))), line, *(FString(ANSI_TO_TCHAR(message))));
> return FMOD_OK;
> }
> 
> .
> .
> .
> 
> result = FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG, FMOD_DEBUG_MODE_CALLBACK, fmodLogCallback);
> 
> ```
> 
> Here are the logs: [http://pastebin.com/Kj7uFk4T](http://pastebin.com/Kj7uFk4T)
> 
> Nothing is printed when I add or remove a microphone. When I start the game, all the logs are printed up to
> 
> > LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4910 | Enumerating 2 record drivers  
> > LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4936 | 0. Found record driver: ‘Microphone (2- USB Microphone)’  
> > LogTemp:Warning: c:\jk\workspace\Build\_\_1.8\_\_UE4Libs\_Win\lowlevel\_api\src\fmod\_systemi.cpp : line 4936 | 1. Found record driver: ‘Microphone (USB Microphone)’
> 
> Then there is no more log until I stop the game.
> 
> EDIT: It seems to work properly on PS4. The number of recorded drivers follows the number of devices when I add or remove them. The problem remains on Windows.

It appears the link you’ve provided has expired, can you post to the Q&A or e-mail [support@fmod.org](mailto:support@fmod.org)?

---

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 6, 2016, 9:58am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/11 "2016-06-06T09:58:25Z")

</div>

I’ve sent an email to the support.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [June 8, 2016, 5:40am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/12 "2016-06-08T05:40:36Z")

</div>

Thanks for the details, my guess is you are on XP? I’ve updated my above answer assuming this case.

---

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 8, 2016, 6:54am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/13 "2016-06-08T06:54:51Z")

</div>

I’m using Windows 10. Is there anything that could be wrong with WASAPI on a Windows install? Like missing dependencies or a service not running?

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [June 9, 2016, 1:40am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/14 "2016-06-09T01:40:16Z")

</div>

Actually looking at your sample code, you are explicitly setting DSound, you should remove this.

---

<div class="post-metadata">

**Author:** ![studiolecortex](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@studiolecortex](https://qa.fmod.com/u/studiolecortex)\
**Post date:** [June 9, 2016, 9:56am UTC](https://qa.fmod.com/t/getrecordnumdrivers-value-never-change/12514/15 "2016-06-09T09:56:13Z")

</div>

That’s it. Removing the call to setOutput fixed the problem. Thank you Mathew!
