moved visual waveforms to block

This should be nicer, however it has a bug that I need to fix
This commit is contained in:
itsmattkc
2021-08-01 16:43:53 -07:00
parent 6995ffe015
commit be4a18d7de
13 changed files with 95 additions and 54 deletions
+23
View File
@@ -233,6 +233,29 @@ void AudioVisualWaveform::Shift(const rational &from, const rational &to)
length_ += (to-from);
}
void AudioVisualWaveform::TrimIn(const rational &length)
{
for (auto it=mipmapped_data_.begin(); it!=mipmapped_data_.end(); it++) {
rational rate = it->first;
double rate_dbl = rate.toDouble();
Sample& data = it->second;
int chop_length = time_to_samples(length, rate_dbl);
if (chop_length == 0) {
continue;
}
if (chop_length > 0) {
data = data.mid(chop_length);
} else {
data.insert(0, -chop_length, SamplePerChannel());
}
}
length_ -= length;
}
AudioVisualWaveform::Sample AudioVisualWaveform::GetSummaryFromTime(const rational &start, const rational &length) const
{
// Find mipmap that requires