mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Avoid the whole thread hop for a zero-length run_for.
This commit is contained in:
parent
10108303e7
commit
75f3f1a77f
@ -368,6 +368,10 @@ template <typename SampleSource> class PullLowpass: public LowpassBase<PullLowpa
|
||||
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
||||
*/
|
||||
void run_for(Concurrency::DeferringAsyncTaskQueue &queue, const Cycles cycles) {
|
||||
if(cycles == Cycles(0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
queue.defer([this, cycles] {
|
||||
run_for(cycles);
|
||||
});
|
||||
@ -383,10 +387,7 @@ template <typename SampleSource> class PullLowpass: public LowpassBase<PullLowpa
|
||||
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
||||
*/
|
||||
void run_for(const Cycles cycles) {
|
||||
std::size_t cycles_remaining = size_t(cycles.as_integral());
|
||||
if(!cycles_remaining) return;
|
||||
|
||||
process(cycles_remaining);
|
||||
process(size_t(cycles.as_integral()));
|
||||
}
|
||||
|
||||
SampleSource &sample_source_;
|
||||
|
Loading…
Reference in New Issue
Block a user