Пример #1
0
bool FCDProInput::openDevice()
{
    if (m_dev != 0) {
        closeDevice();
    }

    int device = m_deviceAPI->getSampleSourceSequence();
    qDebug() << "FCDProInput::openDevice with device #" << device;
    m_dev = fcdOpen(fcd_traits<Pro>::vendorId, fcd_traits<Pro>::productId, device);

    if (m_dev == 0)
    {
        qCritical("FCDProInput::start: could not open FCD");
        return false;
    }

    if (!openFCDAudio(fcd_traits<Pro>::qtDeviceName))
    {
        qCritical("FCDProInput::start: could not open FCD audio source");
        return false;
    }
    else
    {
        qDebug("FCDProInput::start: FCD audio source opened");
    }

    return true;
}
Пример #2
0
bool FCDProPlusInput::start(int device)
{
	qDebug() << "FCDProPlusInput::start with device #" << device;

	QMutexLocker mutexLocker(&m_mutex);

	if (m_FCDThread)
	{
		return false;
	}

	m_dev = fcdOpen(fcd_traits<ProPlus>::vendorId, fcd_traits<ProPlus>::productId, device);

	if (m_dev == 0)
	{
		qCritical("FCDProPlusInput::start: could not open FCD");
		return false;
	}

	/* Apply settings before streaming to avoid bus contention;
	 * there is very little spare bandwidth on a full speed USB device.
	 * Failure is harmless if no device is found
	 * ... This is rubbish...*/

	//applySettings(m_settings, true);

	if(!m_sampleFifo.setSize(96000*4))
	{
		qCritical("Could not allocate SampleFifo");
		return false;
	}

	if ((m_FCDThread = new FCDProPlusThread(&m_sampleFifo)) == NULL)
	{
		qFatal("out of memory");
		return false;
	}

	m_FCDThread->startWork();

	mutexLocker.unlock();
	applySettings(m_settings, true);

	qDebug("FCDProPlusInput::started");
	return true;
}