Fixed constness
This commit is contained in:
parent
c14fb1c7b2
commit
ce204c68de
|
@ -1,9 +1,9 @@
|
||||||
#include "AudioStream.h"
|
#include "AudioStream.h"
|
||||||
|
|
||||||
TimeRange AudioStream::getTruncatedRange() {
|
TimeRange AudioStream::getTruncatedRange() const {
|
||||||
return TimeRange(centiseconds::zero(), centiseconds(100 * getSampleCount() / getSampleRate()));
|
return TimeRange(centiseconds::zero(), centiseconds(100 * getSampleCount() / getSampleRate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioStream::endOfStream() {
|
bool AudioStream::endOfStream() const {
|
||||||
return getSampleIndex() >= getSampleCount();
|
return getSampleIndex() >= getSampleCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
class AudioStream {
|
class AudioStream {
|
||||||
public:
|
public:
|
||||||
virtual ~AudioStream() {}
|
virtual ~AudioStream() {}
|
||||||
virtual std::unique_ptr<AudioStream> clone(bool reset) = 0;
|
virtual std::unique_ptr<AudioStream> clone(bool reset) const = 0;
|
||||||
virtual int getSampleRate() = 0;
|
virtual int getSampleRate() const = 0;
|
||||||
virtual int getSampleCount() = 0;
|
virtual int getSampleCount() const = 0;
|
||||||
TimeRange getTruncatedRange();
|
TimeRange getTruncatedRange() const;
|
||||||
virtual int getSampleIndex() = 0;
|
virtual int getSampleIndex() const = 0;
|
||||||
virtual void seek(int sampleIndex) = 0;
|
virtual void seek(int sampleIndex) = 0;
|
||||||
bool endOfStream();
|
bool endOfStream() const;
|
||||||
virtual float readSample() = 0;
|
virtual float readSample() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,19 +14,19 @@ DCOffset::DCOffset(const DCOffset& rhs, bool reset) :
|
||||||
factor(rhs.factor)
|
factor(rhs.factor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::unique_ptr<AudioStream> DCOffset::clone(bool reset) {
|
std::unique_ptr<AudioStream> DCOffset::clone(bool reset) const {
|
||||||
return std::make_unique<DCOffset>(*this, reset);
|
return std::make_unique<DCOffset>(*this, reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DCOffset::getSampleRate() {
|
int DCOffset::getSampleRate() const {
|
||||||
return inputStream->getSampleRate();
|
return inputStream->getSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DCOffset::getSampleCount() {
|
int DCOffset::getSampleCount() const {
|
||||||
return inputStream->getSampleCount();
|
return inputStream->getSampleCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DCOffset::getSampleIndex() {
|
int DCOffset::getSampleIndex() const {
|
||||||
return inputStream->getSampleIndex();
|
return inputStream->getSampleIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ class DCOffset : public AudioStream {
|
||||||
public:
|
public:
|
||||||
DCOffset(std::unique_ptr<AudioStream> inputStream, float offset);
|
DCOffset(std::unique_ptr<AudioStream> inputStream, float offset);
|
||||||
DCOffset(const DCOffset& rhs, bool reset);
|
DCOffset(const DCOffset& rhs, bool reset);
|
||||||
std::unique_ptr<AudioStream> clone(bool reset) override;
|
std::unique_ptr<AudioStream> clone(bool reset) const override;
|
||||||
int getSampleRate() override;
|
int getSampleRate() const override;
|
||||||
int getSampleCount() override;
|
int getSampleCount() const override;
|
||||||
int getSampleIndex() override;
|
int getSampleIndex() const override;
|
||||||
void seek(int sampleIndex) override;
|
void seek(int sampleIndex) override;
|
||||||
float readSample() override;
|
float readSample() override;
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,19 @@ SampleRateConverter::SampleRateConverter(const SampleRateConverter& rhs, bool re
|
||||||
nextOutputSampleIndex = reset ? 0 : rhs.nextOutputSampleIndex;
|
nextOutputSampleIndex = reset ? 0 : rhs.nextOutputSampleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<AudioStream> SampleRateConverter::clone(bool reset) {
|
std::unique_ptr<AudioStream> SampleRateConverter::clone(bool reset) const {
|
||||||
return std::make_unique<SampleRateConverter>(*this, reset);
|
return std::make_unique<SampleRateConverter>(*this, reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SampleRateConverter::getSampleRate() {
|
int SampleRateConverter::getSampleRate() const {
|
||||||
return outputSampleRate;
|
return outputSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SampleRateConverter::getSampleCount() {
|
int SampleRateConverter::getSampleCount() const {
|
||||||
return outputSampleCount;
|
return outputSampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SampleRateConverter::getSampleIndex() {
|
int SampleRateConverter::getSampleIndex() const {
|
||||||
return nextOutputSampleIndex;
|
return nextOutputSampleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ class SampleRateConverter : public AudioStream {
|
||||||
public:
|
public:
|
||||||
SampleRateConverter(std::unique_ptr<AudioStream> inputStream, int outputSampleRate);
|
SampleRateConverter(std::unique_ptr<AudioStream> inputStream, int outputSampleRate);
|
||||||
SampleRateConverter(const SampleRateConverter& rhs, bool reset);
|
SampleRateConverter(const SampleRateConverter& rhs, bool reset);
|
||||||
std::unique_ptr<AudioStream> clone(bool reset) override;
|
std::unique_ptr<AudioStream> clone(bool reset) const override;
|
||||||
int getSampleRate() override;
|
int getSampleRate() const override;
|
||||||
int getSampleCount() override;
|
int getSampleCount() const override;
|
||||||
int getSampleIndex() override;
|
int getSampleIndex() const override;
|
||||||
void seek(int sampleIndex) override;
|
void seek(int sampleIndex) override;
|
||||||
float readSample() override;
|
float readSample() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,19 +16,19 @@ UnboundedStream::UnboundedStream(const UnboundedStream& rhs, bool reset) :
|
||||||
lastSample(rhs.lastSample)
|
lastSample(rhs.lastSample)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::unique_ptr<AudioStream> UnboundedStream::clone(bool reset) {
|
std::unique_ptr<AudioStream> UnboundedStream::clone(bool reset) const {
|
||||||
return std::make_unique<UnboundedStream>(*this, reset);
|
return std::make_unique<UnboundedStream>(*this, reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UnboundedStream::getSampleRate() {
|
int UnboundedStream::getSampleRate() const {
|
||||||
return innerStream->getSampleRate();
|
return innerStream->getSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
int UnboundedStream::getSampleCount() {
|
int UnboundedStream::getSampleCount() const {
|
||||||
return innerStream->getSampleCount();
|
return innerStream->getSampleCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int UnboundedStream::getSampleIndex() {
|
int UnboundedStream::getSampleIndex() const {
|
||||||
return sampleIndex;
|
return sampleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ class UnboundedStream : public AudioStream {
|
||||||
public:
|
public:
|
||||||
UnboundedStream(std::unique_ptr<AudioStream> inputStream);
|
UnboundedStream(std::unique_ptr<AudioStream> inputStream);
|
||||||
UnboundedStream(const UnboundedStream& rhs, bool reset);
|
UnboundedStream(const UnboundedStream& rhs, bool reset);
|
||||||
std::unique_ptr<AudioStream> clone(bool reset) override;
|
std::unique_ptr<AudioStream> clone(bool reset) const override;
|
||||||
int getSampleRate() override;
|
int getSampleRate() const override;
|
||||||
int getSampleCount() override;
|
int getSampleCount() const override;
|
||||||
int getSampleIndex() override;
|
int getSampleIndex() const override;
|
||||||
void seek(int sampleIndex) override;
|
void seek(int sampleIndex) override;
|
||||||
float readSample() override;
|
float readSample() override;
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ WaveFileReader::WaveFileReader(const WaveFileReader& rhs, bool reset) :
|
||||||
seek(reset ? 0 : rhs.sampleIndex);
|
seek(reset ? 0 : rhs.sampleIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<AudioStream> WaveFileReader::clone(bool reset) {
|
std::unique_ptr<AudioStream> WaveFileReader::clone(bool reset) const {
|
||||||
return std::make_unique<WaveFileReader>(*this, reset);
|
return std::make_unique<WaveFileReader>(*this, reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,15 +170,15 @@ void WaveFileReader::openFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaveFileReader::getSampleRate() {
|
int WaveFileReader::getSampleRate() const {
|
||||||
return frameRate;
|
return frameRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaveFileReader::getSampleCount() {
|
int WaveFileReader::getSampleCount() const {
|
||||||
return frameCount;
|
return frameCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaveFileReader::getSampleIndex() {
|
int WaveFileReader::getSampleIndex() const {
|
||||||
return sampleIndex;
|
return sampleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@ class WaveFileReader : public AudioStream {
|
||||||
public:
|
public:
|
||||||
WaveFileReader(boost::filesystem::path filePath);
|
WaveFileReader(boost::filesystem::path filePath);
|
||||||
WaveFileReader(const WaveFileReader& rhs, bool reset);
|
WaveFileReader(const WaveFileReader& rhs, bool reset);
|
||||||
std::unique_ptr<AudioStream> clone(bool reset) override;
|
std::unique_ptr<AudioStream> clone(bool reset) const override;
|
||||||
int getSampleRate() override ;
|
int getSampleRate() const override ;
|
||||||
int getSampleCount() override;
|
int getSampleCount() const override;
|
||||||
int getSampleIndex() override;
|
int getSampleIndex() const override;
|
||||||
void seek(int sampleIndex) override;
|
void seek(int sampleIndex) override;
|
||||||
float readSample() override;
|
float readSample() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue