1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +00:00

Allows amplitude to be specified even for a default colour burst.

This commit is contained in:
Thomas Harte 2019-01-17 20:47:42 -05:00
parent 4748b09721
commit 5ceb711bd3
2 changed files with 6 additions and 5 deletions

View File

@ -381,9 +381,9 @@ void CRT::output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t ampli
output_scan(&scan); output_scan(&scan);
} }
void CRT::output_default_colour_burst(int number_of_cycles) { void CRT::output_default_colour_burst(int number_of_cycles, uint8_t amplitude) {
// TODO: avoid applying a rounding error here? // TODO: avoid applying a rounding error here?
output_colour_burst(number_of_cycles, static_cast<uint8_t>((phase_numerator_ * 256) / phase_denominator_)); output_colour_burst(number_of_cycles, static_cast<uint8_t>((phase_numerator_ * 256) / phase_denominator_), amplitude);
} }
void CRT::set_immediate_default_phase(float phase) { void CRT::set_immediate_default_phase(float phase) {

View File

@ -85,6 +85,7 @@ class CRT {
Outputs::Display::ScanTarget *scan_target_ = &Outputs::Display::NullScanTarget::singleton; Outputs::Display::ScanTarget *scan_target_ = &Outputs::Display::NullScanTarget::singleton;
Outputs::Display::ScanTarget::Modals scan_target_modals_; Outputs::Display::ScanTarget::Modals scan_target_modals_;
static const uint8_t DefaultAmplitude = 80;
public: public:
/*! Constructs the CRT with a specified clock rate, height and colour subcarrier frequency. /*! Constructs the CRT with a specified clock rate, height and colour subcarrier frequency.
@ -190,16 +191,16 @@ class CRT {
@param phase The initial phase of the colour burst in a measuring system with 256 units @param phase The initial phase of the colour burst in a measuring system with 256 units
per circle, e.g. 0 = 0 degrees, 128 = 180 degrees, 256 = 360 degree. per circle, e.g. 0 = 0 degrees, 128 = 180 degrees, 256 = 360 degree.
@param amplitude The amplitude of the colour burst in 1/256ths of the amplitude of the @param amplitude The amplitude of the colour burst in 1/255ths of the amplitude of the
positive portion of the wave. positive portion of the wave.
*/ */
void output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t amplitude = 102); void output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t amplitude = DefaultAmplitude);
/*! Outputs a colour burst exactly in phase with CRT expectations using the idiomatic amplitude. /*! Outputs a colour burst exactly in phase with CRT expectations using the idiomatic amplitude.
@param number_of_cycles The length of the colour burst; @param number_of_cycles The length of the colour burst;
*/ */
void output_default_colour_burst(int number_of_cycles); void output_default_colour_burst(int number_of_cycles, uint8_t amplitude = DefaultAmplitude);
/*! Sets the current phase of the colour subcarrier used by output_default_colour_burst. /*! Sets the current phase of the colour subcarrier used by output_default_colour_burst.