PDA

View Full Version : Problem with QMediaPlayer and QAudioProbe



mohabb
10th March 2015, 15:38
Thanks for reading my post .

I am developing a small project to process audio. The program allows both read an .mp3 file or record sound from the microphone .

While playing or recording shows the user the energy of the signal and the spectrum.
When I want to record sound I use QAudioRecorder and everything works properly. The problem is that if I want to read an .mp3 file does not work.I have a problem connecting QMediaPlayer and QAudioProbe.


mediaPlayer=new QMediaPlayer(this);
audioProbe = new QAudioProbe(this);

if (audioProbe->setSource(mediaPlayer)) {
// Probing succeeded, audioProbe->isValid() should be true.
connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)),
this, SLOT(calculateLevel(QAudioBuffer)));
cout << "All work correctly" << endl;
}else{
cout << "Some problems" << endl;
}
mediaPlayer->setMedia(fileSelected);
mediaPlayer->setVolume(50);
mediaPlayer->play();



The sound is played correctly but I fail to connect with QAudioProbe . How I can connect it? Thanks.

Melkman
26th May 2015, 09:34
Could you get this fixed, I have the same problem?