On Wed, 2012-01-18 at 01:41 +0100, Christian Schoenebeck wrote:
> On Tuesday 17 January 2012 17:05:07 David Robillard wrote:
> > Aaaaaaand yet another state patch :)
> > 
> > This one properly conforms to the state extension by using/preferring
> > features passed to the state methods if they are present.  It does not
> > break anything (i.e. the ones passed to instantiate will still be used
> > as before).
> 
> Just commited. Thanks!

Aaaaaaaaaaaand another one.  Couple of minor screw-ups in the previous.

-dr

Index: src/hostplugins/lv2/PluginLv2.cpp
===================================================================
--- src/hostplugins/lv2/PluginLv2.cpp	(revision 2307)
+++ src/hostplugins/lv2/PluginLv2.cpp	(working copy)
@@ -189,12 +189,12 @@
         uint32_t type;
         uint32_t flags;
 
-        // Attempt to restore from state-file
         const void* value = retrieve(
             handle,
             uri_to_id(NULL, NS_LS "state-file"),
             &size, &type, &flags);
         if (value) {
+            // Restore from state-file
             assert(type == uri_to_id(NULL, LV2_STATE_PATH_URI));
             const String path((const char*)value);
             dmsg(2, ("linuxsampler: restoring from file %s\n", path.c_str()));
@@ -202,25 +202,22 @@
             String state;
             std::getline(in, state, '\0');
             SetState(state);
-            return;
-        }
-
-        // Attempt to restore from state-string
-        value = retrieve(
-                handle,
-                uri_to_id(NULL, NS_LS "state-string"),
-                &size, &type, &flags);
-        if (value) {
+        } else if ((value = retrieve(handle,
+                                     uri_to_id(NULL, NS_LS "state-string"),
+                                     &size, &type, &flags))) {
+            // Restore from state-string
             dmsg(2, ("linuxsampler: restoring from string\n"));
             assert(type == uri_to_id(NULL, NS_ATOM "String"));
             String state((const char*)value);
             SetState(state);
-            return;
+        } else {
+            // No valid state found, reset to default state
+            dmsg(2, ("linuxsampler: restoring default state\n"));
+            SetState(DefaultState);
         }
 
-        // No valid state found, reset to default state
-        dmsg(2, ("linuxsampler: restoring default state\n"));
-        SetState(DefaultState);
+        MapPath  = OldMapPath;
+        MakePath = OldMakePath;
 
         MapPath  = OldMapPath;
         MakePath = OldMakePath;
Index: src/hostplugins/lv2/lv2_state.h
===================================================================
--- src/hostplugins/lv2/lv2_state.h	(revision 2307)
+++ src/hostplugins/lv2/lv2_state.h	(working copy)
@@ -37,8 +37,8 @@
 
 #define LV2_STATE_INTERFACE_URI LV2_STATE_URI "#Interface"
 #define LV2_STATE_PATH_URI      LV2_STATE_URI "#Path"
-#define LV2_STATE_MAP_PATH_URI  LV2_STATE_URI "#pathMap"
-#define LV2_STATE_MAKE_PATH_URI LV2_STATE_URI "#newPath"
+#define LV2_STATE_MAP_PATH_URI  LV2_STATE_URI "#mapPath"
+#define LV2_STATE_MAKE_PATH_URI LV2_STATE_URI "#makePath"
 
 typedef void* LV2_State_Handle;
 typedef void* LV2_State_Map_Path_Handle;
@@ -55,7 +55,7 @@
 	/**
 	   Plain Old Data.
 
-	   Values with this flag contain no references to non-stateent or
+	   Values with this flag contain no references to non-persistent or
 	   non-global resources (e.g. pointers, handles, local paths, etc.). It is
 	   safe to copy POD values with a simple memcpy and store them for use at
 	   any time in the future on a machine with a compatible architecture
@@ -221,7 +221,6 @@
 	             uint32_t                   flags,
 	             const LV2_Feature *const * features);
 
-
 	/**
 	   Restore plugin state using a host-provided @c retrieve callback.
 
@@ -257,7 +256,7 @@
 } LV2_State_Interface;
 
 /**
-   Feature data for state:pathMap (LV2_STATE_MAP_PATH_URI).
+   Feature data for state:mapPath (LV2_STATE_MAP_PATH_URI).
 */
 typedef struct {
 
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to