mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-09 06:29:33 +00:00
Eliminates tape player call when tape is not playing.
This commit is contained in:
parent
832ac173ae
commit
fc81bfa59b
@ -116,7 +116,8 @@ class ConcreteMachine:
|
|||||||
public ConfigurationTarget::Machine,
|
public ConfigurationTarget::Machine,
|
||||||
public KeyboardMachine::Machine,
|
public KeyboardMachine::Machine,
|
||||||
public Configurable::Device,
|
public Configurable::Device,
|
||||||
public MemoryMap {
|
public MemoryMap,
|
||||||
|
public Sleeper::SleepObserver {
|
||||||
public:
|
public:
|
||||||
ConcreteMachine():
|
ConcreteMachine():
|
||||||
z80_(*this),
|
z80_(*this),
|
||||||
@ -135,6 +136,7 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
ay_.set_port_handler(&ay_port_handler_);
|
ay_.set_port_handler(&ay_port_handler_);
|
||||||
speaker_.set_input_rate(3579545.0f / 2.0f);
|
speaker_.set_input_rate(3579545.0f / 2.0f);
|
||||||
|
tape_player_.set_sleep_observer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_output(float aspect_ratio) override {
|
void setup_output(float aspect_ratio) override {
|
||||||
@ -460,8 +462,8 @@ class ConcreteMachine:
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the tape. (TODO: allow for sleeping)
|
if(!tape_player_is_sleeping_)
|
||||||
tape_player_.run_for(cycle.length.as_int());
|
tape_player_.run_for(cycle.length.as_int());
|
||||||
|
|
||||||
// Per the best information I currently have, the MSX inserts an extra cycle into each opcode read,
|
// Per the best information I currently have, the MSX inserts an extra cycle into each opcode read,
|
||||||
// but otherwise runs without pause.
|
// but otherwise runs without pause.
|
||||||
@ -568,6 +570,11 @@ class ConcreteMachine:
|
|||||||
return selection_set;
|
return selection_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Sleeper
|
||||||
|
void set_component_is_sleeping(void *component, bool is_sleeping) override {
|
||||||
|
tape_player_is_sleeping_ = tape_player_.is_sleeping();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_audio() {
|
void update_audio() {
|
||||||
speaker_.run_for(audio_queue_, time_since_ay_update_.divide_cycles(Cycles(2)));
|
speaker_.run_for(audio_queue_, time_since_ay_update_.divide_cycles(Cycles(2)));
|
||||||
@ -628,6 +635,7 @@ class ConcreteMachine:
|
|||||||
Outputs::Speaker::LowpassSpeaker<Outputs::Speaker::CompoundSource<GI::AY38910::AY38910, AudioToggle, Konami::SCC>> speaker_;
|
Outputs::Speaker::LowpassSpeaker<Outputs::Speaker::CompoundSource<GI::AY38910::AY38910, AudioToggle, Konami::SCC>> speaker_;
|
||||||
|
|
||||||
Storage::Tape::BinaryTapePlayer tape_player_;
|
Storage::Tape::BinaryTapePlayer tape_player_;
|
||||||
|
bool tape_player_is_sleeping_ = false;
|
||||||
bool allow_fast_tape_ = false;
|
bool allow_fast_tape_ = false;
|
||||||
bool use_fast_tape_ = false;
|
bool use_fast_tape_ = false;
|
||||||
void set_use_fast_tape() {
|
void set_use_fast_tape() {
|
||||||
|
Loading…
Reference in New Issue
Block a user