Results 1 to 11 of 11

Thread: generating beep sound in Qt under linux platform

  1. #1
    Join Date
    Feb 2006
    Posts
    9
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default generating beep sound in Qt under linux platform

    Hai,

    I know in window when a '\a' is printed it alerts sound is generated. But Same character is used in Qt with linux why does not it generates beep sound... so can anybody help me how do i proceed in Qt Since i need to generate the alarm when the value reaches less the some value. Basically i want to know how to generate the bell sound in Qt. Including printf("\a\a\a\a"); in Qt code doesn't work. Help please.................
    Last edited by babusunlux; 3rd July 2006 at 09:55. Reason: change of title

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Sound access is a platform depended operation.
    That is why under linux you don't get the beep with \a.
    From reading QSound (Qt3 as I see you use Qt3) you can see that the trolls are offering a platform independent way to play wav files.
    If you want to access the PC speaker (not through soud card) then I think you will have to write platform dependent code.
    If you want it to compile and work under more than one OS you will need to use #ifdef for conditional compilation.

  3. #3
    Join Date
    Feb 2006
    Posts
    9
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: generating beep sound in Qt under linux platform

    Hai

    ok fine.. But I can run .wav files in qt to generate sound from speaker. If it is how do i proceed. If it is using QSound.. But i have not worked much on it.. Please help me and i will be very greatful to you...


    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Playing wavs on the speaker is not trivial.
    It is much easier if you just use #ifdef sections with platform dependent code.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Quote Originally Posted by babusunlux
    But I can run .wav files in qt to generate sound from speaker. If it is how do i proceed. If it is using QSound.. But i have not worked much on it..
    If you just want to play a .wav file in Qt3/X11 you have to compile Qt with NAS support. See QSound docs for more information.

  6. #6
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Try to use this method:
    Qt Code:
    1. void QApplication::beep ()
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Playing wavs on the speaker is not trivial.
    Wel,playing wavs on the speaker is not trivial, but a beep is (so it seems) :-)

  8. #8
    Join Date
    Feb 2006
    Posts
    9
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: generating beep sound in Qt under linux platform

    Hai..

    My QTapplication is something like this...
    It scans value from a device where a two limits will be already set. If the scanned value reaches those values i need to generate a sound from speaker to alert the user.....
    I tried a lot of ways to play .wav file but it was not working. But when i check using Sound Card Detection it works fine....
    So how do i proceed with this....
    I had tired the beep() also in my application but it didn't work... I found that NAS has to be installed... So i installed it and it has been asked to rebuild the Qt application means reconfigure the qt application... Since i am using Fedora Core 4 i am not finding the ./configure file to run under any Qt folder... So can anyboby help me how do i proceed... or any idea to overcome this problem..

    With Regards
    Babu.K

  9. #9
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Quote Originally Posted by babusunlux
    I had tired the beep() also in my application but it didn't work... I found that NAS has to be installed... So i installed it and it has been asked to rebuild the Qt application means reconfigure the qt application... Since i am using Fedora Core 4 i am not finding the ./configure file to run under any Qt folder... So can anyboby help me how do i proceed... or any idea to overcome this problem.
    You may need to remove the prepackaged Qt and build your own.

  10. #10
    Join Date
    Feb 2006
    Posts
    9
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: generating beep sound in Qt under linux platform

    Hai...
    Thanks for your support so much..
    Since i am working on Fedora Core 4. and i have installed the NAS and finding difficult in rebuilding the Qt. Since Qt software i am using is with the OS.. So i am not finding a way to reconfigure.... I thought let me try a sample program with beep()..

    I tried just giving ---- QApplication :: beep(); ---- But still I didn't hear any beep sound from my computer. Can anybody help me in this regard..

    With Regards,
    Babu.K

  11. #11
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: generating beep sound in Qt under linux platform

    Check a list of modules of your system (lsmod | grep pcspkr). Is there pcspkr module? If it is not present then install it (modprobe pcspkr).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.