From 499f7ace0739a331ad44d937b55be83865e7fd0b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 17 Apr 2016 20:43:20 -0400 Subject: [PATCH] Re-enabled working video output for the Electron for the day and consolidated the rough metric I'm using to pick a number of taps for the audio filter. --- Machines/Electron/Electron.cpp | 2 +- .../Mac/Clock Signal/Wrappers/CSElectron.mm | 2 +- Outputs/Speaker.hpp | 15 ++++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 7ac235056..9005bc3da 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -66,7 +66,7 @@ void Machine::setup_output(float aspect_ratio) "texValue >>= 4 - (int(icoordinate.x * 8) & 4);" "return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));" "}"); - _crt->set_output_device(Outputs::CRT::Television); + _crt->set_output_device(Outputs::CRT::Monitor); // TODO: as implied below, I've introduced a clock's latency into the graphics pipeline somehow. Investigate. _crt->set_visible_area(_crt->get_rect_for_area(first_graphics_line - 3, 256, (first_graphics_cycle+1) * crt_cycles_multiplier, 80 * crt_cycles_multiplier, 4.0f / 3.0f)); diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm index 559caafdb..f4a93d26d 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm @@ -60,7 +60,7 @@ - (BOOL)setSpeakerDelegate:(Outputs::Speaker::Delegate *)delegate sampleRate:(int)sampleRate { @synchronized(self) { _electron.get_speaker()->set_output_rate(sampleRate, 256); - _electron.get_speaker()->set_output_quality(47); +// _electron.get_speaker()->set_output_quality(47); _electron.get_speaker()->set_delegate(delegate); return YES; } diff --git a/Outputs/Speaker.hpp b/Outputs/Speaker.hpp index 125b97663..304ba504b 100644 --- a/Outputs/Speaker.hpp +++ b/Outputs/Speaker.hpp @@ -35,11 +35,11 @@ class Speaker { set_needs_updated_filter_coefficients(); } - void set_output_quality(int number_of_taps) - { - _number_of_taps = number_of_taps; - set_needs_updated_filter_coefficients(); - } +// void set_output_quality(int number_of_taps) +// { +// _number_of_taps = number_of_taps; +// set_needs_updated_filter_coefficients(); +// } void set_delegate(Delegate *delegate) { @@ -130,6 +130,11 @@ template class Filter: public Speaker { void update_filter_coefficients() { + // make a guess at a good number of taps + _number_of_taps = (_input_cycles_per_second + _output_cycles_per_second) / _output_cycles_per_second; + _number_of_taps *= 2; + _number_of_taps |= 1; + _coefficients_are_dirty = false; _buffer_in_progress_pointer = 0;