/[svn]/linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2311 by persson, Sat Feb 11 11:08:09 2012 UTC revision 2340 by capela, Fri Mar 30 23:54:44 2012 UTC
# Line 45  namespace { Line 45  namespace {
45              dmsg(2, ("linuxsampler: init feature: %s\n", Features[i]->URI));              dmsg(2, ("linuxsampler: init feature: %s\n", Features[i]->URI));
46              if (!strcmp(Features[i]->URI, LV2_URI_MAP_URI)) {              if (!strcmp(Features[i]->URI, LV2_URI_MAP_URI)) {
47                  UriMap = (LV2_URI_Map_Feature*)Features[i]->data;                  UriMap = (LV2_URI_Map_Feature*)Features[i]->data;
48              } else if (!strcmp(Features[i]->URI, LV2_STATE_MAP_PATH_URI)) {              } else if (!strcmp(Features[i]->URI, LV2_STATE__mapPath)) {
49                  MapPath = (LV2_State_Map_Path*)Features[i]->data;                  MapPath = (LV2_State_Map_Path*)Features[i]->data;
50              } else if (!strcmp(Features[i]->URI, LV2_STATE_MAKE_PATH_URI)) {              } else if (!strcmp(Features[i]->URI, LV2_STATE__makePath)) {
51                  MakePath = (LV2_State_Make_Path*)Features[i]->data;                  MakePath = (LV2_State_Make_Path*)Features[i]->data;
52              }              }
53          }          }
# Line 126  namespace { Line 126  namespace {
126      {      {
127          for (int i = 0 ; Features[i] ; i++) {          for (int i = 0 ; Features[i] ; i++) {
128              dmsg(2, ("linuxsampler: state feature: %s\n", Features[i]->URI));              dmsg(2, ("linuxsampler: state feature: %s\n", Features[i]->URI));
129              if (!strcmp(Features[i]->URI, LV2_STATE_MAP_PATH_URI)) {              if (!strcmp(Features[i]->URI, LV2_STATE__mapPath)) {
130                  MapPath = (LV2_State_Map_Path*)Features[i]->data;                  MapPath = (LV2_State_Map_Path*)Features[i]->data;
131              } else if (!strcmp(Features[i]->URI, LV2_STATE_MAKE_PATH_URI)) {              } else if (!strcmp(Features[i]->URI, LV2_STATE__makePath)) {
132                  MakePath = (LV2_State_Make_Path*)Features[i]->data;                  MakePath = (LV2_State_Make_Path*)Features[i]->data;
133              }              }
134          }          }
135      }      }
136    
137      void PluginLv2::Save(LV2_State_Store_Function store, LV2_State_Handle handle,      LV2_State_Status PluginLv2::Save(
138                           uint32_t flags, const LV2_Feature* const* features)              LV2_State_Store_Function store, LV2_State_Handle handle,
139                uint32_t flags, const LV2_Feature* const* features)
140      {      {
141          LV2_State_Map_Path*  OldMapPath  = MapPath;          LV2_State_Map_Path*  OldMapPath  = MapPath;
142          LV2_State_Make_Path* OldMakePath = MakePath;          LV2_State_Make_Path* OldMakePath = MakePath;
# Line 154  namespace { Line 155  namespace {
155                    uri_to_id(NULL, NS_LS "state-file"),                    uri_to_id(NULL, NS_LS "state-file"),
156                    path,                    path,
157                    strlen(path) + 1,                    strlen(path) + 1,
158                    uri_to_id(NULL, LV2_STATE_PATH_URI),                    uri_to_id(NULL, NS_ATOM "Path"),
159                    LV2_STATE_IS_PORTABLE);                    LV2_STATE_IS_PORTABLE);
160    
161              free(path);              free(path);
# Line 176  namespace { Line 177  namespace {
177    
178          MapPath  = OldMapPath;          MapPath  = OldMapPath;
179          MakePath = OldMakePath;          MakePath = OldMakePath;
180    
181            return LV2_STATE_SUCCESS;
182      }      }
183    
184      void PluginLv2::Restore(LV2_State_Retrieve_Function retrieve, LV2_State_Handle handle,      LV2_State_Status PluginLv2::Restore(
185                              uint32_t rflags, const LV2_Feature* const* features)              LV2_State_Retrieve_Function retrieve, LV2_State_Handle handle,
186                uint32_t rflags, const LV2_Feature* const* features)
187      {      {
188          LV2_State_Map_Path*  OldMapPath  = MapPath;          LV2_State_Map_Path*  OldMapPath  = MapPath;
189          LV2_State_Make_Path* OldMakePath = MakePath;          LV2_State_Make_Path* OldMakePath = MakePath;
# Line 195  namespace { Line 199  namespace {
199              &size, &type, &flags);              &size, &type, &flags);
200          if (value) {          if (value) {
201              // Restore from state-file              // Restore from state-file
202              assert(type == uri_to_id(NULL, LV2_STATE_PATH_URI));              assert(type == uri_to_id(NULL, NS_ATOM "Path"));
203              const String path((const char*)value);              const String path((const char*)value);
204              dmsg(2, ("linuxsampler: restoring from file %s\n", path.c_str()));              dmsg(2, ("linuxsampler: restoring from file %s\n", path.c_str()));
205              std::ifstream in(path.c_str());              std::ifstream in(path.c_str());
# Line 219  namespace { Line 223  namespace {
223          MapPath  = OldMapPath;          MapPath  = OldMapPath;
224          MakePath = OldMakePath;          MakePath = OldMakePath;
225    
226          MapPath  = OldMapPath;          return LV2_STATE_SUCCESS;
         MakePath = OldMakePath;  
227      }      }
228    
229      LV2_Handle instantiate(const LV2_Descriptor* descriptor,      LV2_Handle instantiate(const LV2_Descriptor* descriptor,
# Line 249  namespace { Line 252  namespace {
252          delete static_cast<PluginLv2*>(instance);          delete static_cast<PluginLv2*>(instance);
253      }      }
254    
255      void save(LV2_Handle handle, LV2_State_Store_Function store,      LV2_State_Status save(LV2_Handle handle, LV2_State_Store_Function store,
256                LV2_State_Handle state,                            LV2_State_Handle state,
257                uint32_t flags, const LV2_Feature* const* features) {                            uint32_t flags, const LV2_Feature* const* features) {
258          return static_cast<PluginLv2*>(handle)->Save(          return static_cast<PluginLv2*>(handle)->Save(
259              store, state, flags, features);              store, state, flags, features);
260      }      }
261    
262      void restore(LV2_Handle handle, LV2_State_Retrieve_Function retrieve,      LV2_State_Status restore(LV2_Handle handle, LV2_State_Retrieve_Function retrieve,
263                   LV2_State_Handle state,                               LV2_State_Handle state,
264                   uint32_t flags, const LV2_Feature* const* features) {                               uint32_t flags, const LV2_Feature* const* features) {
265          return static_cast<PluginLv2*>(handle)->Restore(          return static_cast<PluginLv2*>(handle)->Restore(
266              retrieve, state, flags, features);              retrieve, state, flags, features);
267      }      }
# Line 281  namespace { Line 284  namespace {
284    
285      const void* extension_data(const char* uri) {      const void* extension_data(const char* uri) {
286          dmsg(2, ("linuxsampler: extension_data %s\n", uri));          dmsg(2, ("linuxsampler: extension_data %s\n", uri));
287          if (strcmp(uri, LV2_STATE_URI "#Interface") == 0) {          if (strcmp(uri, LV2_STATE__interface) == 0) {
288              return PluginInfo::Lv2StateInterface();              return PluginInfo::Lv2StateInterface();
289          }          }
290          return 0;          return 0;

Legend:
Removed from v.2311  
changed lines
  Added in v.2340

  ViewVC Help
Powered by ViewVC