mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Fixed one off-by-one error.
This commit is contained in:
parent
8bd04a6be4
commit
383b2be4c6
@ -495,18 +495,13 @@ void Machine::set_key_state(Key key, bool isPressed)
|
|||||||
|
|
||||||
void Machine::Speaker::get_samples(unsigned int number_of_samples, int16_t *target)
|
void Machine::Speaker::get_samples(unsigned int number_of_samples, int16_t *target)
|
||||||
{
|
{
|
||||||
// if(!_is_enabled)
|
if(!_is_enabled)
|
||||||
// {
|
{
|
||||||
// *target = 0;
|
*target = 0;
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
{
|
{
|
||||||
*target = _output_level;
|
*target = _output_level;
|
||||||
_output_level++;
|
|
||||||
if(_output_level&64)
|
|
||||||
{
|
|
||||||
_output_level ^= (8192 | 64);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
skip_samples(number_of_samples);
|
skip_samples(number_of_samples);
|
||||||
}
|
}
|
||||||
@ -519,18 +514,18 @@ void Machine::Speaker::skip_samples(unsigned int number_of_samples)
|
|||||||
if(_counter > _divider)
|
if(_counter > _divider)
|
||||||
{
|
{
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
// _output_level ^= 8192;
|
_output_level ^= 8192;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::Speaker::set_divider(uint8_t divider)
|
void Machine::Speaker::set_divider(uint8_t divider)
|
||||||
{
|
{
|
||||||
// _divider = divider;
|
_divider = divider;
|
||||||
// _time_base = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::Speaker::set_is_enabled(bool is_enabled)
|
void Machine::Speaker::set_is_enabled(bool is_enabled)
|
||||||
{
|
{
|
||||||
// _is_enabled = is_enabled;
|
_is_enabled = is_enabled;
|
||||||
|
_counter = 0;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,6 @@ template <class T> class Filter: public Speaker {
|
|||||||
{
|
{
|
||||||
// get a sample for the current location
|
// get a sample for the current location
|
||||||
static_cast<T *>(this)->get_samples(1, &_buffer_in_progress[_buffer_in_progress_pointer]);
|
static_cast<T *>(this)->get_samples(1, &_buffer_in_progress[_buffer_in_progress_pointer]);
|
||||||
// _buffer_in_progress[_buffer_in_progress_pointer] = (_buffer_in_progress_pointer&64) ? 8192 : 0;
|
|
||||||
_buffer_in_progress_pointer++;
|
_buffer_in_progress_pointer++;
|
||||||
|
|
||||||
// announce to delegate if full
|
// announce to delegate if full
|
||||||
@ -95,7 +94,9 @@ template <class T> class Filter: public Speaker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine how many source samples to step
|
// determine how many source samples to step
|
||||||
static_cast<T *>(this)->skip_samples((unsigned int)_stepper->update());
|
uint64_t steps = _stepper->update();
|
||||||
|
if(steps > 1)
|
||||||
|
static_cast<T *>(this)->skip_samples((unsigned int)(steps-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user