Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Problem of repeated reading
Forum Updated to NodeBB v4.3 + New Features

Problem of repeated reading

Scheduled Pinned Locked Moved C++ Gurus
14 Posts 3 Posters 3.9k 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.
  • 9 Offline
    9 Offline
    9temps
    wrote on last edited by
    #5

    hello,
    Thank you for the answer, but sorry, I do not understand the answer.
    Does your answer shows how to solve my problem?
    Or, is your answer indicates that the line of code that I give is not working as it is?

    I gave the function that starts playing (void clavier::aasynthe), and indicated that it has a connect without further detail.

    To see the code under linux, this is :
    http://www.letime.net/vocale/lmfab1.tar.gz
    ( look at lmfab69 )
    and the explanation here
    http://doc.ubuntu-fr.org/lmfab

    I do not show the link under windows because the audio format is .jo fee owner under windows, only the code is given, and can only be used after purchasing the right to use the audio format abadie.jo

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

      No, it shows where there's one problem lying.

      In lmfab69, the button clicked signal is connected to the quit slot of QApplication. In your code you connect it to a slot that doesn't belong to QApplication and also that has a signature mismatch that makes the connection invalid.

      As for the error 12, "here's":http://technet.microsoft.com/en-us/library/cc732199(v=ws.10).aspx the relevant article from Microsoft

      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
      • jeremy_kJ Offline
        jeremy_kJ Offline
        jeremy_k
        wrote on last edited by
        #7

        There's a QMediaPlayer object leaked by every call to clavier::aasynthe(char, int). Perhaps that's the cause of the error 12. According to the article SGaist linked to: Code 12: This device cannot find enough free resources that it can use.

        With regards to the connect(), see the "signals and slots documentation":http://qt-project.org/doc/qt-4.8/signalsandslots.html#signals-and-slots . In particular, The signature of a signal must match the signature of the receiving slot. (In fact a slot may have a shorter signature than the signal it receives because it can ignore extra arguments.)

        Asking a question about code? http://eel.is/iso-c++/testcase/

        1 Reply Last reply
        0
        • 9 Offline
          9 Offline
          9temps
          wrote on last edited by
          #8

          hello,
          Thank you for the clarification.
          If I understand correctly, the click of mouse works as it should, but the call on the keyboard creates a defect that is only supported by Linux.
          This fact comes from the keyboard is outside: QWidget ()

          Do you think it is possible to put the keyboard in QWidget ()

          kind regards

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

            It's not a question of "only supported by Linux". Things are handled differently and by luck it's working, but anyway you still have a memory leak.

            @
            QMediaPlayer *lelecteur;
            lelecteur = new QMediaPlayer;
            @

            You should only have one player and re-use it

            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
            • 9 Offline
              9 Offline
              9temps
              wrote on last edited by
              #10

              hello,
              Thank you for the clarification.

              if I understand correctly, QMediaPlayer can not play multiple sounds simultaneously.

              Although it appears no visible defect in the linux terminal.

              must be changed

              // void keyPressEvent(QKeyEvent* event);
              in
              void keyPressEvent(QKeyEvent *);

              in clavier.h

              Under Linux we can use fork and sox as a solution.
              under windows can we use handle ?

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

                No, it's not it's purpose. It should play one media at a time.

                You would like to play several file at the same time ?

                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
                • 9 Offline
                  9 Offline
                  9temps
                  wrote on last edited by
                  #12

                  hello,
                  Yes, that's exactly it.
                  I need to play multiple sounds at the same time.
                  What I can do with fork and sox with Linux.
                  I wanted to do a version with QMediaPlayer

                  kind regards

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

                    QSoundEffect might be more suited

                    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
                    • 9 Offline
                      9 Offline
                      9temps
                      wrote on last edited by
                      #14

                      hello,
                      After several tests,
                      I think use sndfile.h
                      qt compiles fine, but the sounds are played on exit,
                      I have to correct the code.
                      kind regards

                      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