mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-08 03:54:27 +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
|
// update speaker mode
|
||||||
bool new_speaker_is_enabled = (*value & 6) == 2;
|
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();
|
update_audio();
|
||||||
_speaker->set_is_enabled(new_speaker_is_enabled);
|
_speaker->set_is_enabled(new_speaker_is_enabled);
|
||||||
|
speaker_is_enabled_ = new_speaker_is_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
_tape.set_is_enabled((*value & 6) != 6);
|
_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)
|
void Speaker::set_divider(uint8_t divider)
|
||||||
{
|
{
|
||||||
|
enqueue([=]() {
|
||||||
_divider = divider * 32 / clock_rate_audio_divider;
|
_divider = divider * 32 / clock_rate_audio_divider;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Speaker::set_is_enabled(bool is_enabled)
|
void Speaker::set_is_enabled(bool is_enabled)
|
||||||
{
|
{
|
||||||
|
enqueue([=]() {
|
||||||
_is_enabled = is_enabled;
|
_is_enabled = is_enabled;
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -121,7 +121,6 @@ class Speaker: public ::Outputs::Filter<Speaker> {
|
|||||||
void set_divider(uint8_t divider);
|
void set_divider(uint8_t divider);
|
||||||
|
|
||||||
void set_is_enabled(bool is_enabled);
|
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 get_samples(unsigned int number_of_samples, int16_t *target);
|
||||||
void skip_samples(unsigned int number_of_samples);
|
void skip_samples(unsigned int number_of_samples);
|
||||||
@ -238,6 +237,7 @@ class Machine:
|
|||||||
// Outputs
|
// Outputs
|
||||||
std::shared_ptr<Outputs::CRT::CRT> _crt;
|
std::shared_ptr<Outputs::CRT::CRT> _crt;
|
||||||
std::shared_ptr<Speaker> _speaker;
|
std::shared_ptr<Speaker> _speaker;
|
||||||
|
bool speaker_is_enabled_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user