• 8299阅读
  • 2回复

救助,QSound无法播放wav [复制链接]

上一主题 下一主题
离线ankoe
 
只看楼主 倒序阅读 楼主  发表于: 2009-06-01
SoundPlayer::SoundPlayer():
    QMainWindow(),
    qs1("sounds/1.wav"),
    qs2("sounds/2.wav")
{
    if (!QSound::isAvailable()) {
        QMessageBox::warning(this,"No Sound",tr("can't find audio drives"));
    }

    Q3PopupMenu *file = new Q3PopupMenu;
    file->insertItem("Play &1",  this, SLOT(doPlay1()), Qt::CTRL+Qt::Key_1);
    file->insertItem("Play &2",  this, SLOT(doPlay2()), Qt::CTRL+Qt::Key_2);
    file->insertItem("Play from bucket &3",  this, SLOT(doPlay3()), Qt::CTRL+Qt::Key_3);
    file->insertItem("Play from bucket &4",  this, SLOT(doPlay4()), Qt::CTRL+Qt::Key_4);
    file->insertSeparator();
    file->insertItem("Play 3 and 4 together",  this, SLOT(doPlay34()));
    file->insertItem("Play all together",  this, SLOT(doPlay1234()));
    file->insertSeparator();
    file->insertItem("E&xit",  this, SLOT(quit()));
    menuBar()->insertItem("&File", file);
}
问题如下:
    if (!QSound::isAvailable()) {
        QMessageBox::warning(this,"No Sound",tr("can't find audio drives"));
    }
QSound::isAvailable()一直是返回false,要什么样的情况下它才返回true.是不是要装相应的解码驱动??,大哥们帮个忙啊。先谢谢啦。

我的环境:ubuntu 9.04+QT4.51
离线tianyu18ren

只看该作者 1楼 发表于: 2009-06-02
好象需要安装nas,相当于一个插件吧...
离线ingenious

只看该作者 2楼 发表于: 2015-12-26
D:\Qt\noteBook\mainwindow.cpp:26: error:
'isAvailable' is not a member of 'QSound'
     if (!QSound::isAvailable())
          ^
快速回复
限100 字节
 
上一个 下一个