Solved Beep function is blocking the QT application.
-
Currently I am using Beep function to generate the sound with required frequency and duration.
WINBASEAPI WINBOOL WINAPI Beep (DWORD dwFreq, DWORD dwDuration);
But it is blocking the QT application and my application do not send messages when this function is executed.
Is it any other way I can play sound with required frequency and duration ? May be some way using QMediaPlayer ?
-
@Ayush-Gupta said in Beep function is blocking the QT application.:
Is it any other way I can play sound with required frequency and duration ? May be some way using QMediaPlayer ?
QSound
is more lightweight thanQMediaPlayer
. You'll need to supply your own beeping .wav file. -
@Ayush-Gupta said in Beep function is blocking the QT application.:
Is it any other way I can play sound with required frequency and duration ? May be some way using QMediaPlayer ?
QSound
is more lightweight thanQMediaPlayer
. You'll need to supply your own beeping .wav file. -
@Ayush-Gupta
If you can/are prepared to use a Qt call like @JKSH'sQSound
I would favor that way.But if for some reason it's not suitable and you want to stick with
WINAPI Beep()
, and you say it blocks while sounding, you may be able to call just this from a thread so your Qt app remains responsive. You would have to test this out to see if it works OK, I don't know.