diff --git a/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp b/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp index da7fd0600..e638caf10 100644 --- a/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp +++ b/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp @@ -8,10 +8,10 @@ #include "OricMFMDSK.hpp" -#include "../../Track/PCMTrack.hpp" #include "../../Encodings/MFM/Constants.hpp" #include "../../Encodings/MFM/Shifter.hpp" #include "../../Encodings/MFM/Encoder.hpp" +#include "../../Track/PCMTrack.hpp" #include "../../Track/TrackSerialiser.hpp" using namespace Storage::Disk; @@ -109,9 +109,7 @@ std::shared_ptr OricMFMDSK::get_track_at_position(Track::Address address) } segment.number_of_bits = static_cast(segment.data.size() * 8); - - std::shared_ptr track(new PCMTrack(segment)); - return track; + return std::make_shared(segment); } void OricMFMDSK::set_tracks(const std::map> &tracks) { diff --git a/Storage/Disk/Track/PCMSegment.hpp b/Storage/Disk/Track/PCMSegment.hpp index d7289b66c..96a2364de 100644 --- a/Storage/Disk/Track/PCMSegment.hpp +++ b/Storage/Disk/Track/PCMSegment.hpp @@ -26,7 +26,7 @@ namespace Disk { */ struct PCMSegment { Time length_of_a_bit; - unsigned int number_of_bits; + unsigned int number_of_bits = 0; std::vector data; PCMSegment(Time length_of_a_bit, unsigned int number_of_bits, std::vector data) @@ -36,6 +36,11 @@ struct PCMSegment { int bit(std::size_t index) const { return (data[index >> 3] >> (7 ^ (index & 7)))&1; } + + void clear() { + number_of_bits = 0; + data.clear(); + } }; /*!