From 7327da63506e0dbcc6d14baee02b9d69e153ea35 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 16 Jul 2017 22:06:56 -0400 Subject: [PATCH] Switched the nascent `TZX` to use the new `PulseQueuedTape`. --- Storage/Tape/Formats/TZX.cpp | 19 ++++--------------- Storage/Tape/Formats/TZX.hpp | 14 +++----------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/Storage/Tape/Formats/TZX.cpp b/Storage/Tape/Formats/TZX.cpp index 0083d8e37..6ece1672b 100644 --- a/Storage/Tape/Formats/TZX.cpp +++ b/Storage/Tape/Formats/TZX.cpp @@ -12,9 +12,7 @@ using namespace Storage::Tape; TZX::TZX(const char *file_name) : Storage::FileHolder(file_name), - is_high_(false), - is_at_end_(false), - pulse_pointer_(0) { + is_high_(false) { // Check for signature followed by a 0x1a char identifier[7]; @@ -29,21 +27,12 @@ TZX::TZX(const char *file_name) : // Reject if an incompatible version if(major_version != 1 || minor_version > 20) throw ErrorNotTZX; - - // seed initial block contents - parse_next_chunk(); -} - -bool TZX::is_at_end() { - return true; -} - -Tape::Pulse TZX::virtual_get_next_pulse() { - return Tape::Pulse(); } void TZX::virtual_reset() { + clear(); + fseek(file_, SEEK_SET, 0x0a); } -void TZX::parse_next_chunk() { +void TZX::get_next_pulses() { } diff --git a/Storage/Tape/Formats/TZX.hpp b/Storage/Tape/Formats/TZX.hpp index f6adf1b3d..446e91d43 100644 --- a/Storage/Tape/Formats/TZX.hpp +++ b/Storage/Tape/Formats/TZX.hpp @@ -9,7 +9,7 @@ #ifndef TZX_hpp #define TZX_hpp -#include "../Tape.hpp" +#include "../PulseQueuedTape.hpp" #include "../../FileHolder.hpp" namespace Storage { @@ -18,7 +18,7 @@ namespace Tape { /*! Provides a @c Tape containing a CSW tape image, which is a compressed 1-bit sampling. */ -class TZX: public Tape, public Storage::FileHolder { +class TZX: public PulseQueuedTape, public Storage::FileHolder { public: /*! Constructs a @c TZX containing content from the file with name @c file_name. @@ -31,19 +31,11 @@ class TZX: public Tape, public Storage::FileHolder { ErrorNotTZX }; - // implemented to satisfy @c Tape - bool is_at_end(); - private: - Pulse virtual_get_next_pulse(); void virtual_reset(); - -// std::vector queued_pulses_; - size_t pulse_pointer_; - bool is_at_end_; + void get_next_pulses(); bool is_high_; - void parse_next_chunk(); }; }