summaryrefslogtreecommitdiff
path: root/src/audiofile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audiofile.cc')
-rw-r--r--src/audiofile.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/audiofile.cc b/src/audiofile.cc
index 511df27..37fb5cc 100644
--- a/src/audiofile.cc
+++ b/src/audiofile.cc
@@ -171,7 +171,7 @@ void AudioFile::reset()
mutex.unlock();
}
-void AudioFile::load()
+void AudioFile::load(int num_samples)
{
/*
Lazy load of drum kits
@@ -191,6 +191,8 @@ void AudioFile::load()
size = sf_info.frames;
+ if(num_samples != ALL_SAMPLES && (int)size > num_samples) size = num_samples;
+
sample_t* data = new sample_t[size];
size = sf_read_float(fh, data, size);