mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
That's thread safety, subject to the async task queue being made to work...
This commit is contained in:
parent
e53455a936
commit
de658b70d7
@ -226,10 +226,11 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
|
||||
// update speaker mode
|
||||
bool new_speaker_is_enabled = (*value & 6) == 2;
|
||||
if(new_speaker_is_enabled != _speaker->get_is_enabled())
|
||||
if(new_speaker_is_enabled != speaker_is_enabled_)
|
||||
{
|
||||
update_audio();
|
||||
_speaker->set_is_enabled(new_speaker_is_enabled);
|
||||
speaker_is_enabled_ = new_speaker_is_enabled;
|
||||
}
|
||||
|
||||
_tape.set_is_enabled((*value & 6) != 6);
|
||||
@ -958,13 +959,17 @@ void Speaker::skip_samples(unsigned int number_of_samples)
|
||||
|
||||
void Speaker::set_divider(uint8_t divider)
|
||||
{
|
||||
_divider = divider * 32 / clock_rate_audio_divider;
|
||||
enqueue([=]() {
|
||||
_divider = divider * 32 / clock_rate_audio_divider;
|
||||
});
|
||||
}
|
||||
|
||||
void Speaker::set_is_enabled(bool is_enabled)
|
||||
{
|
||||
_is_enabled = is_enabled;
|
||||
_counter = 0;
|
||||
enqueue([=]() {
|
||||
_is_enabled = is_enabled;
|
||||
_counter = 0;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -121,7 +121,6 @@ class Speaker: public ::Outputs::Filter<Speaker> {
|
||||
void set_divider(uint8_t divider);
|
||||
|
||||
void set_is_enabled(bool is_enabled);
|
||||
inline bool get_is_enabled() { return _is_enabled; }
|
||||
|
||||
void get_samples(unsigned int number_of_samples, int16_t *target);
|
||||
void skip_samples(unsigned int number_of_samples);
|
||||
@ -238,6 +237,7 @@ class Machine:
|
||||
// Outputs
|
||||
std::shared_ptr<Outputs::CRT::CRT> _crt;
|
||||
std::shared_ptr<Speaker> _speaker;
|
||||
bool speaker_is_enabled_;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user