mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-28 21:49:27 +00:00
Permit granular specification of what to flush.
This commit is contained in:
parent
5c3084c37c
commit
b03d91d5dd
@ -219,7 +219,7 @@ class ConcreteMachine:
|
|||||||
mc68000_.run_for(cycles);
|
mc68000_.run_for(cycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_output() final {
|
void flush_output(Output) final {
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,10 +210,14 @@ class ConcreteMachine:
|
|||||||
z80_.run_for(cycles);
|
z80_.run_for(cycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_output() final {
|
void flush_output(Output output) final {
|
||||||
vdp_.flush();
|
if(int(output) & int(Output::Video)) {
|
||||||
update_audio();
|
vdp_.flush();
|
||||||
audio_queue_.perform();
|
}
|
||||||
|
if(int(output) & int(Output::Audio)) {
|
||||||
|
update_audio();
|
||||||
|
audio_queue_.perform();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||||
|
@ -61,8 +61,13 @@ class TimedMachine {
|
|||||||
virtual float get_confidence() { return 0.5f; }
|
virtual float get_confidence() { return 0.5f; }
|
||||||
virtual std::string debug_type() { return ""; }
|
virtual std::string debug_type() { return ""; }
|
||||||
|
|
||||||
/// Ensures all locally-buffered output is posted onward.
|
enum class Output {
|
||||||
virtual void flush_output() {}
|
Video = 1 << 0,
|
||||||
|
Audio = 1 << 1
|
||||||
|
};
|
||||||
|
/// Ensures all locally-buffered output is posted onward for the types of output indicated
|
||||||
|
/// by the bitfield argument.
|
||||||
|
virtual void flush_output(Output) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Runs the machine for @c cycles.
|
/// Runs the machine for @c cycles.
|
||||||
|
@ -678,13 +678,13 @@ struct ActivityObserver: public Activity::Observer {
|
|||||||
|
|
||||||
- (void)audioQueueIsRunningDry:(nonnull CSAudioQueue *)audioQueue {
|
- (void)audioQueueIsRunningDry:(nonnull CSAudioQueue *)audioQueue {
|
||||||
updater.update([self] {
|
updater.update([self] {
|
||||||
updater.performer.machine->flush_output();
|
updater.performer.machine->flush_output(MachineTypes::TimedMachine::Output::Audio);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scanTargetViewDisplayLinkDidFire:(CSScanTargetView *)view now:(const CVTimeStamp *)now outputTime:(const CVTimeStamp *)outputTime {
|
- (void)scanTargetViewDisplayLinkDidFire:(CSScanTargetView *)view now:(const CVTimeStamp *)now outputTime:(const CVTimeStamp *)outputTime {
|
||||||
updater.update([self] {
|
updater.update([self] {
|
||||||
updater.performer.machine->flush_output();
|
updater.performer.machine->flush_output(MachineTypes::TimedMachine::Output::Video);
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self.view updateBacking];
|
[self.view updateBacking];
|
||||||
[self.view draw];
|
[self.view draw];
|
||||||
|
Loading…
Reference in New Issue
Block a user