mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Adds defences against double calls to end writing.
This commit is contained in:
parent
98751e6ac8
commit
a85909198f
@ -104,8 +104,10 @@ void Controller::begin_writing(bool clamp_to_index_hole) {
|
||||
}
|
||||
|
||||
void Controller::end_writing() {
|
||||
is_reading_ = true;
|
||||
get_drive().end_writing();
|
||||
if(!is_reading_) {
|
||||
is_reading_ = true;
|
||||
get_drive().end_writing();
|
||||
}
|
||||
}
|
||||
|
||||
bool Controller::is_reading() {
|
||||
|
@ -237,16 +237,18 @@ void Drive::write_bit(bool value) {
|
||||
}
|
||||
|
||||
void Drive::end_writing() {
|
||||
is_reading_ = true;
|
||||
if(!is_reading_) {
|
||||
is_reading_ = true;
|
||||
|
||||
if(!patched_track_) {
|
||||
// Avoid creating a new patched track if this one is already patched
|
||||
patched_track_ = std::dynamic_pointer_cast<PCMPatchedTrack>(track_);
|
||||
if(!patched_track_) {
|
||||
patched_track_.reset(new PCMPatchedTrack(track_));
|
||||
// Avoid creating a new patched track if this one is already patched
|
||||
patched_track_ = std::dynamic_pointer_cast<PCMPatchedTrack>(track_);
|
||||
if(!patched_track_) {
|
||||
patched_track_.reset(new PCMPatchedTrack(track_));
|
||||
}
|
||||
}
|
||||
patched_track_->add_segment(write_start_time_, write_segment_, clamp_writing_to_index_hole_);
|
||||
cycles_since_index_hole_ %= get_input_clock_rate();
|
||||
invalidate_track();
|
||||
}
|
||||
patched_track_->add_segment(write_start_time_, write_segment_, clamp_writing_to_index_hole_);
|
||||
cycles_since_index_hole_ %= get_input_clock_rate();
|
||||
invalidate_track();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user