File soundtouch-avoid-assert.patch of Package soundtouch.9260

From 59129fa33d183e66f0a276795a59aa61a3e2fa06 Mon Sep 17 00:00:00 2001
From: Olli <oparviai@iki.fi>
Date: Sun, 28 Oct 2018 15:49:50 +0200
Subject: [PATCH] Eliminate assert condition by reading # sample elements that
 are multiple of num-of-channels

---
 source/SoundStretch/main.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/SoundStretch/main.cpp b/source/SoundStretch/main.cpp
index 360ae8c..1742731 100644
--- a/source/SoundStretch/main.cpp
+++ b/source/SoundStretch/main.cpp
@@ -229,7 +229,7 @@ static void detectBPM(WavInFile *inFile, RunParameters *params)
     fflush(stderr);
 
     nChannels = (int)inFile->getNumChannels();
-    assert(BUFF_SIZE % nChannels == 0);
+    int readSize = BUFF_SIZE - BUFF_SIZE % nChannels;   // round read size down to multiple of num.channels 
 
     // Process the 'inFile' in small blocks, repeat until whole file has 
     // been processed
@@ -238,7 +238,7 @@ static void detectBPM(WavInFile *inFile, RunParameters *params)
         int num, samples;
 
         // Read sample data from input file
-        num = inFile->read(sampleBuffer, BUFF_SIZE);
+        num = inFile->read(sampleBuffer, readSize);
 
         // Enter the new samples to the bpm analyzer class
         samples = num / nChannels;
-- 
2.18.1

openSUSE Build Service is sponsored by