diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index ac97ad808..bd78c6635 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -39,6 +39,7 @@ 4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */; }; 4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */; }; 4B3BA0D11D318B44005DD7A7 /* TestMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CD1D318B44005DD7A7 /* TestMachine.mm */; }; + 4B3F1B461E0388D200DB26EE /* PCMPatchedTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */; }; 4B44EBF51DC987AF00A7820C /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */; }; 4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */; }; 4B44EBF91DC9898E00A7820C /* BCDTEST_beeb in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF81DC9898E00A7820C /* BCDTEST_beeb */; }; @@ -482,6 +483,8 @@ 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6532Bridge.mm; sourceTree = ""; }; 4B3BA0CC1D318B44005DD7A7 /* TestMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachine.h; sourceTree = ""; }; 4B3BA0CD1D318B44005DD7A7 /* TestMachine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine.mm; sourceTree = ""; }; + 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMPatchedTrack.cpp; sourceTree = ""; }; + 4B3F1B451E0388D200DB26EE /* PCMPatchedTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMPatchedTrack.hpp; sourceTree = ""; }; 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = AllSuiteA.bin; path = AllSuiteA/AllSuiteA.bin; sourceTree = ""; }; 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = 6502_functional_test.bin; path = "Klaus Dormann/6502_functional_test.bin"; sourceTree = ""; }; 4B44EBF81DC9898E00A7820C /* BCDTEST_beeb */ = {isa = PBXFileReference; lastKnownFileType = file; name = BCDTEST_beeb; path = BCDTest/BCDTEST_beeb; sourceTree = ""; }; @@ -1295,11 +1298,13 @@ 4BAB62AB1D3272D200DF5BA0 /* Disk.cpp */, 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */, 4B30512B1D989E2200B4FED8 /* Drive.cpp */, + 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */, 4BAB62B61D3302CA00DF5BA0 /* PCMTrack.cpp */, 4B0BE4271D3481E700D5256B /* DigitalPhaseLockedLoop.hpp */, 4BAB62AC1D3272D200DF5BA0 /* Disk.hpp */, 4B6C73BC1D387AE500AFCFCA /* DiskController.hpp */, 4B30512C1D989E2200B4FED8 /* Drive.hpp */, + 4B3F1B451E0388D200DB26EE /* PCMPatchedTrack.hpp */, 4BAB62B71D3302CA00DF5BA0 /* PCMTrack.hpp */, 4BB697CF1D4BA44900248BDF /* Encodings */, 4BAB62B21D327F7E00DF5BA0 /* Formats */, @@ -2367,6 +2372,7 @@ 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, 4BF829691D8F7361001BAE39 /* File.cpp in Sources */, 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */, + 4B3F1B461E0388D200DB26EE /* PCMPatchedTrack.cpp in Sources */, 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */, 4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */, 4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */, diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp new file mode 100644 index 000000000..97a9c35d4 --- /dev/null +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -0,0 +1,16 @@ +// +// PCMPatchedTrack.cpp +// Clock Signal +// +// Created by Thomas Harte on 15/12/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#include "PCMPatchedTrack.hpp" + +using namespace Storage::Disk; + +void PCMPatchedTrack::add_segment(const Time &start_position, const PCMSegment &segment) +{ + patches_.emplace_back(start_position, segment); +} diff --git a/Storage/Disk/PCMPatchedTrack.hpp b/Storage/Disk/PCMPatchedTrack.hpp new file mode 100644 index 000000000..2a5d1bb62 --- /dev/null +++ b/Storage/Disk/PCMPatchedTrack.hpp @@ -0,0 +1,51 @@ +// +// PCMPatchedTrack.hpp +// Clock Signal +// +// Created by Thomas Harte on 15/12/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#ifndef PCMPatchedTrack_hpp +#define PCMPatchedTrack_hpp + +#include "PCMTrack.hpp" + +namespace Storage { +namespace Disk { + +/*! + A subclass of @c Track that patches an existing track with PCM segments. +*/ +class PCMPatchedTrack: public Track { + public: + /*! + Constructs a @c PCMPatchedTrack that will return events from @c underlying_track in + regions where it has not had alternative PCM data installed. + */ + PCMPatchedTrack(const PCMTrack &underlying_track); + + /*! + Replaces whatever is currently on the track from @c start_position to @c start_position + segment length + with the contents of @c segment. + */ + void add_segment(const Time &start_position, const PCMSegment &segment); + + // To satisfy Storage::Disk::Track + Event get_next_event(); + Time seek_to(Time time_since_index_hole); + + private: + const PCMTrack &underlying_track_; + struct Patch { + Time start_position; + PCMSegment segment; + Patch(const Time &start_position, const PCMSegment &segment) : start_position(start_position), segment(segment) {} + }; + std::vector patches_; +}; + +} +} + +#endif /* PCMPatchedTrack_hpp */