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.
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);
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