Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. sound sometimes breaks up

sound sometimes breaks up

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nishiokasN Offline
    nishiokasN Offline
    nishiokas
    wrote on last edited by
    #1

    I am creating a QML application that plays sound by clicking "Play Sound Button".
    I use "QSoundEffect"
    and this application have function.
    function has hard work.

    I click button then do function.
    sound breaks up.

    code like this.

    MouseArea {
    onClicked: {
    QSoundEffect effect;
    effect.setSource(QUrl::fromLocalFile("engine.wav"));
    effect.setLoopCount(QSoundEffect::Infinite);
    effect.setVolume(0.25f);
    effect.play();
    }
    }
    function() {
    //hard work( TCP/IP communication)
    waitRecieveSomething()
    }

    I'd like to here clear sound.
    How should I do?

    thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Shouldn't that "hard working" function be moved in its own thread to avoid blocking the main thread and likely the sound effect ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • nishiokasN Offline
        nishiokasN Offline
        nishiokas
        wrote on last edited by
        #3

        Thanks for reply!
        I think you are right. but it's so difficult.
        Because this application so big and it has many "hard work".

        I'd like to keep sound in "hard work".
        it's impossible?

        J.HilkJ 1 Reply Last reply
        0
        • nishiokasN nishiokas

          Thanks for reply!
          I think you are right. but it's so difficult.
          Because this application so big and it has many "hard work".

          I'd like to keep sound in "hard work".
          it's impossible?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @nishiokas
          Why don't you move your SoundEffects in its own thread instead?


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved