pcm/Normalizer: remove Compressor_setHistory(), no resize possible
This feature was never used.
This commit is contained in:
parent
984c9c317a
commit
7702643e1b
@ -4,10 +4,8 @@
|
|||||||
|
|
||||||
#include "Normalizer.hxx"
|
#include "Normalizer.hxx"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/*** Default configuration stuff ***/
|
/*** Default configuration stuff ***/
|
||||||
#define TARGET 16384 /*!< Target level (on a scale of 0-32767) */
|
#define TARGET 16384 /*!< Target level (on a scale of 0-32767) */
|
||||||
@ -49,7 +47,13 @@ Compressor_new(unsigned int history) noexcept
|
|||||||
obj->bufsz = 0;
|
obj->bufsz = 0;
|
||||||
obj->pos = 0;
|
obj->pos = 0;
|
||||||
|
|
||||||
Compressor_setHistory(obj, history);
|
if (!history)
|
||||||
|
history = BUCKETS;
|
||||||
|
|
||||||
|
obj->bufsz = history;
|
||||||
|
obj->peaks = (int *)calloc(history, sizeof(*obj->peaks));
|
||||||
|
obj->gain = (int *)calloc(history, sizeof(*obj->gain));
|
||||||
|
obj->clipped = (int *)calloc(history, sizeof(*obj->clipped));
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -66,31 +70,6 @@ Compressor_delete(struct Compressor *obj) noexcept
|
|||||||
free(obj);
|
free(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *
|
|
||||||
resizeArray(int *data, int newsz, int oldsz) noexcept
|
|
||||||
{
|
|
||||||
data = (int *)realloc(data, newsz*sizeof(int));
|
|
||||||
if (data == nullptr)
|
|
||||||
/* out of memory, not much we can do */
|
|
||||||
abort();
|
|
||||||
|
|
||||||
if (newsz > oldsz)
|
|
||||||
memset(data + oldsz, 0, sizeof(int)*(newsz - oldsz));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Compressor_setHistory(struct Compressor *obj, unsigned int history) noexcept
|
|
||||||
{
|
|
||||||
if (!history)
|
|
||||||
history = BUCKETS;
|
|
||||||
|
|
||||||
obj->peaks = resizeArray(obj->peaks, history, obj->bufsz);
|
|
||||||
obj->gain = resizeArray(obj->gain, history, obj->bufsz);
|
|
||||||
obj->clipped = resizeArray(obj->clipped, history, obj->bufsz);
|
|
||||||
obj->bufsz = history;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CompressorConfig *
|
struct CompressorConfig *
|
||||||
Compressor_getConfig(struct Compressor *obj) noexcept
|
Compressor_getConfig(struct Compressor *obj) noexcept
|
||||||
{
|
{
|
||||||
|
@ -23,10 +23,6 @@ Compressor_new(unsigned int history) noexcept;
|
|||||||
void
|
void
|
||||||
Compressor_delete(struct Compressor *) noexcept;
|
Compressor_delete(struct Compressor *) noexcept;
|
||||||
|
|
||||||
//! Set the history length
|
|
||||||
void
|
|
||||||
Compressor_setHistory(struct Compressor *, unsigned int history) noexcept;
|
|
||||||
|
|
||||||
//! Get the configuration for a compressor
|
//! Get the configuration for a compressor
|
||||||
struct CompressorConfig *
|
struct CompressorConfig *
|
||||||
Compressor_getConfig(struct Compressor *) noexcept;
|
Compressor_getConfig(struct Compressor *) noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user