1 /* 2 * Copyright 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of 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, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * Implements an API to be used by A2DP to do streaming of music over a media 19 * stream. This API provides mechanism to create and control playback of the 20 * media stream depending on the data bits coming from the remote device. The 21 * media stream is played over the default audio media stream type and hence 22 * volume control is handled entirely by the Audio Manager (which is also the 23 * original motivation for this solution. 24 * 25 * TODO: Once the AudioManager provides support for patching audio sources with 26 * volume control we should deprecate this file. 27 */ 28 29 /** 30 * Creates an audio track object and returns a void handle. Use this handle to 31 * the 32 * following functions. 33 * 34 * The ownership of the handle is maintained by the caller of this API and it 35 * should eventually be 36 * deleted using BtifAvrcpAudioTrackDelete (see below). 37 */ 38 void* BtifAvrcpAudioTrackCreate(int trackFreq, int bitsPerSample, 39 int channelCount); 40 41 /** 42 * Starts the audio track. 43 */ 44 void BtifAvrcpAudioTrackStart(void* handle); 45 46 /** 47 * Pauses the audio track. 48 */ 49 void BtifAvrcpAudioTrackPause(void* handle); 50 51 /** 52 * Sets audio track gain. 53 */ 54 void BtifAvrcpSetAudioTrackGain(void* handle, float gain); 55 56 /** 57 * Stop / Delete the audio track. 58 * Delete should usually be called stop. 59 */ 60 void BtifAvrcpAudioTrackStop(void* handle); 61 void BtifAvrcpAudioTrackDelete(void* handle); 62 63 /** 64 * Writes the audio track data to file. 65 * 66 * Used only for debugging. 67 */ 68 int BtifAvrcpAudioTrackWriteData(void* handle, void* audioBuffer, 69 int bufferLength); 70