# FMOD init blocks USB device

**URL:** <https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804>\
**Category:** FMOD Engine\
**Created:** [January 23, 2015, 8:35am UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804 "2015-01-23T08:35:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob666](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rob666](https://qa.fmod.com/u/rob666)\
**Post date:** [January 23, 2015, 8:35am UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804/1 "2015-01-23T08:35:57Z")

</div>

Hi

I have a problem when using FMOD with a Spaceball from 3DConnextion. When I initialize my FMOD system with

```
   _FMODSystem->init(512, FMOD_INIT_NORMAL, 0);

```

an attached Spaceball doesn’t work anymore. If I don’t init that (and have no sounds), it works without problems. The Spaceball is connected on USB and uses COM to get the data. What can I do to have both working?  
I’m using the latest FMOD available on C++, VS2013.

Thanks,  
Rob

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [January 27, 2015, 12:04am UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804/2 "2015-01-27T00:04:57Z")

</div>

Hi Rob,

I’m guessing that you’ve already called CoInitializeEx() on the thread that you’re calling System::init() from.

FMOD must be doing an extra CoUninitialize somewhere.

Can you confirm if you call CoInitializeEx, what arguments you use and the exact version FMOD version this is happening with.

**EDIT:** If you could also post your FMOD startup code, including calls to getNumDrivers, getDriverInfo, setOutputMode, etc.

---

<div class="post-metadata">

**Author:** ![rob666](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rob666](https://qa.fmod.com/u/rob666)\
**Post date:** [January 27, 2015, 9:20am UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804/3 "2015-01-27T09:20:23Z")

</div>

Hi

Thanks for the reply.

I do call CoInitializeEx, it’s like this:

```
HRESULT hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);

        // Create the device object
        hr = _3DxDevice.CoCreateInstance(__uuidof(Device));
        if (SUCCEEDED(hr))
        {
            CComPtr<ISimpleDevice> _3DxSimpleDevice;

            hr = _3DxDevice.QueryInterface(&_3DxSimpleDevice);
            if (SUCCEEDED(hr))
            {
                // Get the interfaces to the sensor and the keyboard;
                _3DSensor = _3DxSimpleDevice->Sensor;
                _3DKeyboard = _3DxSimpleDevice->Keyboard;

                // Associate a configuration with this device
                hr = _3DxSimpleDevice->LoadPreferences(_T("Animation"));
                // Connect to the driver
                hr = _3DxSimpleDevice->Connect();

                _supported = SUPPORTED;
				std::cout << " 3D Mouse found, using it as OpenSceneGraph manipulator." << std::endl;
                return 1; //Base::SUCCESS
            }
        }

```

I had those getNumDrivers etc, copied from the example code that came with FMOD, but now I removed all for testing and have now for the initialization this:

```
_FMODChannel = 0;
    FMOD_RESULT result;
    unsigned int version;
    // Create a FMOD system object and initialize
    result = FMOD::System_Create(&_FMODSystem);
    ERRCHECK(result);

    result = _FMODSystem->init(512, FMOD_INIT_NORMAL, 0);
    ERRCHECK(result);

    result = _FMODSystem->createSound("sounds/TorqueLimit.wav", FMOD_DEFAULT, 0, &_FMODSound);
    ERRCHECK(result);

    _FMODSound->setLoopCount(-1);
    _FMODSound->setMusicSpeed(2.0);
    result = _FMODSound->setMode(FMOD_LOOP_NORMAL);
    ERRCHECK(result);

```

And I’m using FMOD 1.05.10

Thanks

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [January 27, 2015, 11:53pm UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804/4 "2015-01-27T23:53:58Z")

</div>

> [@](#):
>
> Hi
> 
> Thanks for the reply.
> 
> I do call CoInitializeEx, it’s like this:
> 
> ```
> HRESULT hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
> 
> // Create the device object
> hr = _3DxDevice.CoCreateInstance(__uuidof(Device));
> if (SUCCEEDED(hr))
> {
> CComPtr<ISimpleDevice> _3DxSimpleDevice;
> 
> hr = _3DxDevice.QueryInterface(&_3DxSimpleDevice);
> if (SUCCEEDED(hr))
> {
> // Get the interfaces to the sensor and the keyboard;
> _3DSensor = _3DxSimpleDevice->Sensor;
> _3DKeyboard = _3DxSimpleDevice->Keyboard;
> 
> // Associate a configuration with this device
> hr = _3DxSimpleDevice->LoadPreferences(_T("Animation"));
> // Connect to the driver
> hr = _3DxSimpleDevice->Connect();
> 
> _supported = SUPPORTED;
> std::cout << " 3D Mouse found, using it as OpenSceneGraph manipulator." << std::endl;
> return 1; //Base::SUCCESS
> }
> }
> 
> ```
> 
> I had those getNumDrivers etc, copied from the example code that came with FMOD, but now I removed all for testing and have now for the initialization this:
> 
> ```
> _FMODChannel = 0;
> FMOD_RESULT result;
> unsigned int version;
> // Create a FMOD system object and initialize
> result = FMOD::System_Create(&_FMODSystem);
> ERRCHECK(result);
> 
> result = _FMODSystem->init(512, FMOD_INIT_NORMAL, 0);
> ERRCHECK(result);
> 
> result = _FMODSystem->createSound("sounds/TorqueLimit.wav", FMOD_DEFAULT, 0, &_FMODSound);
> ERRCHECK(result);
> 
> _FMODSound->setLoopCount(-1);
> _FMODSound->setMusicSpeed(2.0);
> result = _FMODSound->setMode(FMOD_LOOP_NORMAL);
> ERRCHECK(result);
> 
> ```
> 
> And I’m using FMOD 1.05.10
> 
> Thanks

Is it possible for you to try CoInitializeEx(0, COINIT\_APARTMENTTHREADED) in your code?

---

<div class="post-metadata">

**Author:** ![rob666](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rob666](https://qa.fmod.com/u/rob666)\
**Post date:** [January 28, 2015, 8:20am UTC](https://qa.fmod.com/t/fmod-init-blocks-usb-device/11804/5 "2015-01-28T08:20:36Z")

</div>

Ok, I tried that, but it didn’t work. But then I changed the order of initialization, first I had the USB device, then FMOD. But when I switched it, first initializing the Spaceball with COINIT\_MULTITHREADED, then FMOD, that is working. This order with COINIT\_APARTMENTTHREADED didn’t work.

So the problem is solved, thanks a lot for the help.  
Cheers,  
Rob
