summaryrefslogtreecommitdiff
path: root/src/audiocache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audiocache.cc')
-rw-r--r--src/audiocache.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index 237a3ff..e098fd0 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -62,10 +62,10 @@ void AudioCache::deinit()
}
// Invariant: initial_samples_needed < preloaded audio data
-sample_t* AudioCache::open(AudioFile* file, size_t initial_samples_needed,
+sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed,
int channel, cacheid_t& id)
{
- if(!file->isValid())
+ if(!file.isValid())
{
// File preload not yet ready - skip this sample.
id = CACHE_DUMMYID;
@@ -87,7 +87,7 @@ sample_t* AudioCache::open(AudioFile* file, size_t initial_samples_needed,
// Get the cache_t connected with the registered id.
cache_t& c = id_manager.getCache(id);
- c.afile = &event_handler.openFile(file->filename);
+ c.afile = &event_handler.openFile(file.filename);
c.channel = channel;
// Next call to 'next()' will read from this point.
@@ -97,25 +97,25 @@ sample_t* AudioCache::open(AudioFile* file, size_t initial_samples_needed,
c.back = nullptr; // This is allocated when needed.
// cropped_size is the preload chunk size cropped to sample length.
- size_t cropped_size = file->preloadedsize - c.localpos;
+ size_t cropped_size = file.preloadedsize - c.localpos;
cropped_size /= framesize;
cropped_size *= framesize;
cropped_size += initial_samples_needed;
- if(file->preloadedsize == file->size)
+ if(file.preloadedsize == file.size)
{
// We have preloaded the entire file, so use it.
- cropped_size = file->preloadedsize;
+ cropped_size = file.preloadedsize;
}
- c.preloaded_samples = file->data;
+ c.preloaded_samples = file.data;
c.preloaded_samples_size = cropped_size;
// Next read from disk will read from this point.
c.pos = cropped_size;//c.preloaded_samples_size;
// Only load next buffer if there are more data in the file to be loaded...
- if(c.pos < file->size)
+ if(c.pos < file.size)
{
if(c.back == nullptr)
{