mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-25 09:24:00 -04:00
fix various AudioFileProcessor bugs (#7533)
* fix out-of-bounds crash in AudioFileProcessor by correctly setting m_from and m_to without them interfering with each other * fixed flattened wave caused by inaccurate math see PR for before/after * simply stop drawing AFP waveform when there's no more data this fixes the single point at the end of waveforms that sometimes shows up * fixed seemingly insignificant type confusion (?) execution seemed fine but my debugger started freaking out, and if gdb is telling me I got a negative-sized vector, I'd rather fix this issue than speculate "it's probably fine" * fixed data offset for AFP waveform vis the data itself isn't reversed, so we have to account for that
This commit is contained in:
committed by
GitHub
parent
e0ae8a1cec
commit
0363ee6d16
@@ -338,10 +338,12 @@ void AudioFileProcessorWaveView::updateGraph()
|
||||
m_graph.fill(Qt::transparent);
|
||||
QPainter p(&m_graph);
|
||||
p.setPen(QColor(255, 255, 255));
|
||||
|
||||
const auto dataOffset = m_reversed ? m_sample->sampleSize() - m_to : m_from;
|
||||
|
||||
const auto rect = QRect{0, 0, m_graph.width(), m_graph.height()};
|
||||
const auto waveform = SampleWaveform::Parameters{
|
||||
m_sample->data() + m_from, static_cast<size_t>(range()), m_sample->amplification(), m_sample->reversed()};
|
||||
m_sample->data() + dataOffset, static_cast<size_t>(range()), m_sample->amplification(), m_sample->reversed()};
|
||||
SampleWaveform::visualize(waveform, p, rect);
|
||||
}
|
||||
|
||||
@@ -467,9 +469,11 @@ void AudioFileProcessorWaveView::reverse()
|
||||
- m_sample->endFrame()
|
||||
- m_sample->startFrame()
|
||||
);
|
||||
|
||||
const int fromTmp = m_from;
|
||||
|
||||
setFrom(m_sample->sampleSize() - m_to);
|
||||
setTo(m_sample->sampleSize() - m_from);
|
||||
setTo(m_sample->sampleSize() - fromTmp);
|
||||
m_reversed = ! m_reversed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user