예제 #1
0
void MagRead::captureStart() {
	magDec = new MagDecode( this );
	connect( magDec, SIGNAL( cardRead( MagCard ) ), this, SLOT( cardRead( MagCard ) ) );
	connect( magDec, SIGNAL( errorMsg( QString ) ), this, SLOT( notice( QString ) ) );

	magDec->setThreshold( settings->value( "silenceThreshold" ).toInt() );
	magDec->setTimeOut( settings->value( "timeOut" ).toInt() );

	if( settings->value( "normAuto" ) == false )
		magDec->setNorm( settings->value( "norm" ).toInt() );
	
	magDec->setAlgorithm( settings->value( "algorithm" ).toString() );

	audioInput = 0;

	QList<QAudioDeviceInfo> inputDevices = QAudioDeviceInfo::availableDevices( QAudio::AudioInput );
	for( int i = 0; i < inputDevices.size(); i++ ) {
		if( inputDevices.at( i ).deviceName() == settings->value( "audioDevice" ) ) {
			audioInput = new QAudioInput( inputDevices.at( i ), audioFormat, this );
		}
	}

	if( audioInput == 0 )
		audioInput = new QAudioInput( audioFormat, this );


	magDec->start();
	audioInput->start( magDec );
}
예제 #2
0
파일: swipe.cpp 프로젝트: JimmyPco/SWipe
void SWipe::captureStart() {
	magDec = new MagDecode( this );
	connect( magDec, SIGNAL( cardRead( MagCard ) ), this, SLOT( showCard( MagCard ) ) );
	connect( magDec, SIGNAL( errorMsg( QString ) ), &statusLabel, SLOT( setText( QString ) ) );

	audioInput = new QAudioInput( audioFormat, this );
	magDec->start();
	audioInput->start( magDec );
	mainBtn.setText( "Stop" );
}