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 LINEARITY_TEST_H 18 #define LINEARITY_TEST_H 19 20 /* There are numSignals int16 signals in pcms. sampleCounts is an 21 integer array of length numSignals containing their respective 22 lengths in samples. They are all sampled at sampleRate. The pcms 23 are ordered by increasing stimulus level. The level steps between 24 successive stimuli were of size dbStepSize dB. The signal with 25 index referenceStim (0 <= referenceStim < numSignals) should be in 26 an amplitude range that is reasonably certain to be linear (e.g. at 27 normal speaking levels). The maximum deviation in linearity found 28 (in dB) is returned in maxDeviation. The function returns 1 if 29 the measurements could be made, or a negative number that 30 indicates the error, as follows: 31 -1 The input signals or sample counts are missing. 32 -2 The number of input signals is < 2. 33 -3 The specified sample rate is <= 4000.0 34 -4 The dB step size for the increase in stimulus level is <= 0.0/ 35 -5 The specified reverence stimulus number is out of range. 36 -6 One or more of the stimuli is too short in duration. */ 37 int linearityTest(short** pcms, int* sampleCounts, int numSignals, 38 float sampleRate, float dbStepSize, 39 int referenceStim, float* maxDeviation); 40 41 42 #endif /* LINEARITY_TEST_H */ 43