Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to use (pulseaudio) system-libraries in a new QT Program



  • Okay,

    So - Im pretty new here , as well as to programming in general,
    but i've set myself an ambitious goal - and are now trying to reach it, eventually.
    (even though this project of mine might take like centuries but , i'll still try it.)

    What i'm trying to accomplish:

    I want to write an c++ application which uses an system library to speak with an program / or daemon (PulseAudio to be exact here)

    issue is - i have no clue on how to load this libraries.
    i went through the Pulseaudio src , the additional programs like "paprefs" "pactl" "pacmd" and even oder programs based on the code of PulseAudio, "PavuControl" which is shipped in every Ubuntu nowadays to provide a GUI for Pulseaudio.
    But i still cannot figure out how i can load the libs or talk to Pulseaudio otherwise.
    Code Examples tend to be only the code examples , without loading the libs - so i cant learn it from there.

    I want to write an Program , more or less like pavucontrol but with a different functionality.

    But without access to the libraries , i dont even need to start coding.

    yes , as i mentioned i am new , and this project may be a bit insane for my current knowledge. But I want to try to learn with something i wrote myself - probably the best way to learn it, instead of coding hello worlds (although they may be useful in certain circumstances)

    Hope you can help me.
    I'd really appreciate it.

    Ebiko


  • Lifetime Qt Champion

    @Ebiko said in how to use (pulseaudio) system-libraries in a new QT Program:

    i have no clue on how to load this libraries

    Usually you do not load them (though this is also possible). Instead you link your application against these libraries.
    See https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
    And you should read on this topic in general.



  • Yeah , i have found this wizard already -

    In this wizard i selected "Load System Library" and the hit browse , for the linux library , went to the lib folder where its supposed to be.
    I searched the libpulse-simple.so.* (which definitely is in this folder , since i can find it with my usual file browser) but i could not find it in this folder , it just wasnt beeing shown.

    Exempt from "ls -la /usr/lib/x86_64-linux-gnu/"

    lrwxrwxrwx   1 root root       31 Aug 13 12:53 libpulse-mainloop-glib.so.0 -> libpulse-mainloop-glib.so.0.0.5
    -rw-r--r--   1 root root    18576 Aug 13 12:53 libpulse-mainloop-glib.so.0.0.5
    lrwxrwxrwx   1 root root       24 Aug 13 12:53 libpulse-simple.so.0 -> libpulse-simple.so.0.1.1
    -rw-r--r--   1 root root    22760 Aug 13 12:53 libpulse-simple.so.0.1.1
    lrwxrwxrwx   1 root root       18 Aug 13 12:53 libpulse.so.0 -> libpulse.so.0.21.2
    -rw-r--r--   1 root root   343240 Aug 13 12:53 libpulse.so.0.21.2
    
    

    Screenshot_2020-11-18_09-28-55.png


  • Lifetime Qt Champion

    @Ebiko Don't know why these libs are not shown. But you can add them manually as shown in the link I posted:

    LIBS += -lpulse
    


  • seems to be a good start - qt at least doesnt throw an error or warning of some kind - now i need to figure out where to get an .h file from to work with the lib
    but thanks for your help - i didnt notice the "manual" way of adding the lib


  • Lifetime Qt Champion

    @Ebiko said in how to use (pulseaudio) system-libraries in a new QT Program:

    where to get an .h file from to work with the lib
    Install the pulse-dev package



  • @jsulm
    thank you really much - now i can really start to learn/write :D