Fix silence adder.

This commit is contained in:
BearOso 2023-07-07 14:13:17 -05:00
parent 7f20a93637
commit dd2072b28e
3 changed files with 18 additions and 13 deletions

View File

@ -99,19 +99,18 @@ class Resampler
inline void add_silence(unsigned int num_samples)
{
if ((unsigned int)space_empty() <= num_samples)
{
int new_end = (end + num_samples) % buffer_size;
if ((unsigned int)space_empty() < num_samples)
return;
if (new_end < end)
{
memset(buffer + end, 0, 2 * (buffer_size - end));
memset(buffer, 0, 2 * (num_samples - (buffer_size - end)));
}
int new_end = (end + num_samples) % buffer_size;
memset(buffer + end, 0, 2 * num_samples);
end = new_end;
if (new_end < end) {
memset(buffer + end, 0, 2 * (buffer_size - end));
memset(buffer, 0, 2 * (num_samples - (buffer_size - end)));
}
memset(buffer + end, 0, 2 * num_samples);
end = new_end;
}
inline bool pull(int16_t *dst, int num_samples)

View File

@ -53,7 +53,13 @@ void FoldersPanel::refreshEntry(QComboBox *combo, QLineEdit *lineEdit, QPushButt
{
bool custom = (*location == EmuConfig::eCustomDirectory);
combo->setCurrentIndex(*location);
lineEdit->setText(custom ? QString::fromUtf8(*folder) : "");
if (custom)
lineEdit->setText(QString::fromUtf8(*folder));
else if (*location == EmuConfig::eConfigDirectory)
lineEdit->setText(tr("Config folder is %1").arg(app->config->findConfigDir().c_str()));
else
lineEdit->clear();
lineEdit->setEnabled(custom);
browse->setEnabled(custom);

View File

@ -29,7 +29,7 @@ void Throttle::wait_for_frame()
auto time_to_wait = remaining();
if (time_to_wait < -frame_duration_us / 10)
if (time_to_wait < -frame_duration_us)
{
reset();
return;
@ -57,7 +57,7 @@ void Throttle::wait_for_frame()
{
auto time_to_wait = remaining();
if (time_to_wait < -frame_duration_us / 10)
if (time_to_wait < -frame_duration_us)
{
reset();
return;