play a sound in application
-
wrote on 27 Apr 2016, 17:15 last edited by M4RZB4Ni
Hi.
i want to add a sound effect to my app
that when i clicked on a push button that sound Run
I Wrote this code but sound dose not play!
what i must do?void MainWindow::on_pushButton_2_clicked() { QSound bts("/sounds/cartoon005.wav"); bts.play(); }
-
wrote on 27 Apr 2016, 17:36 last edited by
most likely it can't find the file. try using absolute path
Did you deploy the multimedia plugin? -
most likely it can't find the file. try using absolute path
Did you deploy the multimedia plugin? -
wrote on 27 Apr 2016, 18:09 last edited by yuvaram
Hi,
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
glayout = new QGridLayout(this);
pb_b1 = new QPushButton("sound");
glayout->addWidget(pb_b1);
connect(pb_b1,SIGNAL(clicked()),this,SLOT(SLT_playSound()));
}void Widget:: SLT_playSound(){
QSound::play("D:/pthinks/trash/button_sound/telugu4.wav");
} -
wrote on 27 Apr 2016, 18:16 last edited by
What system are you running? Widows?
-
wrote on 27 Apr 2016, 18:22 last edited by
make sure qtaudio_windows.dll and qtmedia_audioengine.dll plugins are deployed correctly
-
wrote on 27 Apr 2016, 18:24 last edited by
The above code working as expected. So i hope qtaudio_windows.dll and qtmedia_audioengine.dll plugins are deployed correctly. Please let me know if any issue with my code.
-
Hi,
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
glayout = new QGridLayout(this);
pb_b1 = new QPushButton("sound");
glayout->addWidget(pb_b1);
connect(pb_b1,SIGNAL(clicked()),this,SLOT(SLT_playSound()));
}void Widget:: SLT_playSound(){
QSound::play("D:/pthinks/trash/button_sound/telugu4.wav");
}
1/9