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/source.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/source.cc')
-rw-r--r-- | libs/ardour/source.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index b9ea6ee78a..b3476ec8f4 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -25,8 +25,8 @@ #include <cmath> #include <iomanip> #include <algorithm> -#include <fstream> +#include <pbd/gstdio_compat.h> #include <glibmm/threads.h> #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> @@ -187,27 +187,23 @@ Source::set_been_analysed (bool yn) int Source::load_transients (const string& path) { - ifstream file (path.c_str()); - - if (!file) { + FILE *tf; + if (! (tf = g_fopen (path.c_str (), "rb"))) { return -1; } transients.clear (); - - stringstream strstr; - double val; - - while (file.good()) { - file >> val; - - if (!file.fail()) { - framepos_t frame = (framepos_t) floor (val * _session.frame_rate()); - transients.push_back (frame); + while (!feof (tf) && !ferror(tf)) { + double val; + if (1 != fscanf (tf, "%lf", &val)) { + break; } + + framepos_t frame = (framepos_t) floor (val * _session.frame_rate()); + transients.push_back (frame); } - return 0; + ::fclose (tf); } string |