mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 04:06:17 -04:00
clang-tidy: Apply modernize-loop-convert everywhere (#6481)
Co-authored-by: allejok96 <allejok96@gmail.com> Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
This commit is contained in:
@@ -355,10 +355,9 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
it->state = PlayingKeyUp;
|
||||
|
||||
// Notify each sample that the key has been released
|
||||
for( QList<GigSample>::iterator sample = it->samples.begin();
|
||||
sample != it->samples.end(); ++sample )
|
||||
for (auto& sample : it->samples)
|
||||
{
|
||||
sample->adsr.keyup();
|
||||
sample.adsr.keyup();
|
||||
}
|
||||
|
||||
// Add release samples if available
|
||||
@@ -408,22 +407,17 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
}
|
||||
|
||||
// Fill buffer with portions of the note samples
|
||||
for( QList<GigNote>::iterator it = m_notes.begin(); it != m_notes.end(); ++it )
|
||||
for (auto& note : m_notes)
|
||||
{
|
||||
// Only process the notes if we're in a playing state
|
||||
if( !( it->state == PlayingKeyDown ||
|
||||
it->state == PlayingKeyUp ) )
|
||||
if (!(note.state == PlayingKeyDown || note.state == PlayingKeyUp ))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for( QList<GigSample>::iterator sample = it->samples.begin();
|
||||
sample != it->samples.end(); ++sample )
|
||||
for (auto& sample : note.samples)
|
||||
{
|
||||
if( sample->sample == nullptr || sample->region == nullptr )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (sample.sample == nullptr || sample.region == nullptr) { continue; }
|
||||
|
||||
// Will change if resampling
|
||||
bool resample = false;
|
||||
@@ -434,18 +428,15 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
// Resample to be the correct pitch when the sample provided isn't
|
||||
// solely for this one note (e.g. one or two samples per octave) or
|
||||
// we are processing at a different sample rate
|
||||
if( sample->region->PitchTrack == true || rate != sample->sample->SamplesPerSecond )
|
||||
if (sample.region->PitchTrack == true || rate != sample.sample->SamplesPerSecond)
|
||||
{
|
||||
resample = true;
|
||||
|
||||
// Factor just for resampling
|
||||
freq_factor = 1.0 * rate / sample->sample->SamplesPerSecond;
|
||||
freq_factor = 1.0 * rate / sample.sample->SamplesPerSecond;
|
||||
|
||||
// Factor for pitch shifting as well as resampling
|
||||
if( sample->region->PitchTrack == true )
|
||||
{
|
||||
freq_factor *= sample->freqFactor;
|
||||
}
|
||||
if (sample.region->PitchTrack == true) { freq_factor *= sample.freqFactor; }
|
||||
|
||||
// We need a bit of margin so we don't get glitching
|
||||
samples = frames / freq_factor + MARGIN[m_interpolation];
|
||||
@@ -453,11 +444,11 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
|
||||
// Load this note's data
|
||||
sampleFrame sampleData[samples];
|
||||
loadSample( *sample, sampleData, samples );
|
||||
loadSample(sample, sampleData, samples);
|
||||
|
||||
// Apply ADSR using a copy so if we don't use these samples when
|
||||
// resampling, the ADSR doesn't get messed up
|
||||
ADSR copy = sample->adsr;
|
||||
ADSR copy = sample.adsr;
|
||||
|
||||
for( f_cnt_t i = 0; i < samples; ++i )
|
||||
{
|
||||
@@ -472,8 +463,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
sampleFrame convertBuf[frames];
|
||||
|
||||
// Only output if resampling is successful (note that "used" is output)
|
||||
if( sample->convertSampleRate( *sampleData, *convertBuf, samples, frames,
|
||||
freq_factor, used ) )
|
||||
if (sample.convertSampleRate(*sampleData, *convertBuf, samples, frames, freq_factor, used))
|
||||
{
|
||||
for( f_cnt_t i = 0; i < frames; ++i )
|
||||
{
|
||||
@@ -492,8 +482,8 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
}
|
||||
|
||||
// Update note position with how many samples we actually used
|
||||
sample->pos += used;
|
||||
sample->adsr.inc( used );
|
||||
sample.pos += used;
|
||||
sample.adsr.inc(used);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,13 +679,12 @@ void GigInstrument::deleteNotePluginData( NotePlayHandle * _n )
|
||||
|
||||
// Mark the note as being released, but only if it was playing or was just
|
||||
// pressed (i.e., not if the key was already released)
|
||||
for( QList<GigNote>::iterator i = m_notes.begin(); i != m_notes.end(); ++i )
|
||||
for (auto& note : m_notes)
|
||||
{
|
||||
// Find the note by matching pointers to the plugin data
|
||||
if( i->handle == pluginData &&
|
||||
( i->state == KeyDown || i->state == PlayingKeyDown ) )
|
||||
if (note.handle == pluginData && (note.state == KeyDown || note.state == PlayingKeyDown))
|
||||
{
|
||||
i->state = KeyUp;
|
||||
note.state = KeyUp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user