mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-16 05:27:43 +00:00
Edging towards functioning automatic tests, fixed right-period adjustment and slightly decreased searching cost while in the process of adding a test.
This commit is contained in:
@@ -55,11 +55,24 @@
|
|||||||
|
|
||||||
- (void)testZeroPatch
|
- (void)testZeroPatch
|
||||||
{
|
{
|
||||||
std::shared_ptr<Storage::Disk::Track> patchableTrack = self.togglingTrack;
|
std::shared_ptr<Storage::Disk::Track> patchableTrack = self.patchableTogglingTrack;
|
||||||
Storage::Disk::PCMPatchedTrack *patchable = dynamic_cast<Storage::Disk::PCMPatchedTrack *>(patchableTrack.get());
|
Storage::Disk::PCMPatchedTrack *patchable = dynamic_cast<Storage::Disk::PCMPatchedTrack *>(patchableTrack.get());
|
||||||
if(patchable)
|
if(patchable)
|
||||||
{
|
{
|
||||||
printf(".");
|
// add a single one, at 1/32 length at 3/128. So that should shift the location of the second flux transition
|
||||||
|
Storage::Disk::PCMSegment zero_segment;
|
||||||
|
zero_segment.data = {0xff};
|
||||||
|
zero_segment.number_of_bits = 1;
|
||||||
|
zero_segment.length_of_a_bit.length = 1;
|
||||||
|
zero_segment.length_of_a_bit.clock_rate = 32;
|
||||||
|
patchable->add_segment(Storage::Time(3, 128), zero_segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Storage::Disk::Track::Event> events;
|
||||||
|
int c = 5;
|
||||||
|
while(c--)
|
||||||
|
{
|
||||||
|
events.push_back(patchableTrack->get_next_event());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ void PCMPatchedTrack::insert_period(const Period &period)
|
|||||||
while(periods_[start_index].start_time >= period.end_time) start_index++;
|
while(periods_[start_index].start_time >= period.end_time) start_index++;
|
||||||
|
|
||||||
// find the existing period that the new period end in
|
// find the existing period that the new period end in
|
||||||
size_t end_index = 0;
|
size_t end_index = start_index;
|
||||||
while(periods_[end_index].end_time < period.end_time) end_index++;
|
while(periods_[end_index].end_time < period.end_time) end_index++;
|
||||||
|
|
||||||
// perform a division if called for
|
// perform a division if called for
|
||||||
@@ -62,8 +62,8 @@ void PCMPatchedTrack::insert_period(const Period &period)
|
|||||||
{
|
{
|
||||||
Period right_period = periods_[start_index];
|
Period right_period = periods_[start_index];
|
||||||
|
|
||||||
Time adjustment = period.start_time - right_period.start_time;
|
Time adjustment = period.end_time - right_period.start_time;
|
||||||
right_period.end_time += adjustment;
|
right_period.start_time += adjustment;
|
||||||
right_period.segment_start_time += adjustment;
|
right_period.segment_start_time += adjustment;
|
||||||
|
|
||||||
periods_[start_index].end_time = period.start_time;
|
periods_[start_index].end_time = period.start_time;
|
||||||
@@ -75,8 +75,8 @@ void PCMPatchedTrack::insert_period(const Period &period)
|
|||||||
// perform a left chop on the thing at the start and a right chop on the thing at the end
|
// perform a left chop on the thing at the start and a right chop on the thing at the end
|
||||||
periods_[start_index].end_time = period.start_time;
|
periods_[start_index].end_time = period.start_time;
|
||||||
|
|
||||||
Time adjustment = period.start_time - periods_[end_index].start_time;
|
Time adjustment = period.end_time - periods_[end_index].start_time;
|
||||||
periods_[end_index].end_time += adjustment;
|
periods_[end_index].start_time += adjustment;
|
||||||
periods_[end_index].segment_start_time += adjustment;
|
periods_[end_index].segment_start_time += adjustment;
|
||||||
|
|
||||||
// remove anything in between
|
// remove anything in between
|
||||||
|
Reference in New Issue
Block a user