diff options
author | Robin Gareus <robin@gareus.org> | 2015-10-05 21:43:44 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-10-05 22:15:17 +0200 |
commit | 97bd6db2b7c52d636fca9dc340aeb3f6cef7de4d (patch) | |
tree | aa1d81caf3c4bbb83c4c4f0d225f4c2a3db22433 /libs/ardour/automatable.cc | |
parent | b9c8814959eb184fff3e5552e2928a156b62602d (diff) |
remove i/ofstream from libardour
except:
* audio-unit (ifstream is known to work on OSX)
* evoral curve algorithm debugger
* cycle-timer debug code
* export_handler's CDMarker -> TODO
Diffstat (limited to 'libs/ardour/automatable.cc')
-rw-r--r-- | libs/ardour/automatable.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index a2ce81acca..b26052d59b 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -17,10 +17,10 @@ */ -#include <fstream> #include <cstdio> #include <errno.h> +#include <pbd/gstdio_compat.h> #include <glibmm/miscutils.h> #include "pbd/error.h" @@ -98,7 +98,8 @@ Automatable::load_automation (const string& path) fullpath = _a_session.automation_dir(); fullpath += path; } - ifstream in (fullpath.c_str()); + + FILE * in = g_fopen (fullpath.c_str (), "rb"); if (!in) { warning << string_compose(_("cannot open %2 to load automation data (%3)") @@ -110,14 +111,17 @@ Automatable::load_automation (const string& path) set<Evoral::Parameter> tosave; controls().clear (); - while (in) { + while (!feof(in)) { double when; double value; uint32_t port; - in >> port; if (!in) break; - in >> when; if (!in) goto bad; - in >> value; if (!in) goto bad; + if (3 != fscanf (in, "%d %lf %lf", &port, &when, &value)) { + if (feof(in)) { + break; + } + goto bad; + } Evoral::Parameter param(PluginAutomation, 0, port); /* FIXME: this is legacy and only used for plugin inserts? I think? */ @@ -125,12 +129,14 @@ Automatable::load_automation (const string& path) c->list()->add (when, value); tosave.insert (param); } + ::fclose (in); return 0; bad: error << string_compose(_("cannot load automation data from %2"), fullpath) << endmsg; controls().clear (); + ::fclose (in); return -1; } |