[vlmc-devel] commit: EffectInstance: Fixing a settings problem when the effect was re-initialized ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri Aug 20 00:55:09 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Aug 20 00:51:40 2010 +0200| [07c326813871744a365e2899001daa796e99c161] | committer: Hugo Beauzée-Luyssen 

EffectInstance: Fixing a settings problem when the effect was re-initialized

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=07c326813871744a365e2899001daa796e99c161
---

 src/EffectsEngine/EffectInstance.cpp     |    3 +++
 src/EffectsEngine/EffectSettingValue.cpp |   10 +++++++++-
 src/EffectsEngine/EffectSettingValue.h   |    8 ++++++++
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/EffectsEngine/EffectInstance.cpp b/src/EffectsEngine/EffectInstance.cpp
index e5b1250..1d38226 100644
--- a/src/EffectsEngine/EffectInstance.cpp
+++ b/src/EffectsEngine/EffectInstance.cpp
@@ -62,6 +62,9 @@ EffectInstance::init( quint32 width, quint32 height )
         m_instance = m_effect->m_f0r_construct( width, height );
         m_width = width;
         m_height = height;
+        //Re-apply parameters, as they were lost during f0r_destruct();
+        foreach ( EffectSettingValue* val, m_params.values() )
+            val->apply();
     }
 }
 
diff --git a/src/EffectsEngine/EffectSettingValue.cpp b/src/EffectsEngine/EffectSettingValue.cpp
index edb8be5..2b7a4ac 100644
--- a/src/EffectsEngine/EffectSettingValue.cpp
+++ b/src/EffectsEngine/EffectSettingValue.cpp
@@ -68,7 +68,15 @@ EffectSettingValue::set( const QVariant &val )
         qCritical() << "Setting type" << m_type << "is not handled by the effects engine";
         break;
     }
-    m_effectInstance->effect()->m_f0r_set_param_value( m_effectInstance->m_instance, m_paramBuff, m_index );
+    apply();
+}
+
+void
+EffectSettingValue::apply()
+{
+    if ( m_paramBuff != NULL )
+        m_effectInstance->effect()->m_f0r_set_param_value( m_effectInstance->m_instance,
+                                                           m_paramBuff, m_index );
 }
 
 quint32
diff --git a/src/EffectsEngine/EffectSettingValue.h b/src/EffectsEngine/EffectSettingValue.h
index 02e6df4..d570a1a 100644
--- a/src/EffectsEngine/EffectSettingValue.h
+++ b/src/EffectsEngine/EffectSettingValue.h
@@ -41,6 +41,14 @@ class EffectSettingValue : public SettingValue
         f0r_param_t     getFrei0rParameter() const;
         virtual void    set( const QVariant& val );
         quint32         index() const;
+        /**
+         *  \brief      Force the parameter to apply, even if no change is detected
+         *              from VLMC side.
+         *
+         *  This is usefull when the instance had been destroyed, and the params should
+         *  be applied again.
+         */
+        void            apply();
         static Type     frei0rToVlmc( int type );
 
     private:



More information about the Vlmc-devel mailing list