annotate src/flac-1.2.1/include/share/replaygain_synthesis.h @ 141:1b5b6dfd0d0e

Add updated build of PortAudio for OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 03 Jan 2017 15:10:52 +0000
parents 98c1576536ae
children
rev   line source
cannam@86 1 /* replaygain_synthesis - Routines for applying ReplayGain to a signal
cannam@86 2 * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
cannam@86 3 *
cannam@86 4 * This library is free software; you can redistribute it and/or
cannam@86 5 * modify it under the terms of the GNU Lesser General Public
cannam@86 6 * License as published by the Free Software Foundation; either
cannam@86 7 * version 2.1 of the License, or (at your option) any later version.
cannam@86 8 *
cannam@86 9 * This library is distributed in the hope that it will be useful,
cannam@86 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@86 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cannam@86 12 * Lesser General Public License for more details.
cannam@86 13 *
cannam@86 14 * You should have received a copy of the GNU Lesser General Public
cannam@86 15 * License along with this library; if not, write to the Free Software
cannam@86 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
cannam@86 17 */
cannam@86 18
cannam@86 19 #ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
cannam@86 20 #define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
cannam@86 21
cannam@86 22 #include <stdlib.h> /* for size_t */
cannam@86 23 #include "FLAC/ordinals.h"
cannam@86 24
cannam@86 25 #define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2
cannam@86 26
cannam@86 27 typedef enum {
cannam@86 28 NOISE_SHAPING_NONE = 0,
cannam@86 29 NOISE_SHAPING_LOW = 1,
cannam@86 30 NOISE_SHAPING_MEDIUM = 2,
cannam@86 31 NOISE_SHAPING_HIGH = 3
cannam@86 32 } NoiseShaping;
cannam@86 33
cannam@86 34 typedef struct {
cannam@86 35 const float* FilterCoeff;
cannam@86 36 FLAC__uint64 Mask;
cannam@86 37 double Add;
cannam@86 38 float Dither;
cannam@86 39 float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
cannam@86 40 float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
cannam@86 41 int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
cannam@86 42 unsigned LastHistoryIndex;
cannam@86 43 NoiseShaping ShapingType;
cannam@86 44 } DitherContext;
cannam@86 45
cannam@86 46 void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
cannam@86 47
cannam@86 48 /* scale = (float) pow(10., (double)replaygain * 0.05); */
cannam@86 49 size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
cannam@86 50
cannam@86 51 #endif