This file is indexed.

/usr/include/svxlink/AsyncAudioCompressor.h is in libasyncaudio-dev 14.08.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/**
@file	 AsyncAudioCompressor.h
@brief   Contains a class to do audio compression/limiting
@author  Tobias Blomberg / SM0SVX
@date	 2006-05-01

\verbatim
Async - A library for programming event driven applications
Copyright (C) 2004-2008 Tobias Blomberg / SM0SVX

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
\endverbatim
*/

#ifndef ASYNC_AUDIO_COMPRESSOR_INCLUDED
#define ASYNC_AUDIO_COMPRESSOR_INCLUDED


/****************************************************************************
 *
 * System Includes
 *
 ****************************************************************************/

#include <cmath>


/****************************************************************************
 *
 * Project Includes
 *
 ****************************************************************************/

#include <AsyncAudioProcessor.h>



/****************************************************************************
 *
 * Local Includes
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Forward declarations
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Namespace
 *
 ****************************************************************************/

namespace Async
{


/****************************************************************************
 *
 * Forward declarations of classes inside of the declared namespace
 *
 ****************************************************************************/

  

/****************************************************************************
 *
 * Defines & typedefs
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Exported Global Variables
 *
 ****************************************************************************/



/****************************************************************************
 *
 * Class definitions
 *
 ****************************************************************************/

class EnvelopeDetector
{
  public:
    EnvelopeDetector( double ms = 1.0, double sampleRate = INTERNAL_SAMPLE_RATE )
      : sampleRate_( sampleRate ), ms_( ms ), coef_( 0.0 )
    {
      setCoef();
    }

    virtual ~EnvelopeDetector() {}

    // time constant
    virtual void   setTc( double ms )
    {
      ms_ = ms;
      setCoef();
    }

    virtual double getTc( void ) { return ms_; }

    // sample rate
    virtual void   setSampleRate( double sampleRate )
    {
      sampleRate_ = sampleRate;
      setCoef();
    }

    virtual double getSampleRate( void ) { return sampleRate_; }

    // runtime function
    inline void run( double in, double &state )
    {
      state = in + coef_ * ( state - in );
    }

  private:
    double sampleRate_;		// sample rate
    double ms_;			// time constant in ms
    double coef_;		// runtime coefficient
    
    void setCoef( void )	// coef algorithm
    {
      coef_ = exp( -1.0 / ( 0.001 * ms_ * sampleRate_ ) );
    }

}; // end EnvelopeDetector class





/**
@brief	A class to do audio compression/limiting
@author Tobias Blomberg / SM0SVX
@date   2006-05-01

Use this audio pipe class to do compression on an audio stream. Compression
is a method to reduce the dynamic range of an audio signal. After it has been
compressed it can be amplified to get a more audible end result.

This audio pipe component is mostly untested and is based on some ripped off
code which I really have not checked how it performs or if it works at all...
*/
class AudioCompressor : public AudioProcessor
{
  public:
    /**
     * @brief 	Default constuctor
     */
    AudioCompressor(void);
  
    /**
     * @brief 	Destructor
     */
    ~AudioCompressor(void);
  
    /**
     * @brief 	Set the compression threshold
     * @param 	thresh_db The compression threshold in dB
     *
     * The threshold is the level, in dB, the signal must rise to before
     * the compressor kicks in.
     */
    void setThreshold(double thresh_db) { threshdB_ = thresh_db; }
  
    /**
     * @brief 	Set the compression ratio
     * @param 	ratio The compression ratio (ex 0.1 == 10:1)
     */
    void setRatio(double ratio) { ratio_ = ratio; }
  
    /**
     * @brief 	Set the compressor attack time
     * @param 	attack_ms The attack time in milliseconds
     */
    void setAttack(double attack_ms) { att_.setTc(attack_ms);}
  
    /**
     * @brief 	Set the compressor decay time
     * @param 	decay_ms The decay time in milliseconds
     */
    void setDecay(double decay_ms) { rel_.setTc(decay_ms); }
  
    /**
     * @brief 	Set the output gain
     * @param 	gain The gain to set.
     *
     * The output gain is the amplification applied to the audio signal
     * before it leaves the compressor. If gain > 1 the signal is amplified.
     * If gain < 1 the signal is attenuated.
     */
    void setOutputGain(float gain);
  
    /**
     * @brief 	Reset the compressor
     */
    void reset(void);

    
  protected:
    virtual void processSamples(float *dest, const float *src, int count);
    
    
  private:
    // transfer function
    double threshdB_;	// threshold (dB)
    double ratio_;		// ratio (compression: < 1 ; expansion: > 1)
    double output_gain;

    // attack/release
    EnvelopeDetector att_;	// attack
    EnvelopeDetector rel_;	// release

    // runtime variables
    double envdB_;			// over-threshold envelope (dB)
    
    AudioCompressor(const AudioCompressor&);
    AudioCompressor& operator=(const AudioCompressor&);
    
};  /* class AudioCompressor */


} /* namespace */

#endif /* ASYNC_AUDIO_COMPRESSOR_INCLUDED */



/*
 * This file has not been truncated
 */