Hi,
i am trying to set Volume Level using Phonon Library and VolumeSlider widget.
it works and changes the current volume level but after closing form and play a sound file, nothing changes in volume level.
here my code:
//on constructor of form:
mediaObject = new Phonon::MediaObject(this);
mediaObject->setCurrentSource(Phonon::MediaSource("/home/root/aaa.wav"));
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
Phonon::Path path = Phonon::createPath(mediaObject, audioOutput);
connect(audioOutput,SIGNAL(volumeChanged(qreal)),t his,SLOT(volumeChanged(qreal)));
volumeSlider = new Phonon::VolumeSlider;
volumeSlider->setAudioOutput(audioOutput);
ui->verticalLayoutSound->addWidget(volumeSlider,1,Qt::AlignCenter);
volumeSlider->setGeometry(0,0,200,30);
volumeSlider->setOrientation(Qt::Orientation::Vertical);
volumeSlider->setMouseTracking(true);
volumeSlider->setUpdatesEnabled(true);
volumeSlider->show();
//and slot:
void formDiagnostic::volumeChanged(qreal newLevel)
{
qreal volumeLevel = audioOutput->volume();
qDebug() << "Volume Changed To:" << volumeLevel;//this works
}
thanx in advance..
Bookmarks