summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-15 20:01:54 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-15 20:01:54 +0200
commit16c39e953ef0b3df06a7aee6b510de37a2bcc15c (patch)
tree22a40d31009bc1187e5a002711d8b493788e3a0a
parent2a373d19a912fdd6b713bcb2150f19333d583174 (diff)
Fix audio cache test - missing updateChunkSize call before processing.
-rw-r--r--src/audiocache.cc2
-rw-r--r--test/audiocachetest.cc19
2 files changed, 14 insertions, 7 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index aecb208..b01d752 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -68,6 +68,8 @@ sample_t* AudioCache::open(const AudioFile& file,
std::size_t initial_samples_needed,
int channel, cacheid_t& id)
{
+ assert(chunk_size); // Assert updateChunkSize was called before processing.
+
if(!file.isValid())
{
// File preload not yet ready - skip this sample.
diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc
index ae3e8f2..0e3db10 100644
--- a/test/audiocachetest.cc
+++ b/test/audiocachetest.cc
@@ -57,7 +57,7 @@ public:
//! \param thread Control if this test is running in threaded mode or not.
//! \param framesize The initial framesize to use.
void testHelper(const char* filename, int channel, bool threaded,
- int framesize)
+ int framesize, int num_channels)
{
// Reference file:
AudioFile audio_file_ref(filename, channel);
@@ -77,6 +77,7 @@ public:
// Set initial (upper limit) framesize
audio_cache.setFrameSize(framesize);
+ audio_cache.updateChunkSize(num_channels);
cacheid_t id;
@@ -149,7 +150,8 @@ public:
// Conduct test
int channel = 0;
bool threaded = false;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ int num_channels = 1;
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
}
void singleChannelThreaded()
@@ -161,7 +163,8 @@ public:
// Conduct test
int channel = 0;
bool threaded = true;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ int num_channels = 1;
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
}
void multiChannelNonThreaded()
@@ -173,9 +176,10 @@ public:
// Conduct test
int channel = 0;
bool threaded = false;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ int num_channels = 13;
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
++channel;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
}
void multiChannelThreaded()
@@ -187,9 +191,10 @@ public:
// Conduct test
int channel = 0;
bool threaded = true;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ int num_channels = 13;
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
++channel;
- testHelper(filename.c_str(), channel, threaded, FRAMESIZE);
+ testHelper(filename.c_str(), channel, threaded, FRAMESIZE, num_channels);
}
};