mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Moved responsibility for throwing in a low-pass filter up to the Vic, appropriately.
This commit is contained in:
parent
c783090980
commit
1541273785
@ -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)
|
||||
{
|
||||
|
@ -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));
|
||||
|
@ -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<int16_t> _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 T> 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 T> class Filter: public Speaker {
|
||||
|
||||
std::unique_ptr<int16_t> _input_buffer;
|
||||
int _input_buffer_depth;
|
||||
float _high_frequency_cut_off;
|
||||
|
||||
void update_filter_coefficients()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user