Ejemplo n.º 1
0
    foreach (Phonon::EffectDescription effect, effects) {
        QTreeWidgetItem *item = new QTreeWidgetItem(effectsTreeWidget);
        item->setText(0, tr("Effect"));
        item->setText(1, effect.name());
        item->setText(2, effect.description());
//! [effects]

//! [effectsParameters]
        Phonon::Effect *instance = new Phonon::Effect(effect, this);
        QList<Phonon::EffectParameter> parameters = instance->parameters();
        for (int i = 0; i < parameters.size(); ++i) {
                Phonon::EffectParameter parameter = parameters.at(i);

            QVariant defaultValue = parameter.defaultValue();
            QVariant minimumValue = parameter.minimumValue();
            QVariant maximumValue = parameter.maximumValue();

            QString valueString = QString("%1 / %2 / %3")
                    .arg(defaultValue.toString()).arg(minimumValue.toString())
                    .arg(maximumValue.toString()); 

            QTreeWidgetItem *parameterItem = new QTreeWidgetItem(item);
            parameterItem->setText(0, tr("Parameter"));
            parameterItem->setText(1, parameter.name());
            parameterItem->setText(2, parameter.description());
            parameterItem->setText(3, QVariant::typeToName(parameter.type()));
            parameterItem->setText(4, valueString);
        }
    }
Ejemplo n.º 2
0
 QVariant Effect::parameterValue(const Phonon::EffectParameter &p) const
 {
     QVariant ret;
     ComPointer<IMediaParams> params(m_filters[0], IID_IMediaParams);
     Q_ASSERT(params);
     MP_DATA data;
     HRESULT hr = params->GetParam(p.id(), &data);
     if(SUCCEEDED(hr))
         return data;
     else
         return QVariant();
 }
Ejemplo n.º 3
0
        void Effect::setParameterValue(const Phonon::EffectParameter &p, const QVariant &v)
        {
            if (v.isNull()) {
                return;
            }

            for(int i=0; i < FILTER_COUNT ; ++i) {
                const Filter &filter = m_filters[i];
                ComPointer<IMediaParams> params(filter, IID_IMediaParams);
                Q_ASSERT(params);

                params->SetParam(p.id(), v.toFloat());
            }
        }
Ejemplo n.º 4
0
 QVariant Effect::parameterValue(const Phonon::EffectParameter &p) const
 {
     QVariant ret;
     if (!m_filters.isEmpty()) {
         ComPointer<IMediaParams> params(m_filters.first(), IID_IMediaParams);
         Q_ASSERT(params);
         MP_DATA data;
         HRESULT hr = params->GetParam(p.id(), &data);
         Q_ASSERT(SUCCEEDED(hr));
         Q_UNUSED(hr);
         ret = data;
     }
     return ret;
 }
Ejemplo n.º 5
0
        void Effect::setParameterValue(const Phonon::EffectParameter &p, const QVariant &v)
        {
            if (v.isNull()) {
                return;
            }

            for(QVector<Filter>::iterator it = m_filters.begin(); it != m_filters.end(); ++it) {
                Filter &filter = *it;
                ComPointer<IMediaParams> params(filter, IID_IMediaParams);
                Q_ASSERT(params);

                MP_DATA data = float(v.toDouble());
                params->SetParam(p.id(), data);
            }
        }
Ejemplo n.º 6
0
uint qHash(const Phonon::EffectParameter &param)
{
    return param.id();
}