Unsolved why the QSoundEffect will play two sources after I change the source
-
Hi
when I use aQSoundEffect
to play different audio files, I find it will play two files afterQSoundEffect::setSource()
.
e.g.QSoundEffect *player = new QSoundEffect (); player->setSource(QUrl::fromLocalFile("/1.wav")); player->play(); player->setSource(QUrl::fromLocalFile("/2.wav")); player->play(); /*play 1.wav then play 2.wav*/
what's wrong with it?
Regards
Mihan -
@Mihan said in why the QSoundEffect will play two sources after I change the source:
QSoundEffect
You're adding second source just after staring playing, right? So, I would say it does exactly what you tell it to do.
-
@jsulm
Yes, I alse find it will play with different volume afterQSoundEffect::setVolume()
,and the voice is very large even I just set it 0.15 ( when the volume is 0.1 ,the voice is so normal, but when it's 0.15 , the voice seems to be the biggest)is it about platform or Qt version? I'm using Qt 5.6.2 on IMX6DL kernel 4.1.15
-
Hi,
As @jsulm wrote, it's doing exactly what you are asking it to do. You load a file, call play, load a different file, call play again. That's exactly what you are hearing.
-
-
@Mihan Why don't you wait until first file actually finished playing before starting second one?
-
@jsulm
Sure I have waited the first file finished.
Even I use differentQSoundEffect
to play different file, it still remains a little data in the latest time.Also if I just change the volume for the same source, it still play audio like above ( the second time will play with different volume at the beginning).