Create this code :
class JMediaPlayer
: public QWidget{
Q_OBJECT
public:
JMediaPlayer
(QWidget *parent
= 0,
bool initVideo
= true);
~JMediaPlayer();
private:
Phonon::MediaObject * mediaObject;
Phonon::AudioOutput * audioOutput;
Phonon::VideoWidget * videoWidget;
Phonon::Path audioOutputPath;
Phonon::Effect * audiopanorama;
Phonon::Effect * equalizer;
...
...
...
...
JMediaPlayer::JMediaPlayer(QWidget *parent,
bool initVideo
) : QWidget(parent
), video
(initVideo
) { mediaObject = new Phonon::MediaObject(this);
videoWidget = new Phonon::VideoWidget(this);
if (video) Phonon::createPath(mediaObject, videoWidget);
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
audioOutputPath = Phonon::createPath(mediaObject, audioOutput);
}
void JMediaPlayer::audiopanoramaEnable( bool state )
{
if ( state ) {
QList<Phonon::EffectDescription> availableEffects = Phonon::BackendCapabilities::availableAudioEffects();
for (int i=0; i<availableEffects.size(); i++){
if ( availableEffects[i].name() == "audiopanorama") {
audioOutputPath.insertEffect(availableEffects[i]);
audiopanorama = new Phonon::Effect(availableEffects[i]);
}
}
QList<Phonon::Effect *> currEffects = audioOutputPath.effects();
qDebug() << "effects in path - " << currEffects.size();
foreach (Phonon::Effect * effect, currEffects){
qDebug() << "name - " << effect->description().name();
}
}
}
void JMediaPlayer::balanceLeft()
{
for (int k=0 ; k < audiopanorama->parameters().size() ; ++k) {
Phonon::EffectParameter param = audiopanorama->parameters()[k];
QVariant currentValue
= audiopanorama
->parameterValue
(param
);
audiopanorama->setParameterValue(param, currentValue.toDouble() + 0.1);
}
}
void JMediaPlayer::balanceRight()
{
for (int k=0 ; k < audiopanorama->parameters().size() ; ++k) {
Phonon::EffectParameter param = audiopanorama->parameters()[k];
QVariant currentValue
= audiopanorama
->parameterValue
(param
);
audiopanorama->setParameterValue(param, currentValue.toDouble() - 0.1);
}
}
class JMediaPlayer : public QWidget
{
Q_OBJECT
public:
JMediaPlayer(QWidget *parent = 0, bool initVideo = true);
~JMediaPlayer();
private:
Phonon::MediaObject * mediaObject;
Phonon::AudioOutput * audioOutput;
Phonon::VideoWidget * videoWidget;
Phonon::Path audioOutputPath;
Phonon::Effect * audiopanorama;
Phonon::Effect * equalizer;
...
...
...
...
JMediaPlayer::JMediaPlayer(QWidget *parent, bool initVideo)
: QWidget(parent), video(initVideo)
{ mediaObject = new Phonon::MediaObject(this);
videoWidget = new Phonon::VideoWidget(this);
if (video) Phonon::createPath(mediaObject, videoWidget);
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
audioOutputPath = Phonon::createPath(mediaObject, audioOutput);
}
void JMediaPlayer::audiopanoramaEnable( bool state )
{
if ( state ) {
QList<Phonon::EffectDescription> availableEffects = Phonon::BackendCapabilities::availableAudioEffects();
for (int i=0; i<availableEffects.size(); i++){
if ( availableEffects[i].name() == "audiopanorama") {
audioOutputPath.insertEffect(availableEffects[i]);
audiopanorama = new Phonon::Effect(availableEffects[i]);
}
}
QList<Phonon::Effect *> currEffects = audioOutputPath.effects();
qDebug() << "effects in path - " << currEffects.size();
foreach (Phonon::Effect * effect, currEffects){
qDebug() << "name - " << effect->description().name();
}
}
}
void JMediaPlayer::balanceLeft()
{
for (int k=0 ; k < audiopanorama->parameters().size() ; ++k) {
Phonon::EffectParameter param = audiopanorama->parameters()[k];
QVariant currentValue = audiopanorama->parameterValue(param);
audiopanorama->setParameterValue(param, currentValue.toDouble() + 0.1);
}
}
void JMediaPlayer::balanceRight()
{
for (int k=0 ; k < audiopanorama->parameters().size() ; ++k) {
Phonon::EffectParameter param = audiopanorama->parameters()[k];
QVariant currentValue = audiopanorama->parameterValue(param);
audiopanorama->setParameterValue(param, currentValue.toDouble() - 0.1);
}
}
To copy to clipboard, switch view to plain text mode
audioOutputPath.effects() (in 40) include effect AUDIOPANORAMA ... but no worked .
In '/usr/local/Trolltech/Qt-4.4.0/demo/mediaplayer' all work.
Why ?
Bookmarks