diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-01-26 08:42:18 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-01-26 08:42:18 +0100 |
commit | cb220c27929600ff7a1980bbe421290e39b2eddc (patch) | |
tree | ba817c8081e21f0bbd1bfe7042e7ce962bf2e35f /src/audiofile.cc | |
parent | 06842ff2d9c727fe46f5da82ae1e43e74be6e588 (diff) |
Background loader for audio files.
Diffstat (limited to 'src/audiofile.cc')
-rw-r--r-- | src/audiofile.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/audiofile.cc b/src/audiofile.cc index 018b7fb..1927034 100644 --- a/src/audiofile.cc +++ b/src/audiofile.cc @@ -31,15 +31,18 @@ #include <sndfile.h> +#include <hugin.hpp> + AudioFile::AudioFile(std::string filename) { + is_loaded = false; //printf("new AudioFile %p\n", this); this->filename = filename; data = NULL; size = 0; - load(); + //load(); } AudioFile::~AudioFile() @@ -74,5 +77,21 @@ void AudioFile::load() sf_read_float(fh, data, size); sf_close(fh); + + mutex.lock(); + is_loaded = true; + mutex.unlock(); + + DEBUG(audiofile, "Loading of %s completed.\n", filename.c_str()); } +bool AudioFile::isLoaded() +{ + bool l; + + mutex.lock(); + l = is_loaded; + mutex.unlock(); + + return l; +} |