diff --git a/Components/6560/6560.cpp b/Components/6560/6560.cpp index de405a735..7bb013ebb 100644 --- a/Components/6560/6560.cpp +++ b/Components/6560/6560.cpp @@ -15,11 +15,7 @@ Speaker::Speaker() : _control_registers{0, 0, 0, 0}, _shift_registers{0, 0, 0, 0}, _counters{2, 1, 0, 0} // create a slight phase offset for the three channels -{ - // The Vic has a 1.6Khz low-pass filter; - // TODO: this is part of the Vic-20, not part of the 6560. So relocate it. - set_high_frequency_cut_off(1600); -} +{} void Speaker::set_volume(uint8_t volume) { diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 6c2f206a5..408ae8735 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -201,6 +201,7 @@ void Machine::set_region(Commodore::Vic20::Region region) void Machine::setup_output(float aspect_ratio) { _mos6560.reset(new Vic6560()); + _mos6560->get_speaker()->set_high_frequency_cut_off(1600); // There is a 1.6Khz low-pass filter in the Vic-20. set_region(_region); memset(_mos6560->_videoMemoryMap, 0, sizeof(_mos6560->_videoMemoryMap)); diff --git a/Outputs/Speaker.hpp b/Outputs/Speaker.hpp index cc5a39639..72e595aa9 100644 --- a/Outputs/Speaker.hpp +++ b/Outputs/Speaker.hpp @@ -72,10 +72,20 @@ class Speaker { set_needs_updated_filter_coefficients(); } - Speaker() : _buffer_in_progress_pointer(0), _requested_number_of_taps(0) {} + /*! + Sets the cut-off frequency for a low-pass filter attached to the output of this speaker; optional. + */ + void set_high_frequency_cut_off(float high_frequency) + { + _high_frequency_cut_off = high_frequency; + set_needs_updated_filter_coefficients(); + } + + Speaker() : _buffer_in_progress_pointer(0), _requested_number_of_taps(0), _high_frequency_cut_off(-1.0) {} protected: std::unique_ptr _buffer_in_progress; + float _high_frequency_cut_off; int _buffer_size; int _buffer_in_progress_pointer; int _number_of_taps, _requested_number_of_taps; @@ -109,14 +119,6 @@ class Speaker { */ template class Filter: public Speaker { public: - Filter() : _high_frequency_cut_off(-1.0) {} - - void set_high_frequency_cut_off(float high_frequency) - { - _high_frequency_cut_off = high_frequency; - set_needs_updated_filter_coefficients(); - } - void run_for_cycles(unsigned int input_cycles) { if(_coefficients_are_dirty) update_filter_coefficients(); @@ -204,7 +206,6 @@ template class Filter: public Speaker { std::unique_ptr _input_buffer; int _input_buffer_depth; - float _high_frequency_cut_off; void update_filter_coefficients() {