AAudioStreamConfiguration.h revision 5ed503c7a66c90f93759c90237a9b432dbd93f9f
1828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk/* 2828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * Copyright 2016 The Android Open Source Project 3828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * 4828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * Licensed under the Apache License, Version 2.0 (the "License"); 5828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * you may not use this file except in compliance with the License. 6828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * You may obtain a copy of the License at 7828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * 8828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * http://www.apache.org/licenses/LICENSE-2.0 9828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * 10828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * Unless required by applicable law or agreed to in writing, software 11828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * distributed under the License is distributed on an "AS IS" BASIS, 12828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * See the License for the specific language governing permissions and 14828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk * limitations under the License. 15828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk */ 16828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 175ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk#ifndef BINDING_AAUDIO_STREAM_CONFIGURATION_H 185ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk#define BINDING_AAUDIO_STREAM_CONFIGURATION_H 19828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 20828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk#include <stdint.h> 21828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 22828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk#include <binder/Parcel.h> 23828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk#include <binder/Parcelable.h> 245ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk#include <aaudio/AAudioDefinitions.h> 25828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 26828bea5f61f3c40d24759cd8739dd95570883b56Phil Burkusing android::status_t; 27828bea5f61f3c40d24759cd8739dd95570883b56Phil Burkusing android::Parcel; 28828bea5f61f3c40d24759cd8739dd95570883b56Phil Burkusing android::Parcelable; 29828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 305ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burknamespace aaudio { 31828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 325ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burkclass AAudioStreamConfiguration : public Parcelable { 33828bea5f61f3c40d24759cd8739dd95570883b56Phil Burkpublic: 345ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk AAudioStreamConfiguration(); 355ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk virtual ~AAudioStreamConfiguration(); 36828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 375ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_device_id_t getDeviceId() const { 38828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk return mDeviceId; 39828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 40828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 415ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk void setDeviceId(aaudio_device_id_t deviceId) { 42828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk mDeviceId = deviceId; 43828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 44828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 455ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_sample_rate_t getSampleRate() const { 46828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk return mSampleRate; 47828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 48828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 495ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk void setSampleRate(aaudio_sample_rate_t sampleRate) { 50828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk mSampleRate = sampleRate; 51828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 52828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 53828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk int32_t getSamplesPerFrame() const { 54828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk return mSamplesPerFrame; 55828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 56828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 57828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk void setSamplesPerFrame(int32_t samplesPerFrame) { 58828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk mSamplesPerFrame = samplesPerFrame; 59828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 60828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 615ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_audio_format_t getAudioFormat() const { 62828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk return mAudioFormat; 63828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 64828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 655ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk void setAudioFormat(aaudio_audio_format_t audioFormat) { 66828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk mAudioFormat = audioFormat; 67828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk } 68828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 69828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk virtual status_t writeToParcel(Parcel* parcel) const override; 70828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 71828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk virtual status_t readFromParcel(const Parcel* parcel) override; 72828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 735ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_result_t validate(); 74828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 75828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk void dump(); 76828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 77828bea5f61f3c40d24759cd8739dd95570883b56Phil Burkprotected: 785ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_device_id_t mDeviceId = AAUDIO_DEVICE_UNSPECIFIED; 795ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_sample_rate_t mSampleRate = AAUDIO_UNSPECIFIED; 805ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk int32_t mSamplesPerFrame = AAUDIO_UNSPECIFIED; 815ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk aaudio_audio_format_t mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED; 82828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk}; 83828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 845ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk} /* namespace aaudio */ 85828bea5f61f3c40d24759cd8739dd95570883b56Phil Burk 865ed503c7a66c90f93759c90237a9b432dbd93f9fPhil Burk#endif //BINDING_AAUDIO_STREAM_CONFIGURATION_H 87