Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ladspa for openSUSE:Factory checked in at 2022-02-03 23:16:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ladspa (Old) and /work/SRC/openSUSE:Factory/.ladspa.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ladspa" Thu Feb 3 23:16:29 2022 rev:33 rq:950250 version:1.17 Changes: -------- --- /work/SRC/openSUSE:Factory/ladspa/ladspa.changes 2019-01-11 14:04:05.507884416 +0100 +++ /work/SRC/openSUSE:Factory/.ladspa.new.1898/ladspa.changes 2022-02-03 23:17:18.448276524 +0100 @@ -1,0 +2,10 @@ +Fri Jan 28 20:33:14 UTC 2022 - Dirk M??ller <[email protected]> + +- update to 1.17: + * Change applyplugin to use libsndfile. + * Fix URL in documentation. + * Fix so delay can handle a delay of zero. + * Simplify, and hopefully accelerate, clip checking code in applyplugin. + * Improved usage message. + +------------------------------------------------------------------- Old: ---- ladspa_sdk_1.15.tgz New: ---- ladspa_sdk_1.17.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ladspa.spec ++++++ --- /var/tmp/diff_new_pack.SKNhIf/_old 2022-02-03 23:17:18.964273002 +0100 +++ /var/tmp/diff_new_pack.SKNhIf/_new 2022-02-03 23:17:18.972272947 +0100 @@ -1,7 +1,7 @@ # # spec file for package ladspa # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,20 +12,21 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: ladspa -Version: 1.15 +Version: 1.17 Release: 0 Summary: The Linux Audio Developer's Simple Plug-In API License: LGPL-2.1-or-later Group: Productivity/Multimedia/Sound/Utilities -Url: http://www.ladspa.org/ +URL: https://www.ladspa.org/ Source: http://www.ladspa.org/download/%{name}_sdk_%{version}.tgz Source1: baselibs.conf BuildRequires: gcc-c++ +BuildRequires: libsndfile-devel AutoReq: on Autoprov: off ++++++ ladspa_sdk_1.15.tgz -> ladspa_sdk_1.17.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/README new/ladspa_sdk_1.17/README --- old/ladspa_sdk_1.15/README 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/README 2021-09-10 10:50:46.000000000 +0200 @@ -6,7 +6,7 @@ work with. See http://www.ladspa.org for news and updates to the API and SDK. See -http://www.ladspa.org/cmt for a basic plugin library. The latter is +http://www.ladspa.org/cmt/ for a basic plugin library. The latter is GPL'd and contains `full' versions of all the plugins contained in the example libraries. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/doc/changes.html new/ladspa_sdk_1.17/doc/changes.html --- old/ladspa_sdk_1.15/doc/changes.html 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/doc/changes.html 2021-09-10 10:50:46.000000000 +0200 @@ -170,6 +170,26 @@ </UL> +<H2>Version 1.16 - 3 Sep 2021</H2> +<UL> + + <LI>Change applyplugin to use libsndfile.</LI> + + <LI>Fix URL in documentation.</LI> + + <LI>Fix so delay can handle a delay of zero.</LI> + +</UL> + +<H2>Version 1.17 - 9 Sep 2021</H2> +<UL> + + <LI>Simplify, and hopefully accelerate, clip checking code in applyplugin.</LI> + + <LI>Improved usage message.</LI> + +</UL> + <HR/> <H1>LADSPA SDK Index</H1> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/doc/download.html new/ladspa_sdk_1.17/doc/download.html --- old/ladspa_sdk_1.15/doc/download.html 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/doc/download.html 2021-09-10 10:50:46.000000000 +0200 @@ -24,8 +24,8 @@ <TR> <TD> - <A HREF="http://www.ladspa.org/download/ladspa_sdk_1.15.tgz"> - ladspa_sdk_1.15.tgz</A> + <A HREF="http://www.ladspa.org/download/ladspa_sdk_1.17.tgz"> + ladspa_sdk_1.17.tgz</A> </TD> <TD> The LADSPA SDK, including the <CODE>ladspa.h</CODE> API header diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/doc/installation.html new/ladspa_sdk_1.17/doc/installation.html --- old/ladspa_sdk_1.15/doc/installation.html 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/doc/installation.html 2021-09-10 10:50:46.000000000 +0200 @@ -26,7 +26,8 @@ plugins generated in the <CODE>plugins/</CODE> directory may be moved to <CODE>/usr/local/lib/ladspa/</CODE> or - <CODE>/usr/lib/ladspa/</CODE>.</P> + <CODE>/usr/lib/ladspa/</CODE>. Building the programs requires + libsndfile.</P> <P>To perform automatic installation, log in as root and run <CODE>make install</CODE>. This by default will install plugins, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/doc/overview.html new/ladspa_sdk_1.17/doc/overview.html --- old/ladspa_sdk_1.15/doc/overview.html 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/doc/overview.html 2021-09-10 10:50:46.000000000 +0200 @@ -11,7 +11,7 @@ <CENTER><IMG BORDER=0 SRC="/images/ladspa.jpg"></CENTER> -<H1>LADSPA SDK v1.15 Overview</H1> +<H1>LADSPA SDK v1.17 Overview</H1> <P>There is a large number of synthesis packages in use or development on the Linux platform at this time. The Linux Audio Developer's Simple diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/src/Makefile new/ladspa_sdk_1.17/src/Makefile --- old/ladspa_sdk_1.15/src/Makefile 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/src/Makefile 2021-09-10 10:50:46.000000000 +0200 @@ -14,7 +14,7 @@ # INCLUDES = -I. -LIBRARIES = -ldl -lm +LIBRARIES = -ldl -lm -lsndfile CFLAGS = $(INCLUDES) -Wall -Werror -O2 -fPIC \ -DDEFAULT_LADSPA_PATH=$(INSTALL_PLUGINS_DIR) BINFLAGS = -fPIE -pie diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/src/applyplugin.c new/ladspa_sdk_1.17/src/applyplugin.c --- old/ladspa_sdk_1.15/src/applyplugin.c 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/src/applyplugin.c 2021-09-10 10:50:46.000000000 +0200 @@ -9,9 +9,12 @@ #include <endian.h> #include <errno.h> #include <math.h> +#include <sndfile.h> #include <stdlib.h> +#include <stdint.h> #include <stdio.h> #include <string.h> +#include <strings.h> /*****************************************************************************/ @@ -25,268 +28,202 @@ /*****************************************************************************/ -/* Macros provide hook for word-order swapping because of - big/little-endian issues. */ - -#ifndef BYTE_ORDER -#error "Could not determine byte order." -#endif - -#if (BYTE_ORDER == LITTLE_ENDIAN) - -/* (i386 is little-endian.) */ - -#define WORD_ORDER_SWAP_16BIT(ptr) -#define WORD_ORDER_SWAP_32BIT(ptr) - -#else - -/* The following isn't ANSI C, but it'll work fine on GCC. To make it - ANSI compiliant, make cTmp global, remove the braces (etc). Then - check carefully to see where WORD_ORDER_SWAP_* is - used. Alternatively, rewrite as procedures. */ - -#define WORD_ORDER_SWAP_16BIT(pvPtr) { \ - char cTmp, * pcPtr = (char *)pvPtr; \ - cTmp = pcPtr[0]; \ - pcPtr[0] = pcPtr[1]; \ - pcPtr[1] = cTmp; \ -} -#define WORD_ORDER_SWAP_32BIT(pvPtr) { \ - char cTmp, * pcPtr = (char *)pvPtr; \ - cTmp = pcPtr[0]; \ - pcPtr[0] = pcPtr[3]; \ - pcPtr[3] = cTmp; \ - cTmp = pcPtr[1]; \ - pcPtr[1] = pcPtr[2]; \ - pcPtr[2] = cTmp; \ -} - -#endif - -/*****************************************************************************/ - -/* Horrid hard-coded Wave Interface: - --------------------------------- */ -/* Please please feel free to replace this with something nice. - - Only handles 16bit PCM files in a single data block. Returns - channel count and sample rate by reference. Only one file can be - open for read at a time. */ - -FILE * g_poInputFile; -FILE * g_poOutputFile; +SNDFILE * g_poInputFile; +SNDFILE * g_poOutputFile; LADSPA_Data g_fPeakWritten = 0; unsigned long g_lInputFileChannelCount; unsigned long g_lOutputFileChannelCount; -short * g_psInputFileBuffer; -short * g_psOutputFileBuffer; +float * g_pfInputFileBuffer; +/* We use sf_writef_int rather than sf_writef_float because we want an + identify pass-through if nothing is done to the audio. */ +int32_t * g_piOutputFileBuffer; static void -openWaveFile(const char * pcFilename, - unsigned long * plChannelCount, - unsigned long * plSampleRate, - unsigned long * plLength) { - - char pcHeader[44]; - size_t lReadLength; - - g_poInputFile = fopen(pcFilename, "rb"); - if (!g_poInputFile) { - fprintf(stderr, - "Failed to open input file \"%s\": %s\n", - pcFilename, - strerror(errno)); - exit(1); - } - - lReadLength = fread(pcHeader, sizeof(char), 44, g_poInputFile); - if (lReadLength < 44) { - fprintf(stderr, - "Failed to read header from input file \"%s\": %s\n", - pcFilename, - strerror(errno)); - exit(1); - } - if (strncmp(pcHeader + 0, "RIFF", 4) != 0 || - strncmp(pcHeader + 8, "WAVE", 4) != 0 || - strncmp(pcHeader + 12, "fmt ", 4) != 0 || - pcHeader[20] != 1 || pcHeader[21] != 0 || /* PCM */ - pcHeader[34] != 16 || pcHeader[35] != 0 || /* 16 bit */ - strncmp(pcHeader + 36, "data", 4) != 0) /* Data block elsewhere */ { +openInputFile(const char * pcFilename, + unsigned long * plChannelCount, + unsigned long * plSampleRate) { + + SF_INFO oInfo; + + memset(&oInfo, 0, sizeof(SF_INFO)); + g_poInputFile = sf_open(pcFilename, SFM_READ, &oInfo); + if (g_poInputFile == NULL) { fprintf(stderr, - "\"applyplugin\" has very limited support for sound files types. " - "The file \"%s\" is not a simple 16bit PCM Wave File.\n", - pcFilename); + "Failed to open input file \"%s\".\n", + pcFilename); exit(1); } - /* Not portable casting (short assumed 16bit, unsigned int assumed - 32bit), alignment assumed not a problem. This is all bad. */ - WORD_ORDER_SWAP_16BIT(pcHeader + 22); - g_lInputFileChannelCount - = *plChannelCount - = *((unsigned short *)(pcHeader + 22)); - WORD_ORDER_SWAP_32BIT(pcHeader + 24); - *plSampleRate - = *((unsigned int *)(pcHeader + 24)); - WORD_ORDER_SWAP_32BIT(pcHeader + 40); - *plLength - = (*((unsigned int *)(pcHeader + 40)) - / (*plChannelCount * sizeof(short))); + *plChannelCount = (unsigned long)(oInfo.channels); + *plSampleRate = (unsigned long)(oInfo.samplerate); - g_psInputFileBuffer - = (short *)calloc(*plChannelCount * BUFFER_SIZE, sizeof(short)); + g_lInputFileChannelCount + = *plChannelCount; + g_pfInputFileBuffer + = (float *)calloc(*plChannelCount * BUFFER_SIZE, sizeof(float)); + } -static void -createWaveFile(const char * pcFilename, - unsigned long lChannelCount, - unsigned long lSampleRate, - unsigned long lLength) { +int +getLibsndfileFormat(const char * pcFilename) { - - char pcHeader[44]; - size_t lWriteLength; - - static const char pcHeaderBase[44] = { - 'R', 'I', 'F', 'F', - 0, 0, 0, 0, - 'W', 'A', 'V', 'E', - 'f', 'm', 't', ' ', - 16, 0, 0, 0, - 1, 0, - 1, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, - 16, 0, - 'd', 'a', 't', 'a', - 0, 0, 0, 0 - }; - - g_poOutputFile = fopen(pcFilename, "wb"); - if (!g_poOutputFile) { + const char * pcSuffix, * pcAt; + int iCount, iIndex; + SF_FORMAT_INFO oInfo; + + pcSuffix = NULL; + for (pcAt = pcFilename; *pcAt != '\0'; pcAt++) + if (*pcAt == '.') + pcSuffix = pcAt; + + if (pcSuffix == NULL) { fprintf(stderr, - "Failed to open output file \"%s\": %s\n", - pcFilename, - strerror(errno)); + "Unable to establish output file type.\n"); exit(1); } + + pcSuffix++; + + sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &iCount, sizeof(iCount)); + + for (iIndex = 0; iIndex < iCount; iIndex++) { + + oInfo.format = iIndex; + sf_command(NULL, SFC_GET_FORMAT_MAJOR, &oInfo, sizeof(oInfo)); + + if (strcasecmp(pcSuffix, oInfo.extension) == 0) { - /* Not portable casting (short assumed 16bit, unsigned int assumed - 32bit), alignment assumed not a problem. This is all bad. */ - memcpy(pcHeader, pcHeaderBase, 44); - - *(unsigned int *)(pcHeader + 4) - = (unsigned int)(lLength * lChannelCount * sizeof(short) + 36); - WORD_ORDER_SWAP_32BIT(pcHeader + 4); - /* (Or should it be +32?) */ - *(unsigned short *)(pcHeader + 22) - = (unsigned short)lChannelCount; - WORD_ORDER_SWAP_16BIT(pcHeader + 22); - *(unsigned int *)(pcHeader + 24) - = (unsigned int)lSampleRate; - WORD_ORDER_SWAP_32BIT(pcHeader + 24); - *(unsigned int *)(pcHeader + 28) - = (unsigned int)(lSampleRate * lChannelCount * sizeof(short)); - WORD_ORDER_SWAP_32BIT(pcHeader + 28); - *(unsigned short *)(pcHeader + 32) - = (unsigned short)(lChannelCount * sizeof(short)); - WORD_ORDER_SWAP_16BIT(pcHeader + 32); - *(unsigned int *)(pcHeader + 40) - = (unsigned int)(lLength * lChannelCount * sizeof(short)); - WORD_ORDER_SWAP_32BIT(pcHeader + 40); + /* Always set the minor format to PCM16 for simplicity. This + could be improved on. */ + return (oInfo.format & SF_FORMAT_TYPEMASK) | SF_FORMAT_PCM_16; + + } + + } + + fprintf(stderr, + "Unable to open file of type \"%s\".\n", + pcSuffix); + exit(1); - g_lOutputFileChannelCount = lChannelCount; +} + +static void +openOutputFile(const char * pcFilename, + unsigned long lChannelCount, + unsigned long lSampleRate) { - lWriteLength = fwrite(pcHeader, sizeof(char), 44, g_poOutputFile); - if (lWriteLength < 44) { + SF_INFO oInfo; + + memset(&oInfo, 0, sizeof(SF_INFO)); + oInfo.channels = (int)lChannelCount; + oInfo.samplerate = (int)lSampleRate; + oInfo.format = getLibsndfileFormat(pcFilename); + g_poOutputFile = sf_open(pcFilename, SFM_WRITE, &oInfo); + if (g_poOutputFile == NULL) { fprintf(stderr, - "Failed to write header to output file \"%s\": %s\n", - pcFilename, - strerror(errno)); + "Failed to open output file \"%s\".\n", + pcFilename); exit(1); } - g_psOutputFileBuffer - = (short *)calloc(lChannelCount * BUFFER_SIZE, sizeof(short)); + g_lOutputFileChannelCount + = lChannelCount; + g_piOutputFileBuffer + = (int32_t *)calloc(lChannelCount * BUFFER_SIZE, sizeof(int32_t)); + } -static void +static int readIntoBuffers(LADSPA_Data ** ppfBuffers, - const unsigned long lFrameSize) { + const unsigned long lFrameSize) { - short * psReadPointer; - size_t lReadLength; - unsigned long lChannelIndex; - unsigned long lFrameIndex; - - lReadLength = fread(g_psInputFileBuffer, - sizeof(short) * g_lInputFileChannelCount, - lFrameSize, - g_poInputFile); - if (lReadLength < lFrameSize) { + sf_count_t lReadLength, lFrameIndex; + const float * pfReadPointer; + long lChannelIndex; + + lReadLength = sf_readf_float(g_poInputFile, + g_pfInputFileBuffer, + (sf_count_t)lFrameSize); + if (lReadLength < 0) { fprintf(stderr, - "Failed to read audio from input file. Is the file damaged?\n"); + "Failed to read audio from input file.\n"); exit(1); } for (lChannelIndex = 0; lChannelIndex < g_lInputFileChannelCount; lChannelIndex++) { - psReadPointer = g_psInputFileBuffer + lChannelIndex; + pfReadPointer = g_pfInputFileBuffer + lChannelIndex; for (lFrameIndex = 0; - lFrameIndex < lFrameSize; - lFrameIndex++, psReadPointer += g_lInputFileChannelCount) { - WORD_ORDER_SWAP_16BIT(psReadPointer); - ppfBuffers[lChannelIndex][lFrameIndex] - = ((LADSPA_Data)*psReadPointer) * (1.0f / 32767.5f); - } + lFrameIndex < lReadLength; + lFrameIndex++, + pfReadPointer += g_lInputFileChannelCount) + ppfBuffers[lChannelIndex][lFrameIndex] + = (LADSPA_Data)(*pfReadPointer); } + + return (int)lReadLength; + } static void writeFromBuffers(LADSPA_Data ** ppfBuffers, - const unsigned long lFrameSize) { + const unsigned long lFrameSize) { - LADSPA_Data fValue, fAbsValue; - short * psWritePointer; + LADSPA_Data fValue, fAbsValue, fScalar, fMinimum, fMaximum; + int bLow, bHigh; + int32_t * piWritePointer; size_t lWriteLength; unsigned long lChannelIndex; unsigned long lFrameIndex; + fScalar = (float)( 0x80000000ll); + fMinimum = (float)(-0x80000000ll); + fMaximum = (float)( 0x7FFFFFFFll); + for (lChannelIndex = 0; lChannelIndex < g_lOutputFileChannelCount; lChannelIndex++) { - psWritePointer = g_psOutputFileBuffer + lChannelIndex; + + piWritePointer = g_piOutputFileBuffer + lChannelIndex; + for (lFrameIndex = 0; - lFrameIndex < lFrameSize; - lFrameIndex++, psWritePointer += g_lOutputFileChannelCount) { - fValue = ppfBuffers[lChannelIndex][lFrameIndex] * 32767.5f; + lFrameIndex < lFrameSize; + lFrameIndex++, + piWritePointer += g_lOutputFileChannelCount) { + + fValue = ppfBuffers[lChannelIndex][lFrameIndex]; + fAbsValue = fabs(fValue); if (fAbsValue > g_fPeakWritten) - g_fPeakWritten = fAbsValue; - /* Use hard clipping as it sounds better than wraparound. */ - if (fValue > 32767) - *psWritePointer = 32767; - else if (fValue <= -32768) - *psWritePointer = -32768; - else - *psWritePointer = (short)fValue; - WORD_ORDER_SWAP_16BIT(psWritePointer); + g_fPeakWritten = fAbsValue; + + fValue *= fScalar; + + bHigh = (fValue >= fMaximum); + bLow = (fValue <= fMinimum); + if (bHigh | bLow) { + if (bHigh) + fValue = fMaximum; + else + fValue = fMinimum; + } + + *piWritePointer = (int32_t)(llrintf(fValue)); + } + } - lWriteLength = fwrite(g_psOutputFileBuffer, - sizeof(short) * g_lOutputFileChannelCount, - lFrameSize, - g_poOutputFile); + lWriteLength = sf_writef_int(g_poOutputFile, + g_piOutputFileBuffer, + lFrameSize); if (lWriteLength < lFrameSize) { fprintf(stderr, - "Failed to read audio to output file. Is the disk full?\n"); + "Failed to write audio to output file.\n"); exit(1); } @@ -294,8 +231,8 @@ static void closeFiles(void) { - fclose(g_poInputFile); - fclose(g_poOutputFile); + sf_close(g_poInputFile); + sf_close(g_poOutputFile); printf("Peak output: %g\n", g_fPeakWritten); } @@ -303,7 +240,7 @@ static unsigned long getPortCountByType(const LADSPA_Descriptor * psDescriptor, - const LADSPA_PortDescriptor iType) { + const LADSPA_PortDescriptor iType) { unsigned long lCount; unsigned long lIndex; @@ -325,54 +262,54 @@ unsigned long lIndex; LADSPA_PortRangeHintDescriptor iHintDescriptor; LADSPA_Data fBound; - + fprintf(stderr, - "Plugin \"%s\" has the following control inputs:\n", - psDescriptor->Name); + "Plugin \"%s\" has the following control inputs:\n", + psDescriptor->Name); bFound = 0; for (lIndex = 0; lIndex < psDescriptor->PortCount; lIndex++) if (LADSPA_IS_PORT_INPUT(psDescriptor->PortDescriptors[lIndex]) - && LADSPA_IS_PORT_CONTROL(psDescriptor->PortDescriptors[lIndex])) { + && LADSPA_IS_PORT_CONTROL(psDescriptor->PortDescriptors[lIndex])) { fprintf(stderr, - "\t%s", - psDescriptor->PortNames[lIndex]); + "\t%s", + psDescriptor->PortNames[lIndex]); bFound = 1; iHintDescriptor = psDescriptor->PortRangeHints[lIndex].HintDescriptor; if (LADSPA_IS_HINT_BOUNDED_BELOW(iHintDescriptor) - || LADSPA_IS_HINT_BOUNDED_ABOVE(iHintDescriptor)) { - fprintf(stderr, " ("); - if (LADSPA_IS_HINT_BOUNDED_BELOW(iHintDescriptor)) { - fBound = psDescriptor->PortRangeHints[lIndex].LowerBound; - if (LADSPA_IS_HINT_SAMPLE_RATE(iHintDescriptor)) { - if (fBound == 0) - fprintf(stderr, "0"); - else - fprintf(stderr, "%g * sample rate", fBound); - } - else - fprintf(stderr, "%g", fBound); - } - else - fprintf(stderr, "..."); - fprintf(stderr, " to "); - if (LADSPA_IS_HINT_BOUNDED_ABOVE(iHintDescriptor)) { - fBound = psDescriptor->PortRangeHints[lIndex].UpperBound; - if (LADSPA_IS_HINT_SAMPLE_RATE(iHintDescriptor)) { - if (fBound == 0) - fprintf(stderr, "0"); - else - fprintf(stderr, "%g * sample rate", fBound); - } - else - fprintf(stderr, "%g", fBound); - } - else - fprintf(stderr, "..."); - fprintf(stderr, ")\n"); + || LADSPA_IS_HINT_BOUNDED_ABOVE(iHintDescriptor)) { + fprintf(stderr, " ("); + if (LADSPA_IS_HINT_BOUNDED_BELOW(iHintDescriptor)) { + fBound = psDescriptor->PortRangeHints[lIndex].LowerBound; + if (LADSPA_IS_HINT_SAMPLE_RATE(iHintDescriptor)) { + if (fBound == 0) + fprintf(stderr, "0"); + else + fprintf(stderr, "%g * sample rate", fBound); + } + else + fprintf(stderr, "%g", fBound); + } + else + fprintf(stderr, "..."); + fprintf(stderr, " to "); + if (LADSPA_IS_HINT_BOUNDED_ABOVE(iHintDescriptor)) { + fBound = psDescriptor->PortRangeHints[lIndex].UpperBound; + if (LADSPA_IS_HINT_SAMPLE_RATE(iHintDescriptor)) { + if (fBound == 0) + fprintf(stderr, "0"); + else + fprintf(stderr, "%g * sample rate", fBound); + } + else + fprintf(stderr, "%g", fBound); + } + else + fprintf(stderr, "..."); + fprintf(stderr, ")\n"); } else - fprintf(stderr, "\n"); + fprintf(stderr, "\n"); } if (!bFound) @@ -384,11 +321,11 @@ /* Note that this procedure leaks memory like mad. */ static void applyPlugin(const char * pcInputFilename, - const char * pcOutputFilename, - const LADSPA_Data fExtraSeconds, - const unsigned long lPluginCount, - const LADSPA_Descriptor ** ppsPluginDescriptors, - LADSPA_Data ** ppfPluginControlValues) { + const char * pcOutputFilename, + const LADSPA_Data fExtraSeconds, + const unsigned long lPluginCount, + const LADSPA_Descriptor ** ppsPluginDescriptors, + LADSPA_Data ** ppfPluginControlValues) { LADSPA_PortDescriptor iPortDescriptor; LADSPA_Handle * ppsPlugins; @@ -401,13 +338,11 @@ unsigned long lBufferIndex; unsigned long lControlIndex; unsigned long lInputFileChannelCount; - unsigned long lInputFileLength; unsigned long lOutputFileChannelCount; - unsigned long lOutputFileLength; unsigned long lPluginIndex; unsigned long lPortIndex; unsigned long lSampleRate; - unsigned long lTimeAt; + long lTail; LADSPA_Data fDummyControlOutput; /* Open input file and output file: @@ -415,33 +350,28 @@ lOutputFileChannelCount = getPortCountByType(ppsPluginDescriptors[lPluginCount - 1], - LADSPA_PORT_AUDIO | LADSPA_PORT_OUTPUT); + LADSPA_PORT_AUDIO | LADSPA_PORT_OUTPUT); if (lOutputFileChannelCount == 0) { fprintf(stderr, - "The last plugin in the chain has no audio outputs.\n"); + "The last plugin in the chain has no audio outputs.\n"); exit(1); } - openWaveFile(pcInputFilename, - &lInputFileChannelCount, - &lSampleRate, - &lInputFileLength); + openInputFile(pcInputFilename, + &lInputFileChannelCount, + &lSampleRate); if (lInputFileChannelCount != getPortCountByType(ppsPluginDescriptors[0], - LADSPA_PORT_AUDIO | LADSPA_PORT_INPUT)) { + LADSPA_PORT_AUDIO | LADSPA_PORT_INPUT)) { fprintf(stderr, - "Mismatch between channel count in input file and audio inputs " - "on first plugin in chain.\n"); + "Mismatch between channel count in input file and audio inputs " + "on first plugin in chain.\n"); exit(1); } - lOutputFileLength - = lInputFileLength + (unsigned long)(fExtraSeconds * lSampleRate); - - createWaveFile(pcOutputFilename, - lOutputFileChannelCount, - lSampleRate, - lOutputFileLength); + openOutputFile(pcOutputFilename, + lOutputFileChannelCount, + lSampleRate); /* Count buffers and sanity-check the flow graph: ---------------------------------------------- */ @@ -452,25 +382,25 @@ lAudioInputCount = getPortCountByType(ppsPluginDescriptors[lPluginIndex], - LADSPA_PORT_AUDIO | LADSPA_PORT_INPUT); + LADSPA_PORT_AUDIO | LADSPA_PORT_INPUT); lAudioOutputCount = getPortCountByType(ppsPluginDescriptors[lPluginIndex], - LADSPA_PORT_AUDIO | LADSPA_PORT_OUTPUT); + LADSPA_PORT_AUDIO | LADSPA_PORT_OUTPUT); if (lBufferCount < lAudioInputCount) lBufferCount = lAudioInputCount; if (lPluginIndex > 0) if (lAudioInputCount != lPreviousAudioOutputCount) { - fprintf(stderr, - "There is a mismatch between the number of output channels " - "on plugin \"%s\" (%ld) and the number of input channels on " - "plugin \"%s\" (%ld).\n", - ppsPluginDescriptors[lPluginIndex - 1]->Name, - lPreviousAudioOutputCount, - ppsPluginDescriptors[lPluginIndex]->Name, - lAudioInputCount); - exit(1); + fprintf(stderr, + "There is a mismatch between the number of output channels " + "on plugin \"%s\" (%ld) and the number of input channels on " + "plugin \"%s\" (%ld).\n", + ppsPluginDescriptors[lPluginIndex - 1]->Name, + lPreviousAudioOutputCount, + ppsPluginDescriptors[lPluginIndex]->Name, + lAudioInputCount); + exit(1); } lPreviousAudioOutputCount = lAudioOutputCount; @@ -493,11 +423,11 @@ ppsPlugins[lPluginIndex] = ppsPluginDescriptors[lPluginIndex] ->instantiate(ppsPluginDescriptors[lPluginIndex], - lSampleRate); + lSampleRate); if (!ppsPlugins[lPluginIndex]) { fprintf(stderr, - "Failed to instantiate plugin of type \"%s\".\n", - ppsPluginDescriptors[lPluginIndex]->Name); + "Failed to instantiate plugin of type \"%s\".\n", + ppsPluginDescriptors[lPluginIndex]->Name); exit(1); } @@ -506,23 +436,23 @@ lControlIndex = 0; for (lPortIndex = 0; - lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; - lPortIndex++) { + lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; + lPortIndex++) { iPortDescriptor - = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; + = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; if (LADSPA_IS_PORT_CONTROL(iPortDescriptor)) { - if (LADSPA_IS_PORT_INPUT(iPortDescriptor)) - ppsPluginDescriptors[lPluginIndex]->connect_port - (ppsPlugins[lPluginIndex], - lPortIndex, - ppfPluginControlValues[lPluginIndex] + (lControlIndex++)); - if (LADSPA_IS_PORT_OUTPUT(iPortDescriptor)) - ppsPluginDescriptors[lPluginIndex]->connect_port - (ppsPlugins[lPluginIndex], - lPortIndex, - &fDummyControlOutput); + if (LADSPA_IS_PORT_INPUT(iPortDescriptor)) + ppsPluginDescriptors[lPluginIndex]->connect_port + (ppsPlugins[lPluginIndex], + lPortIndex, + ppfPluginControlValues[lPluginIndex] + (lControlIndex++)); + if (LADSPA_IS_PORT_OUTPUT(iPortDescriptor)) + ppsPluginDescriptors[lPluginIndex]->connect_port + (ppsPlugins[lPluginIndex], + lPortIndex, + &fDummyControlOutput); } } @@ -531,16 +461,16 @@ lBufferIndex = 0; for (lPortIndex = 0; - lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; - lPortIndex++) { + lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; + lPortIndex++) { iPortDescriptor - = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; + = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; if (LADSPA_IS_PORT_INPUT(iPortDescriptor) - && LADSPA_IS_PORT_AUDIO(iPortDescriptor)) - ppsPluginDescriptors[lPluginIndex]->connect_port - (ppsPlugins[lPluginIndex], - lPortIndex, - ppfBuffers[lBufferIndex++]); + && LADSPA_IS_PORT_AUDIO(iPortDescriptor)) + ppsPluginDescriptors[lPluginIndex]->connect_port + (ppsPlugins[lPluginIndex], + lPortIndex, + ppfBuffers[lBufferIndex++]); } @@ -549,16 +479,16 @@ lBufferIndex = 0; for (lPortIndex = 0; - lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; - lPortIndex++) { + lPortIndex < ppsPluginDescriptors[lPluginIndex]->PortCount; + lPortIndex++) { iPortDescriptor - = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; + = ppsPluginDescriptors[lPluginIndex]->PortDescriptors[lPortIndex]; if (LADSPA_IS_PORT_OUTPUT(iPortDescriptor) - && LADSPA_IS_PORT_AUDIO(iPortDescriptor)) - ppsPluginDescriptors[lPluginIndex]->connect_port - (ppsPlugins[lPluginIndex], - lPortIndex, - ppfBuffers[lBufferIndex++]); + && LADSPA_IS_PORT_AUDIO(iPortDescriptor)) + ppsPluginDescriptors[lPluginIndex]->connect_port + (ppsPlugins[lPluginIndex], + lPortIndex, + ppfBuffers[lBufferIndex++]); } } @@ -572,40 +502,32 @@ /* Run: ---- */ - lTimeAt = 0; - while (lTimeAt < lOutputFileLength) { + lTail = -1; + while (lTail != 0) { - lFrameSize = lInputFileLength - lTimeAt; - if (lFrameSize > BUFFER_SIZE) - lFrameSize = BUFFER_SIZE; + if (lTail < 0) { + lFrameSize = readIntoBuffers(ppfBuffers, BUFFER_SIZE); + if (lFrameSize < BUFFER_SIZE) + lTail = (unsigned long)(fExtraSeconds * lSampleRate); + } else { - /* We've reached or are reaching the end of the file. We're not - going to fill the buffer from file. Could just memset the end - part, but there's only one frame where this is worth the - effort. */ for (lBufferIndex = 0; lBufferIndex < lBufferCount; lBufferIndex++) - memset(ppfBuffers[lBufferIndex], 0, sizeof(LADSPA_Data) * BUFFER_SIZE); - } - - if (lFrameSize > 0) { - /* Read from disk. */ - readIntoBuffers(ppfBuffers, lFrameSize); + memset(ppfBuffers[lBufferIndex], 0, sizeof(LADSPA_Data) * BUFFER_SIZE); + lFrameSize = BUFFER_SIZE; + if (lTail < lFrameSize) + lFrameSize = lTail; + lTail -= lFrameSize; } /* Run the plugins: */ - lFrameSize = lOutputFileLength - lTimeAt; - if (lFrameSize > BUFFER_SIZE) - lFrameSize = BUFFER_SIZE; - for (lPluginIndex = 0; lPluginIndex < lPluginCount; lPluginIndex++) ppsPluginDescriptors[lPluginIndex] - ->run(ppsPlugins[lPluginIndex], - lFrameSize); + ->run(ppsPlugins[lPluginIndex], + lFrameSize); /* Write the output to disk. */ writeFromBuffers(ppfBuffers, lFrameSize); - lTimeAt += lFrameSize; } /* Deactivate: @@ -664,13 +586,13 @@ if (strcmp(ppcArgv[1], "-s") == 0) { fExtraSeconds = (LADSPA_Data)strtod(ppcArgv[2], &pcEndPointer); bBadControls = (ppcArgv[2] + strlen(ppcArgv[2]) - != pcEndPointer); + != pcEndPointer); lArgumentIndex = 3; } else if (strncmp(ppcArgv[1], "-s", 2) == 0) { fExtraSeconds = (LADSPA_Data)strtod(ppcArgv[1] + 2, &pcEndPointer); bBadControls = (ppcArgv[1] + strlen(ppcArgv[1]) - != pcEndPointer); + != pcEndPointer); lArgumentIndex = 2; } } @@ -684,7 +606,7 @@ } else { - pcInputFilename = ppcArgv[lArgumentIndex]; + pcInputFilename = ppcArgv[lArgumentIndex]; pcOutputFilename = ppcArgv[lArgumentIndex + 1]; /* Now we need to look through any plugins and plugin parameters @@ -702,70 +624,68 @@ lPluginCountUpperLimit = (iArgc - lArgumentIndex - 1) / 2; ppvPluginLibraries = ((void **) - calloc(lPluginCountUpperLimit, - sizeof(void *))); + calloc(lPluginCountUpperLimit, + sizeof(void *))); ppsPluginDescriptors = ((const LADSPA_Descriptor **) - calloc(lPluginCountUpperLimit, - sizeof(LADSPA_Descriptor *))); + calloc(lPluginCountUpperLimit, + sizeof(LADSPA_Descriptor *))); ppfPluginControlValues = ((LADSPA_Data **) - calloc(lPluginCountUpperLimit, - sizeof(LADSPA_Data *))); + calloc(lPluginCountUpperLimit, + sizeof(LADSPA_Data *))); lPluginIndex = 0; lArgumentIndex += 2; bBadControls = 0; while (lArgumentIndex < (unsigned long)iArgc && !bBadControls) { if (lArgumentIndex + 1 == (unsigned long)iArgc) { - bBadParameters = 1; - break; + bBadParameters = 1; + break; } /* Parameter should be a plugin file name followed by a label. Load the plugin. This call will exit() if the load fails. */ ppvPluginLibraries[lPluginIndex] - = loadLADSPAPluginLibrary(ppcArgv[lArgumentIndex]); + = loadLADSPAPluginLibrary(ppcArgv[lArgumentIndex]); ppsPluginDescriptors[lPluginIndex] - = findLADSPAPluginDescriptor(ppvPluginLibraries[lPluginIndex], - ppcArgv[lArgumentIndex], - ppcArgv[lArgumentIndex + 1]); + = findLADSPAPluginDescriptor(ppvPluginLibraries[lPluginIndex], + ppcArgv[lArgumentIndex], + ppcArgv[lArgumentIndex + 1]); /* Check the plugin is in-place compatible. */ iProperties = ppsPluginDescriptors[lPluginIndex]->Properties; if (LADSPA_IS_INPLACE_BROKEN(iProperties)) { - fprintf(stderr, - "Plugin \"%s\" is not capable of in-place processing and " - "therefore cannot be used by this program.\n", - ppsPluginDescriptors[lPluginIndex]->Name); - /* This is somewhat lazy - this isn't a difficult problem to + fprintf(stderr, + "Plugin \"%s\" is not capable of in-place processing and " + "therefore cannot be used by this program.\n", + ppsPluginDescriptors[lPluginIndex]->Name); + /* This is somewhat lazy - this isn't a difficult problem to get around. */ - return(1); + return(1); } lControlValueCount - = getPortCountByType(ppsPluginDescriptors[lPluginIndex], - LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL); - + = getPortCountByType(ppsPluginDescriptors[lPluginIndex], + LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL); + bBadControls = (lControlValueCount + lArgumentIndex + 2 - > (unsigned long)iArgc); + > (unsigned long)iArgc); if (lControlValueCount > 0 && !bBadControls) { - ppfPluginControlValues[lPluginIndex] - = (LADSPA_Data *)calloc(lControlValueCount, sizeof(LADSPA_Data)); - for (lControlValueIndex = 0; - lControlValueIndex < lControlValueCount && !bBadControls; - lControlValueIndex++) { - pcControlValue = ppcArgv[lArgumentIndex + 2 + lControlValueIndex]; - - ppfPluginControlValues[lPluginIndex][lControlValueIndex] - = (LADSPA_Data)strtod(pcControlValue, &pcEndPointer); - - bBadControls = (pcControlValue + strlen(pcControlValue) - != pcEndPointer); - } + ppfPluginControlValues[lPluginIndex] + = (LADSPA_Data *)calloc(lControlValueCount, sizeof(LADSPA_Data)); + for (lControlValueIndex = 0; + lControlValueIndex < lControlValueCount && !bBadControls; + lControlValueIndex++) { + pcControlValue = ppcArgv[lArgumentIndex + 2 + lControlValueIndex]; + ppfPluginControlValues[lPluginIndex][lControlValueIndex] + = (LADSPA_Data)strtod(pcControlValue, &pcEndPointer); + bBadControls = (pcControlValue + strlen(pcControlValue) + != pcEndPointer); + } } if (bBadControls) - listControlsForPlugin(ppsPluginDescriptors[lPluginIndex]); + listControlsForPlugin(ppsPluginDescriptors[lPluginIndex]); lArgumentIndex += (2 + lControlValueCount); lPluginIndex++; @@ -776,33 +696,33 @@ if (!bBadControls) { /* We have all the data we need. Go go go. If this function - fails it will exit(). */ + fails it will exit(). */ applyPlugin(pcInputFilename, - pcOutputFilename, - fExtraSeconds, - lPluginCount, - ppsPluginDescriptors, - ppfPluginControlValues); + pcOutputFilename, + fExtraSeconds, + lPluginCount, + ppsPluginDescriptors, + ppfPluginControlValues); for (lPluginIndex = 0; lPluginIndex < lPluginCount; lPluginIndex++) - unloadLADSPAPluginLibrary(ppvPluginLibraries[lPluginIndex]); + unloadLADSPAPluginLibrary(ppvPluginLibraries[lPluginIndex]); } } if (bBadParameters) { fprintf(stderr, - "Usage:\tapplyplugin [flags] <input Wave file> " - "<output Wave file>\n" - "\t<LADSPA plugin file name> <plugin label> " - "<Control1> <Control2>...\n" - "\t[<LADSPA plugin file name> <plugin label> " - "<Control1> <Control2>...]...\n" - "Flags:" - "\t-s<seconds> Add seconds of silence after end of input file.\n" - "\n" - "To find out what control values are needed by a plugin, " - "use the\n" - "\"analyseplugin\" program and check for control input ports.\n" + "Usage:\tapplyplugin [flags] <input audio file> " + "<output audio file>\n" + "\t<LADSPA plugin file name> <plugin label> " + "<Control1> <Control2>...\n" + "\t[<LADSPA plugin file name> <plugin label> " + "<Control1> <Control2>...]...\n" + "Flags:" + "\t-s<seconds> Add seconds of silence after end of input file.\n" + "\n" + "To find out what control values are needed by a plugin, " + "use the\n" + "\"analyseplugin\" program and check for control input ports.\n" "Note that the LADSPA_PATH environment variable is used " "to help find plugins.\n"); return(1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ladspa_sdk_1.15/src/plugins/delay.c new/ladspa_sdk_1.17/src/plugins/delay.c --- old/ladspa_sdk_1.15/src/plugins/delay.c 2019-01-06 13:27:52.000000000 +0100 +++ new/ladspa_sdk_1.17/src/plugins/delay.c 2021-09-10 10:50:46.000000000 +0200 @@ -31,13 +31,13 @@ /* The port numbers for the plugin: */ #define SDL_DELAY_LENGTH 0 -#define SDL_DRY_WET 1 -#define SDL_INPUT 2 -#define SDL_OUTPUT 3 +#define SDL_DRY_WET 1 +#define SDL_INPUT 2 +#define SDL_OUTPUT 3 /*****************************************************************************/ -#define LIMIT_BETWEEN_0_AND_1(x) \ +#define LIMIT_BETWEEN_0_AND_1(x) \ (((x) < 0) ? 0 : (((x) > 1) ? 1 : (x))) #define LIMIT_BETWEEN_0_AND_MAX_DELAY(x) \ (((x) < 0) ? 0 : (((x) > MAX_DELAY) ? MAX_DELAY : (x))) @@ -80,7 +80,7 @@ /* Construct a new plugin instance. */ static LADSPA_Handle instantiateSimpleDelayLine(const LADSPA_Descriptor * Descriptor, - unsigned long SampleRate) { + unsigned long SampleRate) { unsigned long lMinimumBufferSize; SimpleDelayLine * psDelayLine; @@ -91,10 +91,12 @@ if (psDelayLine == NULL) return NULL; - psDelayLine->m_fSampleRate = (LADSPA_Data)SampleRate; + psDelayLine->m_fSampleRate + = (LADSPA_Data)SampleRate; /* Buffer size is a power of two bigger than max delay time. */ - lMinimumBufferSize = (unsigned long)((LADSPA_Data)SampleRate * MAX_DELAY); + lMinimumBufferSize + = (unsigned long)((LADSPA_Data)SampleRate * MAX_DELAY) + 1; psDelayLine->m_lBufferSize = 1; while (psDelayLine->m_lBufferSize < lMinimumBufferSize) psDelayLine->m_lBufferSize <<= 1; @@ -181,7 +183,7 @@ lDelay = (unsigned long) (LIMIT_BETWEEN_0_AND_MAX_DELAY(*(psSimpleDelayLine->m_pfDelay)) * psSimpleDelayLine->m_fSampleRate); - + pfInput = psSimpleDelayLine->m_pfInput; pfOutput = psSimpleDelayLine->m_pfOutput; pfBuffer = psSimpleDelayLine->m_pfBuffer; @@ -195,11 +197,11 @@ lSampleIndex < SampleCount; lSampleIndex++) { fInputSample = *(pfInput++); + pfBuffer[((lSampleIndex + lBufferWriteOffset) + & lBufferSizeMinusOne)] = fInputSample; *(pfOutput++) = (fDry * fInputSample + fWet * pfBuffer[((lSampleIndex + lBufferReadOffset) & lBufferSizeMinusOne)]); - pfBuffer[((lSampleIndex + lBufferWriteOffset) - & lBufferSizeMinusOne)] = fInputSample; } psSimpleDelayLine->m_lWritePointer
