Hi to all,
In my application I play a sound file when a particular situation occours ( a user is recognized with a biometric system ).
The code is basically executed in a timer event so:
void MyClass::onTimer()
{
timer->stop();
//..code..
currentFrame = GetCameraFrame();
if( userIsRecognized(frame) )
{
emit sig_userRecognized();
}
turnOffTheCamera();
//.. more code..
timer->start(5);
}
void MyClass::onTimer()
{
timer->stop();
//..code..
currentFrame = GetCameraFrame();
if( userIsRecognized(frame) )
{
emit sig_userRecognized();
}
turnOffTheCamera();
//.. more code..
timer->start(5);
}
To copy to clipboard, switch view to plain text mode
in the slot connected to the sig_userRecognized() signal basically I do something and I play a file using phonon so:
void MyClass::onUserRecognized()
{
//some code
mediaObject->setCurrentSource( Phonon::MediaSource("./sounds/file.wav") );
mediaObject->play();
//more code
}
void MyClass::onUserRecognized()
{
//some code
mediaObject->setCurrentSource( Phonon::MediaSource("./sounds/file.wav") );
mediaObject->play();
//more code
}
To copy to clipboard, switch view to plain text mode
What I would do is pause the onTimer routine 'till the file has finished to play but I don't know how because seems that's played in a separated thread.
Regards
Bookmarks