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 GENERATE_SINUSOID_H 18 #define GENERATE_SINUSOID_H 19 20 /* Return a sinusoid of frequency freq Hz and amplitude ampl in output 21 of length numOutput. If ramp > 0.0, taper the ends of the signal 22 with a half-raised-cosine function. It is up to the caller to 23 delete[] output. If this call fails due to unreasonable arguments, 24 numOutput will be zero, and output will be NULL. Note that the 25 duration of the up/down ramps will be within the specified 26 duration. Note that if amplitude is specified outside of the 27 numerical range of int16, the signal will be clipped at +- 32767. */ 28 void generateSinusoid(float freq, float duration, float sampleRate, 29 float amplitude, float ramp, 30 int* numOutput, short** output); 31 32 #endif // GENERATE_SINUSOID_H 33 34