• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 
17 #ifndef OVERFLOW_CHECK_H
18 #define OVERFLOW_CHECK_H
19 
20 /* This is a clipping/overflow check.  This is designed to look for a
21    ~3-second duration ~250 Hz pure tone at a level sufficient to cause
22    about 20% clipping.  It examines the recorded waveform for possible
23    overflow/wraparound.  The input signal of numSamples total sampled at
24    sampleRate is in pcm. The expected signal contains silence - tone -
25    silence.  The approximate duration in seconds of the tone found is
26    returned in duration.  The number of unexpectedly-large jumps within
27    the tone is returned in numDeltas.  The approximate sample numbers of
28    the tone endpoints are returned in onset and offset.  The maximum
29    and minimum found in the signal located between onset and offset are
30    returned in maxPeak and minPeak, respectively.  The function
31    return is 1 if the operation was sucessful, 0 on failure. */
32 int overflowCheck(short* pcm, int numSamples, float sampleRate,
33                   float* duration, int* numDeltas, int* onset, int* offset,
34                   int* maxPeak, int* minPeak);
35 
36 #endif // OVERFLOW_CHECK_H
37