File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -437,15 +437,9 @@ void AudioFile<T>::setAudioBufferSize (int numChannels, int numSamples)
437437template <class T >
438438void AudioFile<T>::setNumSamplesPerChannel (int numSamples)
439439{
440- int originalSize = getNumSamplesPerChannel ();
441-
442440 for (int i = 0 ; i < getNumChannels ();i++)
443441 {
444- samples[i].resize (numSamples);
445-
446- // set any new samples to zero
447- if (numSamples > originalSize)
448- std::fill (samples[i].begin () + originalSize, samples[i].end (), (T)0 .);
442+ samples[i].resize (numSamples, static_cast <T>(0 ));
449443 }
450444}
451445
@@ -460,13 +454,9 @@ void AudioFile<T>::setNumChannels (int numChannels)
460454
461455 // make sure any new channels are set to the right size
462456 // and filled with zeros
463- if (numChannels > originalNumChannels)
457+ for ( int i = originalNumChannels; i < numChannels; i++ )
464458 {
465- for (int i = originalNumChannels; i < numChannels; i++)
466- {
467- samples[i].resize (originalNumSamplesPerChannel);
468- std::fill (samples[i].begin (), samples[i].end (), (T)0 .);
469- }
459+ samples[i].resize (originalNumSamplesPerChannel, static_cast <T>(0 ));
470460 }
471461}
472462
You can’t perform that action at this time.
0 commit comments