blob: 57b1c59853e89e8be013cc671ba49394af4cd657 [file] [log] [blame]
Phil Burk5ed503c2017-02-01 09:38:15 -08001/*
2 * Copyright 2016 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 BINDING_AAUDIO_STREAM_CONFIGURATION_H
18#define BINDING_AAUDIO_STREAM_CONFIGURATION_H
19
20#include <stdint.h>
21
22#include <binder/Parcel.h>
23#include <binder/Parcelable.h>
24#include <aaudio/AAudioDefinitions.h>
25
26using android::status_t;
27using android::Parcel;
28using android::Parcelable;
29
30namespace aaudio {
31
32class AAudioStreamConfiguration : public Parcelable {
33public:
34 AAudioStreamConfiguration();
35 virtual ~AAudioStreamConfiguration();
36
Phil Burk3316d5e2017-02-15 11:23:01 -080037 int32_t getDeviceId() const {
Phil Burk5ed503c2017-02-01 09:38:15 -080038 return mDeviceId;
39 }
40
Phil Burk3316d5e2017-02-15 11:23:01 -080041 void setDeviceId(int32_t deviceId) {
Phil Burk5ed503c2017-02-01 09:38:15 -080042 mDeviceId = deviceId;
43 }
44
Phil Burk3316d5e2017-02-15 11:23:01 -080045 int32_t getSampleRate() const {
Phil Burk5ed503c2017-02-01 09:38:15 -080046 return mSampleRate;
47 }
48
Phil Burk3316d5e2017-02-15 11:23:01 -080049 void setSampleRate(int32_t sampleRate) {
Phil Burk5ed503c2017-02-01 09:38:15 -080050 mSampleRate = sampleRate;
51 }
52
53 int32_t getSamplesPerFrame() const {
54 return mSamplesPerFrame;
55 }
56
57 void setSamplesPerFrame(int32_t samplesPerFrame) {
58 mSamplesPerFrame = samplesPerFrame;
59 }
60
61 aaudio_audio_format_t getAudioFormat() const {
62 return mAudioFormat;
63 }
64
65 void setAudioFormat(aaudio_audio_format_t audioFormat) {
66 mAudioFormat = audioFormat;
67 }
68
Phil Burk3316d5e2017-02-15 11:23:01 -080069 int32_t getBufferCapacity() const {
Phil Burk3df348f2017-02-08 11:41:55 -080070 return mBufferCapacity;
71 }
72
Phil Burk3316d5e2017-02-15 11:23:01 -080073 void setBufferCapacity(int32_t frames) {
Phil Burk3df348f2017-02-08 11:41:55 -080074 mBufferCapacity = frames;
75 }
76
Phil Burk5ed503c2017-02-01 09:38:15 -080077 virtual status_t writeToParcel(Parcel* parcel) const override;
78
79 virtual status_t readFromParcel(const Parcel* parcel) override;
80
81 aaudio_result_t validate();
82
83 void dump();
84
85protected:
Phil Burk3316d5e2017-02-15 11:23:01 -080086 int32_t mDeviceId = AAUDIO_DEVICE_UNSPECIFIED;
87 int32_t mSampleRate = AAUDIO_UNSPECIFIED;
Phil Burk3df348f2017-02-08 11:41:55 -080088 int32_t mSamplesPerFrame = AAUDIO_UNSPECIFIED;
Phil Burk5ed503c2017-02-01 09:38:15 -080089 aaudio_audio_format_t mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED;
Phil Burk3316d5e2017-02-15 11:23:01 -080090 int32_t mBufferCapacity = AAUDIO_UNSPECIFIED;
Phil Burk5ed503c2017-02-01 09:38:15 -080091};
92
93} /* namespace aaudio */
94
95#endif //BINDING_AAUDIO_STREAM_CONFIGURATION_H