int AudioStream::deviceIndex(QString const& name) { int count = deviceCount(); for (int i = 0; i < count; ++i) if (deviceName(i) == name) return i; return -1; }
Freenect() : m_stop(false) { if(freenect_init(&m_ctx, NULL) < 0) throw std::runtime_error("Cannot initialize freenect library"); // We claim both the motor and camera devices, since this class exposes both. // It does not support audio, so we do not claim it. freenect_select_subdevices(m_ctx, static_cast<freenect_device_flags>(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)); if (deviceCount() < 1) m_stop = true; if(pthread_create(&m_thread, NULL, pthread_callback, (void*)this) != 0) throw std::runtime_error("Cannot initialize freenect thread"); }
DeviceVector ATIGPUDevice::createDevices(unsigned int flags) { DeviceVector devices; if(deviceCount() == 0) return devices; try { // Multiple devices is not supported yet devices.push_back(new ATIGPUDevice()); } catch (hydrazine::Exception he) { // Swallow the exception and return empty device vector report(he.what()); } return devices; }