【发布时间】:2016-02-19 10:33:59
【问题描述】:
我正忙着做一个混响算法。在使用QSound 时,我发现了一些问题。
首先,像这样尝试QSound::play() 时不会播放声音:
/// Play output .wav file.
QSound sound("C:/Users/mvdelft/Documents/Reverb_configurator/output.wav", this);
sound.play();
只有当我使用QSound::play(QString 文件)重新指定路径时,它才会播放声音,如下所示:
/// Play output .wav file.
QSound sound("C:/Users/mvdelft/Documents/Reverb_configurator/output.wav", this);
sound.play("C:/Users/mvdelft/Documents/Reverb_configurator/output.wav");
我遇到的一个相关问题与函数 bool QSound::isFinshed() 有关,它对我不起作用。代码:
/// Play output .wav file.
QSound sound("C:/Users/mvdelft/Documents/Reverb_configurator/output.wav", this);
sound.play("C:/Users/mvdelft/Documents/Reverb_configurator/output.wav");
sound.setLoops(10);
/// Check is sound is finished
while (!sound.isFinished()){}
ui->listWidget->addItem("Finished playing sound");
}/// End of scope
【问题讨论】:
标签: c++ qt5.5 qtmultimedia