Effect and EffectParameters

Thierry Bastian thierry.bastian at trolltech.com
Fri Jun 29 10:01:28 CEST 2007


Hi all,

While still having a look at the API, I came across the Effect,
EffectParameter and AddonInterface. I think it is very cool and very
flexible for us.

Effect and EffectParameter clearly helps enumerating the effects there are
on the backend side.

I attached a patch to show the differences I made to the classes. It doesn't
work out of the box because I made no change to the backend so far.


1 Effect
--------
Setting a parameter value would be something that would be done by passing
an 'int'. I changed that so that it takes an EffectParameter

To me it is then more logical to iterate over the EffectParameter you're
looking for and then set the value.
Example:

    Phonon::Effect *effect = ...;
	...
    QList<Phonon::EffectParameter> l = effect->allDescriptions();
//shouldn't allDescriptions be named something like parameters()
    foreach(Phonon::EffectParameter ep, l) {
        if (ep.name() == "blabla") {
            effect->setParameterValue(ep, 3);
        } else {
            //do something else
        }
    }


2 EffectParameter
-----------------

I've seen that some type are managed. For now it was integers, doubles and
bool. I changed that a bit so that it is a bit more generic and returns the
type as QVariant::Type. This heavily depends on the backend so that's just
to make it more generic.
In addition to that, I added possibleValues() that returns a QVariantList.
It can often happen that you can choose a value for a filter among some
predefined values. So this will return the possible values.

I modified the EffectWidget so that it compiles but didn't for example add
radio buttons when the value of the parameter is enumerated (ie. has
possible values).


3 AddonInterface
----------------

I think this one is probably a good way to extend the capabilities of the
different part of phonon without adding to much classes/interfaces/casts.


Have a nice day.

Best Regards,
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: effect.patch
Type: application/octet-stream
Size: 10823 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/phonon-backends/attachments/20070629/7675a6ba/attachment-0001.obj 


More information about the Phonon-backends mailing list