Re: Retrive audio duration
As the error says, there is no way for the compiler to convert a QFile object into a QAudioBuffer object.
None of the four constructors of QAudioBuffer takes a QFile by value or reference.
In any case, isn't it more likely that you need QAudioDecoder?
Cheers,
_
Re: Retrive audio duration
I should receive information about the audio file in the queue, and therefore have not yet been processed. Using
Code:
decoder->setSourceFilename(filenames->at(i));
qDebug() << decoder->duration();
Qt returns -1 for all files
Re: Retrive audio duration
Maybe you need to call start() on it.
Cheers,
_
Re: Retrive audio duration
Even calling start(), the result does not change
Code:
decoder->setSourceFilename(filenames->at(i));
decoder->start();
qDebug() << decoder->duration();
This is the Qt error message on debug:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.audiodecode"
Re: Retrive audio duration
Hmm.
Maybe with a QMediaPlayer using a QMetaContext created from a QUrl that was created from the filename with ::fromLocalFile()?
Cheers,
_
Re: Retrive audio duration
Quote:
Originally Posted by
anda_skoa
Link broken :rolleyes:
Re: Retrive audio duration
It's because it is a QMediaContent.
You could have easily guessed that by looking at the documentation of the first class.
And the last link is QUrl::fromLocalFile() before you complain again after not looking yourself.
Cheers,
_