mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Gets explicit that the delegate_
doesn't need a memory barrier.
This commit is contained in:
parent
f34a9b4346
commit
7b1708f0bc
@ -131,7 +131,7 @@ template <typename SampleSource> class LowpassSpeaker: public Speaker {
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
void run_for(const Cycles cycles) {
|
void run_for(const Cycles cycles) {
|
||||||
const auto delegate = delegate_.load();
|
const auto delegate = delegate_.load(std::memory_order::memory_order_relaxed);
|
||||||
if(!delegate) return;
|
if(!delegate) return;
|
||||||
|
|
||||||
const int scale = get_scale();
|
const int scale = get_scale();
|
||||||
|
@ -89,7 +89,7 @@ class Speaker {
|
|||||||
virtual void speaker_did_change_input_clock([[maybe_unused]] Speaker *speaker) {}
|
virtual void speaker_did_change_input_clock([[maybe_unused]] Speaker *speaker) {}
|
||||||
};
|
};
|
||||||
virtual void set_delegate(Delegate *delegate) {
|
virtual void set_delegate(Delegate *delegate) {
|
||||||
delegate_ = delegate;
|
delegate_.store(delegate, std::memory_order::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class Speaker {
|
|||||||
protected:
|
protected:
|
||||||
void did_complete_samples(Speaker *, const std::vector<int16_t> &buffer, bool is_stereo) {
|
void did_complete_samples(Speaker *, const std::vector<int16_t> &buffer, bool is_stereo) {
|
||||||
// Test the delegate for existence again, as it may have changed.
|
// Test the delegate for existence again, as it may have changed.
|
||||||
const auto delegate = delegate_.load();
|
const auto delegate = delegate_.load(std::memory_order::memory_order_relaxed);
|
||||||
if(!delegate) return;
|
if(!delegate) return;
|
||||||
|
|
||||||
++completed_sample_sets_;
|
++completed_sample_sets_;
|
||||||
|
Loading…
Reference in New Issue
Block a user