mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Ensure full buffer provision.
This commit is contained in:
parent
06b6f85d55
commit
3a26f6b8bf
@ -305,8 +305,9 @@ template <bool is_stereo> class PushLowpass: public LowpassBase<PushLowpass<is_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
void get_samples(size_t length, int16_t *target) {
|
void get_samples(size_t length, int16_t *target) {
|
||||||
memcpy(target, buffer_, length);
|
const auto word_length = length * (1 + is_stereo);
|
||||||
buffer_ += length;
|
memcpy(target, buffer_, word_length * sizeof(int16_t));
|
||||||
|
buffer_ += word_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -320,10 +321,16 @@ template <bool is_stereo> class PushLowpass: public LowpassBase<PushLowpass<is_s
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Filters and posts onward the provided buffer, on the calling thread.
|
Filters and posts onward the provided buffer, on the calling thread.
|
||||||
|
|
||||||
|
@param buffer The source for samples.
|
||||||
|
@param length The number of samples provided; in mono this will be the number of int16_ts
|
||||||
|
it is safe to read from @c buffer, and in stereo it will be half the number — it is a count
|
||||||
|
of the number of time points at which audio was sampled.
|
||||||
*/
|
*/
|
||||||
void push(const int16_t *buffer, size_t length) {
|
void push(const int16_t *buffer, size_t length) {
|
||||||
buffer_ = buffer;
|
buffer_ = buffer;
|
||||||
process(length);
|
process(length);
|
||||||
|
assert(buffer_ == buffer + (length * (1 + is_stereo)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user