blob: e4772a17edecefbdf8822ee31ba1ebb0d21dc8c4 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 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#ifndef ANDROID_IAUDIOTRACK_H
18#define ANDROID_IAUDIOTRACK_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/RefBase.h>
24#include <utils/Errors.h>
Mathias Agopian07952722009-05-19 19:08:10 -070025#include <binder/IInterface.h>
26#include <binder/IMemory.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027
28
29namespace android {
30
31// ----------------------------------------------------------------------------
32
33class IAudioTrack : public IInterface
34{
35public:
36 DECLARE_META_INTERFACE(AudioTrack);
37
Glenn Kasten798ef8e2012-01-03 14:50:23 -080038 /* Get this track's control block */
39 virtual sp<IMemory> getCblk() const = 0;
40
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041 /* After it's created the track is not active. Call start() to
42 * make it active. If set, the callback will start being called.
Glenn Kasten6a20b262012-02-02 10:56:47 -080043 * tid identifies the client callback thread, or 0 if not needed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 */
Glenn Kasten6a20b262012-02-02 10:56:47 -080045 virtual status_t start(pid_t tid) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
47 /* Stop a track. If set, the callback will cease being called and
48 * obtainBuffer will return an error. Buffers that are already released
Glenn Kastenb3db2132012-01-19 08:59:58 -080049 * will continue to be processed, unless/until flush() is called.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 */
51 virtual void stop() = 0;
52
Glenn Kastenb3db2132012-01-19 08:59:58 -080053 /* Flush a stopped or paused track. All pending/released buffers are discarded.
54 * This function has no effect if the track is not stopped or paused.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 */
56 virtual void flush() = 0;
57
Glenn Kastene5fb2632011-12-14 10:28:06 -080058 /* Mute or unmute this track.
59 * While muted, the callback, if set, is still called.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 */
61 virtual void mute(bool) = 0;
62
63 /* Pause a track. If set, the callback will cease being called and
64 * obtainBuffer will return an error. Buffers that are already released
Glenn Kastenb3db2132012-01-19 08:59:58 -080065 * will continue to be processed, unless/until flush() is called.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 */
67 virtual void pause() = 0;
68
Eric Laurent65b65452010-06-01 23:49:17 -070069 /* Attach track auxiliary output to specified effect. Use effectId = 0
70 * to detach track from effect.
71 */
72 virtual status_t attachAuxEffect(int effectId) = 0;
73
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074};
75
76// ----------------------------------------------------------------------------
77
78class BnAudioTrack : public BnInterface<IAudioTrack>
79{
80public:
81 virtual status_t onTransact( uint32_t code,
82 const Parcel& data,
83 Parcel* reply,
84 uint32_t flags = 0);
85};
86
87// ----------------------------------------------------------------------------
88
89}; // namespace android
90
91#endif // ANDROID_IAUDIOTRACK_H