aboutsummaryrefslogtreecommitdiffstats
path: root/src/AudioCompress/compress.c
diff options
context:
space:
mode:
authorThomas Jansen <mithi@mithi.net>2011-02-04 10:39:21 +0100
committerMax Kellermann <max@duempel.org>2011-02-09 22:42:31 +0100
commit948b8f35e6fc578c85a0cfc8e143e1325ce99043 (patch)
tree022148bcb71a123f151d05b5936bc66ca35d332a /src/AudioCompress/compress.c
parente776c605adeb984aae290cdff38c5f8dd0cd291e (diff)
downloadmpd-948b8f35e6fc578c85a0cfc8e143e1325ce99043.tar.gz
mpd-948b8f35e6fc578c85a0cfc8e143e1325ce99043.tar.xz
mpd-948b8f35e6fc578c85a0cfc8e143e1325ce99043.zip
general: whitespace cleanup
Remove trailing whitespace found by this command: find -name '*.[ch]' | xargs grep "[[:space:]]$"
Diffstat (limited to '')
-rw-r--r--src/AudioCompress/compress.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/AudioCompress/compress.c b/src/AudioCompress/compress.c
index d5c08372c..36cdfd8dd 100644
--- a/src/AudioCompress/compress.c
+++ b/src/AudioCompress/compress.c
@@ -16,16 +16,16 @@
struct Compressor {
//! The compressor's preferences
struct CompressorConfig prefs;
-
+
//! History of the peak values
int *peaks;
-
+
//! History of the gain values
int *gain;
-
+
//! History of clip amounts
int *clipped;
-
+
unsigned int pos;
unsigned int bufsz;
};
@@ -41,9 +41,9 @@ struct Compressor *Compressor_new(unsigned int history)
obj->peaks = obj->gain = obj->clipped = NULL;
obj->bufsz = 0;
obj->pos = 0;
-
+
Compressor_setHistory(obj, history);
-
+
return obj;
}
@@ -70,7 +70,7 @@ void Compressor_setHistory(struct Compressor *obj, unsigned int history)
{
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);
@@ -82,7 +82,7 @@ struct CompressorConfig *Compressor_getConfig(struct Compressor *obj)
return &obj->prefs;
}
-void Compressor_Process_int16(struct Compressor *obj, int16_t *audio,
+void Compressor_Process_int16(struct Compressor *obj, int16_t *audio,
unsigned int count)
{
struct CompressorConfig *prefs = Compressor_getConfig(obj);
@@ -97,7 +97,7 @@ void Compressor_Process_int16(struct Compressor *obj, int16_t *audio,
int *clipped = obj->clipped + slot;
unsigned int ramp = count;
int delta;
-
+
ap = audio;
for (i = 0; i < count; i++)
{
@@ -124,15 +124,15 @@ void Compressor_Process_int16(struct Compressor *obj, int16_t *audio,
//! Determine target gain
newGain = (1 << 10)*prefs->target/peakVal;
-
+
//! Adjust the gain with inertia from the previous gain value
- newGain = (curGain*((1 << prefs->smooth) - 1) + newGain)
+ newGain = (curGain*((1 << prefs->smooth) - 1) + newGain)
>> prefs->smooth;
-
+
//! Make sure it's no more than the maximum gain value
if (newGain > (prefs->maxgain << 10))
newGain = prefs->maxgain << 10;
-
+
//! Make sure it's no less than 1:1
if (newGain < (1 << 10))
newGain = 1 << 10;
@@ -144,7 +144,7 @@ void Compressor_Process_int16(struct Compressor *obj, int16_t *audio,
//! Truncate the ramp time
ramp = peakPos;
}
-
+
//! Record the new gain
obj->gain[slot] = newGain;