summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-12 17:36:08 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-15 08:57:35 +0200
commit87e0b9b288c0157544cfcefb63015a319507698a (patch)
treeddb9585029d76b522f8e4d173c30da55bde7aa61
parent5bc9578f8d80029ae6d37471450a6ec23350de23 (diff)
Use std::size types.
-rw-r--r--src/audiocache.cc15
-rw-r--r--src/audiocache.h14
2 files changed, 15 insertions, 14 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index 2deecc9..7d80ae9 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -52,7 +52,7 @@ AudioCache::~AudioCache()
DEBUG(cache, "~AudioCache() post\n");
}
-void AudioCache::init(size_t poolsize)
+void AudioCache::init(std::size_t poolsize)
{
setAsyncMode(true);
@@ -66,7 +66,8 @@ void AudioCache::deinit()
}
// Invariant: initial_samples_needed < preloaded audio data
-sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed,
+sample_t* AudioCache::open(const AudioFile& file,
+ std::size_t initial_samples_needed,
int channel, cacheid_t& id)
{
if(!file.isValid())
@@ -100,7 +101,7 @@ sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed,
c.front = nullptr; // This is allocated when needed.
c.back = nullptr; // This is allocated when needed.
- size_t cropped_size;
+ std::size_t cropped_size;
if(file.preloadedsize == file.size)
{
@@ -146,7 +147,7 @@ sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed,
return c.preloaded_samples; // return preloaded data
}
-sample_t* AudioCache::next(cacheid_t id, size_t& size)
+sample_t* AudioCache::next(cacheid_t id, std::size_t& size)
{
size = framesize;
@@ -248,7 +249,7 @@ void AudioCache::close(cacheid_t id)
event_handler.pushCloseEvent(id);
}
-void AudioCache::setFrameSize(size_t framesize)
+void AudioCache::setFrameSize(std::size_t framesize)
{
DEBUG(cache, "%s\n", __PRETTY_FUNCTION__);
@@ -265,7 +266,7 @@ void AudioCache::setFrameSize(size_t framesize)
nodata = new sample_t[framesize];
nodata_framesize = framesize;
- for(size_t i = 0; i < framesize; ++i)
+ for(std::size_t i = 0; i < framesize; ++i)
{
nodata[i] = 0.0f;
}
@@ -276,7 +277,7 @@ void AudioCache::setFrameSize(size_t framesize)
event_handler.setChunkSize(CHUNKSIZE(framesize));
}
-size_t AudioCache::getFrameSize() const
+std::size_t AudioCache::getFrameSize() const
{
return framesize;
}
diff --git a/src/audiocache.h b/src/audiocache.h
index 761f2b2..475f1aa 100644
--- a/src/audiocache.h
+++ b/src/audiocache.h
@@ -51,7 +51,7 @@ public:
//! This method starts the cache manager thread.
//! This method blocks until the thread has been started.
//! \param poolsize The maximum number of parellel events supported.
- void init(size_t poolsize);
+ void init(std::size_t poolsize);
//! Stop thread and clean up resources.
//! This method blocks until the thread has stopped.
@@ -68,7 +68,7 @@ public:
//! \param [out] new_id The newly created cache id.
//! \return A pointer to the first buffer containing the
//! 'initial_samples_needed' number of samples.
- sample_t* open(const AudioFile& file, size_t initial_samples_needed, int channel,
+ sample_t* open(const AudioFile& file, std::size_t initial_samples_needed, int channel,
cacheid_t& new_id);
//! Get next buffer.
@@ -78,7 +78,7 @@ public:
//! \param id The cache id to read from.
//! \param [out] size The size of the returned buffer.
//! \return A pointer to the buffer.
- sample_t* next(cacheid_t id, size_t &size);
+ sample_t* next(cacheid_t id, std::size_t &size);
//! Returns true iff the next chunk of the supplied id has been read from disk.
bool isReady(cacheid_t id);
@@ -89,8 +89,8 @@ public:
void close(cacheid_t id);
//! Set/get internal framesize used when iterating through cache buffers.
- void setFrameSize(size_t framesize);
- size_t getFrameSize() const;
+ void setFrameSize(std::size_t framesize);
+ std::size_t getFrameSize() const;
//! Control/get reader threaded mode.
//! True means reading happening threaded, false means all reading done
@@ -99,9 +99,9 @@ public:
bool isAsyncMode() const;
private:
- size_t framesize{0};
+ std::size_t framesize{0};
sample_t* nodata{nullptr};
- size_t nodata_framesize{0};
+ std::size_t nodata_framesize{0};
AudioCacheIDManager id_manager;
AudioCacheEventHandler event_handler{id_manager};