コード例 #1
0
ファイル: magread.cpp プロジェクト: 5stringmonster/MagRead
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" );
}