summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-01-29 16:45:31 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-01-29 16:45:31 +0100
commitbbdde7f2d3c25e0fdc7c9e34c6dafcc8419dab3b (patch)
tree5f3f186cb2b0cb20a7f4b23502b8223e4d242ecd
parent7999bd2e087d5ee696899f1383c187b7e787069a (diff)
wip <blablabla>
-rw-r--r--src/audiocachefile.cc6
-rw-r--r--test/audiocachefiletest.cc8
2 files changed, 9 insertions, 5 deletions
diff --git a/src/audiocachefile.cc b/src/audiocachefile.cc
index 3d566e7..0955b25 100644
--- a/src/audiocachefile.cc
+++ b/src/audiocachefile.cc
@@ -38,7 +38,7 @@ AudioCacheFile::AudioCacheFile(const std::string& filename,
std::vector<sample_t>& read_buffer)
: filename(filename), read_buffer(read_buffer)
{
- std::memset(&sf_info, 0, sizeof(SF_INFO)); // XXX Is this really necessary?
+ std::memset(&sf_info, 0, sizeof(SF_INFO));
fh = sf_open(filename.c_str(), SFM_READ, &sf_info);
if(!fh)
@@ -50,7 +50,7 @@ AudioCacheFile::AudioCacheFile(const std::string& filename,
if(sf_info.frames == 0)
{
- printf("sf_info.frames == 0\n"); // XXX Shouldn't that be debug output?
+ WARN(cache, "sf_info.frames == 0\n");
}
}
@@ -135,7 +135,7 @@ AudioCacheFile& AudioCacheFiles::getFile(const std::string& filename)
auto it = audiofiles.find(filename);
if(it == audiofiles.end())
{
- cacheAudioFile = new AudioCacheFile(filename, read_buffer); // XXX why create a pointer and not move it into the map such that it is the owner?
+ cacheAudioFile = new AudioCacheFile(filename, read_buffer);
audiofiles.insert(std::make_pair(filename, cacheAudioFile));
}
else
diff --git a/test/audiocachefiletest.cc b/test/audiocachefiletest.cc
index 98b7ab5..b7839b7 100644
--- a/test/audiocachefiletest.cc
+++ b/test/audiocachefiletest.cc
@@ -92,7 +92,9 @@ public:
ref_file[c]->load();
}
- AudioCacheFile file(filename);
+ std::vector<sample_t> read_buffer;
+
+ AudioCacheFile file(filename, read_buffer);
CPPUNIT_ASSERT_EQUAL(filename, file.getFilename());
CPPUNIT_ASSERT_EQUAL(13, (int)file.getChannelCount()); // Sanity check
@@ -188,7 +190,9 @@ public:
size_t buffer_size = 64;
std::string filename = "kits/no-such-file.wav";
- AudioCacheFile file(filename);
+ std::vector<sample_t> read_buffer;
+
+ AudioCacheFile file(filename, read_buffer);
CPPUNIT_ASSERT_EQUAL(filename, file.getFilename());
CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getSize());
CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getChannelCount());