1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Eliminates repeating cause of misuse.

Raises the question as to whether an async task queue should be required at construction; let's see how things look as the project develops.
This commit is contained in:
Thomas Harte 2018-04-21 15:01:18 -07:00
parent 5968c9a391
commit 074b4c3500

View File

@ -86,6 +86,18 @@ template <typename T> class LowpassSpeaker: public Speaker {
filter_parameters_.parameters_are_dirty = true; filter_parameters_.parameters_are_dirty = true;
} }
/*!
Schedules an advancement by the number of cycles specified on the provided queue.
The speaker will advance by obtaining data from the sample source supplied
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) {
queue.defer([this, cycles] {
run_for(cycles);
});
}
private:
/*! /*!
Advances by the number of cycles specified, obtaining data from the sample source supplied Advances by the number of cycles specified, obtaining data from the sample source supplied
at construction, filtering it and passing it on to the speaker's delegate if there is one. at construction, filtering it and passing it on to the speaker's delegate if there is one.
@ -173,16 +185,6 @@ template <typename T> class LowpassSpeaker: public Speaker {
// TODO: input rate is less than output rate // TODO: input rate is less than output rate
} }
/*!
Provides a convenience shortcut for deferring a call to run_for.
*/
void run_for(Concurrency::DeferringAsyncTaskQueue &queue, const Cycles cycles) {
queue.defer([this, cycles] {
run_for(cycles);
});
}
private:
T &sample_source_; T &sample_source_;
std::size_t output_buffer_pointer_ = 0; std::size_t output_buffer_pointer_ = 0;