Qt MediaPlayer не воспроизводит звук [закрыто] ⇐ C++
-
Anonymous
Qt MediaPlayer не воспроизводит звук [закрыто]
I am trying to make an application where there is a looping background music. I have added the bgm m4a file into the project via CMake. The code in MainWindow is below.
ui->setupUi(this); screamer = new QMediaPlayer(this); audioOutput = new QAudioOutput(this); screamer->setAudioOutput(audioOutput); QString filePath = "bgm.m4a"; qDebug() setSource(QUrl::fromLocalFile(filePath)); audioOutput->setVolume(40); screamer->play(); qDebug() errorString(); Now I am quite sure that the bgm.m4a file was correctly named, the errorString() returns "", and all the codes are executed in the correct order, but there is no sound coming out of my speakers. What am I doing wrong here?
Источник: https://stackoverflow.com/questions/780 ... play-audio
I am trying to make an application where there is a looping background music. I have added the bgm m4a file into the project via CMake. The code in MainWindow is below.
ui->setupUi(this); screamer = new QMediaPlayer(this); audioOutput = new QAudioOutput(this); screamer->setAudioOutput(audioOutput); QString filePath = "bgm.m4a"; qDebug() setSource(QUrl::fromLocalFile(filePath)); audioOutput->setVolume(40); screamer->play(); qDebug() errorString(); Now I am quite sure that the bgm.m4a file was correctly named, the errorString() returns "", and all the codes are executed in the correct order, but there is no sound coming out of my speakers. What am I doing wrong here?
Источник: https://stackoverflow.com/questions/780 ... play-audio
Мобильная версия