2016-06-01 01:23:44 +00:00
|
|
|
//
|
|
|
|
// CRTMachine.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 31/05/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CRTMachine_hpp
|
|
|
|
#define CRTMachine_hpp
|
|
|
|
|
|
|
|
#include "../Outputs/CRT/CRT.hpp"
|
|
|
|
#include "../Outputs/Speaker.hpp"
|
|
|
|
|
|
|
|
namespace CRTMachine {
|
|
|
|
|
2016-06-30 12:46:29 +00:00
|
|
|
/*!
|
|
|
|
A CRTMachine::Machine is a mostly-abstract base class for machines that connect to a CRT,
|
|
|
|
that optionally provide a speaker, and that nominate a clock rate and can announce to a delegate
|
|
|
|
should that clock rate change.
|
|
|
|
*/
|
2016-06-01 01:23:44 +00:00
|
|
|
class Machine {
|
|
|
|
public:
|
|
|
|
virtual void setup_output(float aspect_ratio) = 0;
|
|
|
|
virtual void close_output() = 0;
|
|
|
|
|
2016-07-04 23:33:55 +00:00
|
|
|
virtual std::shared_ptr<Outputs::CRT::CRT> get_crt() = 0;
|
|
|
|
virtual std::shared_ptr<Outputs::Speaker> get_speaker() = 0;
|
2016-06-01 01:23:44 +00:00
|
|
|
|
|
|
|
virtual void run_for_cycles(int number_of_cycles) = 0;
|
2016-06-17 00:39:46 +00:00
|
|
|
|
2016-06-30 12:46:29 +00:00
|
|
|
// TODO: sever the clock-rate stuff.
|
2016-06-17 00:39:46 +00:00
|
|
|
virtual double get_clock_rate() = 0;
|
|
|
|
class Delegate {
|
|
|
|
public:
|
|
|
|
virtual void machine_did_change_clock_rate(Machine *machine) = 0;
|
|
|
|
};
|
|
|
|
void set_delegate(Delegate *delegate) { this->delegate = delegate; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Delegate *delegate;
|
2016-06-01 01:23:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CRTMachine_hpp */
|