[Qt-interest] About the QSound,is thread safe?
lvbing lvbing
lvbing1981 at gmail.com
Fri Nov 6 14:58:54 CET 2009
The platform: WinXp + Qt332
In my application hase the function:
void MProcess::resetSound
{
if( sound != NULL)
{
sound->stop();
delete sound;
sound = NULL;
}
}
void MProcess::PlaySound()
{
resetSound();
sound = new QSound(fileName);
sound->setLoops(3000);
sound->play();
}
The fuction MProcess::PlaySound() is registered to be called by some
callback function.
In my callback function,it will call the function PlaySound,and return.but
sometime,
when the function run to subfuction:MProcess::resetSound(),
it delay at "sound->stop();"
I don't know why ?
and is there something wrong with my function?
BTW:I need realized the function:
In my callback function,I need select a wave file to paly,if the pre wave
file still play,stop it first,then play the
new wave file.
But the class QSound has not the way to change the wave file to play.
or the static functionQSound::play(const QString& filename) can't set the
loops!
and if I use QSound class to setLoops,and do I have to stop the QSound first
and delete it then,
and create a new QSound object ?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091106/bbd64a65/attachment.html
More information about the Qt-interest-old
mailing list