Пример #1
0
void AudioDevice::init()
{
    // create the format
    m_format.setSampleRate(8000);	// frequency
    m_format.setSampleSize(16);	// bits
    m_format.setSampleType(QAudioFormat::SignedInt);
    m_format.setChannelCount(1);
    m_format.setByteOrder(QAudioFormat::LittleEndian);
    m_format.setCodec("audio/pcm");

    // choose audio device
    QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
    if (!info.isFormatSupported(m_format)) {
        qWarning() << "format not supported, choosing default";
        m_format = info.nearestFormat(m_format);
    }

    // set buffer size
    const qint64 bufferDurationUs = 1 * 1000000;	// 5 seconds
    m_bufferSize = audioLength(m_format, bufferDurationUs);

    m_buffer = new QByteArray(m_bufferSize, 0);
    m_buffer->fill(0);

    m_audioBuffer = new AudioBuffer(m_bufferSize, this);

    iInit(info);
}
Пример #2
0
 // Function to be done in the thread
 static void *thread_func(void *vptr_args)
 {
   vector<int > iInit(3); //indexes initial point
   vector<int > iEnd(3);  //indexes end point
   localCube->micrometersToIndexes(initPoint->coords, iInit);
   localCube->micrometersToIndexes(endPoint->coords, iEnd);
   printf("  computing the shortest path between %i %i %i and %i %i %i\n",
          iInit[0], iInit[1], iInit[2],
          iEnd[0],  iEnd[1],  iEnd[2]);
   shortestPath = cubeDijkstra->findShortestPath(iInit[0], iInit[1], iInit[2],
                                                 iEnd[0],  iEnd[1],  iEnd[2],
                                                 *boundary, mutexBoundary);
 }
Пример #3
0
    bool Module::init(QWidget* parent)
    {		
        // has it already been init?
        if (m_isInit)
            return false;

        qDebug() << "initializing module: " << getModuleName();
        
        m_parent = parent;
        QMainWindow::setParent(m_parent);

        // load properties from file
        loadProperties(getModuleName());

        // init module
        if (iInit(m_parent))
            m_isInit = true;

        if (m_isInit)
            qDebug() << "module " << getModuleName() << " was successfully initialized";

        // was it successful?
        return m_isInit;
    }
Пример #4
0
	void Module::init()
	{
		iInit();
	}