Просмотр исходного кода

Mention glibc as a dependency. Reduced cpu usage when bypassed.

Luciano Dato 7 лет назад
Родитель
Сommit
eb01f9034e
2 измененных файлов с 18 добавлено и 14 удалено
  1. 1 1
      README.md
  2. 17 13
      src/sdenoise.c

+ 1 - 1
README.md

@@ -10,7 +10,7 @@ RNNoise is a library that uses deep learning to apply noise supression to audio
 
 Requirements
 -----
-You will require git gnu-make gnu-autoconf gnu-m4 gnu-libtool to be installed on your system in order to compile the static instance of RNNoise library
+You will require git gnu-make gnu-autoconf gnu-m4 gnu-libtool glibc to be installed on your system in order to compile the static instance of RNNoise library
 
 To compile and install this plug-in you will need the LV2 SDK, Meson build system (use pip3 to install it), ninja compiler and git
 

+ 17 - 13
src/sdenoise.c

@@ -196,20 +196,24 @@ run(LV2_Handle instance, uint32_t n_samples)
 
 			//------------PROCESSING-------------
 
-			//Scaling up to short values
-			for (k = 0; k < self->frame_size; k++)
-			{
-				self->rnnoise_input_frame[k] *= SHRT_MAX;
-			}
-
-			//Process input_frame
-			rnnoise_process_frame(self->st, self->rnnoise_output_frame, self->rnnoise_input_frame);
-
-			//Scaling down to float values
-			for (k = 0; k < self->frame_size; k++)
+			//Only call rrnoise if enabled
+			if (*(self->enable) != 0.f)
 			{
-				self->rnnoise_output_frame[k] /= SHRT_MAX;
-				self->rnnoise_input_frame[k] /= SHRT_MAX;
+				//Scaling up to short values
+				for (k = 0; k < self->frame_size; k++)
+				{
+					self->rnnoise_input_frame[k] *= SHRT_MAX;
+				}
+
+				//Process input_frame
+				rnnoise_process_frame(self->st, self->rnnoise_output_frame, self->rnnoise_input_frame);
+
+				//Scaling down to float values
+				for (k = 0; k < self->frame_size; k++)
+				{
+					self->rnnoise_output_frame[k] /= SHRT_MAX;
+					self->rnnoise_input_frame[k] /= SHRT_MAX;
+				}
 			}
 
 			//-----------------------------------