Created
April 2, 2016 04:24
-
-
Save nilninull/158c1f8108cb2dd90e4f3e253d3c75e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u -ru ladspa-bs2b-0.9.1.orig/src/plugin.c ladspa-bs2b-0.9.1/src/plugin.c | |
--- ladspa-bs2b-0.9.1.orig/src/plugin.c 2009-06-05 03:44:25.000000000 +0900 | |
+++ ladspa-bs2b-0.9.1/src/plugin.c 2016-04-01 15:28:18.282931019 +0900 | |
@@ -89,13 +89,13 @@ | |
LADSPA_Handle | |
instantiateBs2bLine(const LADSPA_Descriptor * Descriptor, | |
unsigned long SampleRate) { | |
- Bs2bLine * psBs2bLine = (Bs2bLine *)malloc(sizeof(Bs2bLine)); | |
- if (psBs2bLine == NULL) { | |
+ /* Sample rate supported? */ | |
+ if ((SampleRate < BS2B_MINSRATE) || (SampleRate > BS2B_MAXSRATE)) { | |
return NULL; | |
} | |
- /* Sample rate supported? */ | |
- if ((SampleRate < BS2B_MINSRATE) || (SampleRate > BS2B_MAXSRATE)) { | |
+ Bs2bLine * psBs2bLine = (Bs2bLine *)malloc(sizeof(Bs2bLine)); | |
+ if (psBs2bLine == NULL) { | |
return NULL; | |
} | |
@@ -178,6 +178,25 @@ | |
pfOutputLeft = psBs2bLine->m_pfOutputLeft; | |
pfOutputRight = psBs2bLine->m_pfOutputRight; | |
+ /* bs2b_cross_feed_f increase cpu usage while all 0 inputs. | |
+ First time (before using the plugin) does not increase cpus. | |
+ But once used, the cpu usage was up. | |
+ Below codes simply skip for avoiding this situations. | |
+ I couldn't find other way for fix this. */ | |
+ | |
+ for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++) { | |
+ if (pfInputLeft[lSampleIndex] != 0 || pfInputRight[lSampleIndex] != 0) | |
+ break; | |
+ } | |
+ | |
+ if (lSampleIndex == SampleCount) { | |
+ for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++) { | |
+ pfOutputLeft[lSampleIndex] = 0; | |
+ pfOutputRight[lSampleIndex] = 0; | |
+ } | |
+ return; | |
+ } | |
+ | |
/* Re-allocate when needed */ | |
if (SampleCount > psBs2bLine->bufferSampleCount) { | |
float * const reallocated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment