Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up computation of "from" and "to" values in AudioFileProcessorWaveView #7074

Open
michaelgregorius opened this issue Jan 24, 2024 · 0 comments
Labels

Comments

@michaelgregorius
Copy link
Contributor

Pull request #7071 has fixed a crash that was reported in #7068 by adding safety checks via two new setter methods in plugins/AudioFileProcessor/AudioFileProcessorWaveView.h.

While the crash is gone there is still code that tries to set the "from" and "to" values to invalid values. One such method is AudioFileProcessorWaveView::slide. To fix this adjust the two new setters as follows:

void AudioFileProcessorWaveView::setTo(f_cnt_t to)
{
	assert (to <= m_sample->sampleSize());
	m_to = std::min(to, static_cast<lmms::f_cnt_t>(m_sample->sampleSize()));
}

void AudioFileProcessorWaveView::setFrom(f_cnt_t from)
{
	assert (from >= 0);
	m_from = std::max(from, 0);
}

Then follow these steps:

  1. Add an AFP and open it's view.
  2. Drag a sample onto the sample view of the AFP, e.g. drums/clap01.ogg from the factory samples.
  3. Click with the left mouse button on the sample display and drag to the right until the crash occurs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant