Important: Please read the Qt Code of Conduct -

Play several sounds in the same time.

  • Hello,
    I am currently developping a QML application, and in a plugin I would like to play a sound (wave file).
    But there are several instances and only one sound can be played at a time. I am using Qsound to do this.

    @ QString lstmp=getenv("PROJECT");lstmp+="\recorder4.wav";
    if(!QSound::isAvailable()) qWarning("QMLCanvas error :QSound not available on this plateform");

    I did it with Phonon. But I tried to overload the system, ans send it every 100ms so I have the following error comming:
    QThread::start: Failed to create thread (Code d?acc?s non valide.)

    How can I test the availability of the system?

  • Moderators

    can you try the following please (instead using the the static method):
    QSound first("first.wav");;
    QSound second("second.wav");;

  • Hi again,
    using Phonon, I face a delemma:

    either I pu a local instance in the method called every time I needa sound to be played and the instance seems dynamically allocated, and my process size increase in memorry:
    @ //-------------------------------------
    //Local Sounds
    Phonon::MediaObject *lTmpmusic =

    Or I use a member in my class, but only the first sound is played

    Is there a way to have a self destructive instance when the sound is finished playing ?
    Or how to "restart" playing the sound when only one member instance is avialable?

Log in to reply