mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Adds necessary interface to inherit a CPC tape-speed byte.
This commit is contained in:
parent
cd215ef521
commit
064fe7658c
@ -82,10 +82,7 @@ void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) {
|
||||
case MachineType::AmstradCPC:
|
||||
// CPC: pilot tone is length of bit 1; bit 0 is half that.
|
||||
// So no more detecting formal pilot waves.
|
||||
is_one_ = mean * 0.75f;
|
||||
too_long_ = mean * 1.0f / 0.75f;
|
||||
too_short_ = is_one_ * 0.5f;
|
||||
is_pilot_ = too_long_;
|
||||
set_cpc_one_zero_boundary(mean * 0.75f);
|
||||
break;
|
||||
|
||||
case MachineType::Enterprise:
|
||||
@ -132,6 +129,20 @@ void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) {
|
||||
push_wave(t_states > is_one_ ? WaveType::One : WaveType::Zero);
|
||||
}
|
||||
|
||||
void Parser::set_cpc_read_speed(uint8_t speed) {
|
||||
// This may not be exactly right; I wish there were more science here but
|
||||
// instead it's empirical based on tape speed versus value stored plus
|
||||
// a guess as to where the CPC puts the dividing line.
|
||||
set_cpc_one_zero_boundary(float(speed) * 14.35f);
|
||||
}
|
||||
|
||||
void Parser::set_cpc_one_zero_boundary(float boundary) {
|
||||
is_one_ = boundary;
|
||||
too_long_ = is_one_ * 16.0f / 9.0f;
|
||||
too_short_ = is_one_ * 0.5f;
|
||||
is_pilot_ = too_long_;
|
||||
}
|
||||
|
||||
void Parser::inspect_waves(const std::vector<Storage::Tape::ZXSpectrum::WaveType> &waves) {
|
||||
switch(waves[0]) {
|
||||
// Gap and Pilot map directly.
|
||||
|
@ -63,6 +63,11 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
};
|
||||
Parser(MachineType);
|
||||
|
||||
/*!
|
||||
Calibrates the expected data speed using a value in the CPC's native tape-speed measurement scale.
|
||||
*/
|
||||
void set_cpc_read_speed(uint8_t);
|
||||
|
||||
/*!
|
||||
Finds the next block from the tape, if any.
|
||||
|
||||
@ -117,6 +122,8 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
|
||||
std::array<float, 8> calibration_pulses_;
|
||||
size_t calibration_pulse_pointer_ = 0;
|
||||
|
||||
void set_cpc_one_zero_boundary(float);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user