1 /* 2 * Copyright (C) 2020 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 #pragma once 18 #include <memory> 19 #include <tinyalsa/asoundlib.h> 20 21 namespace android { 22 namespace hardware { 23 namespace audio { 24 namespace V6_0 { 25 namespace implementation { 26 namespace talsa { 27 28 constexpr unsigned int kPcmDevice = 0; 29 constexpr unsigned int kPcmCard = 0; 30 31 typedef struct pcm pcm_t; 32 struct PcmDeleter { void operator()(pcm_t *x) const; }; 33 typedef std::unique_ptr<pcm_t, PcmDeleter> PcmPtr; 34 PcmPtr pcmOpen(unsigned int dev, unsigned int card, unsigned int nChannels, size_t sampleRateHz, size_t frameCount, bool isOut); 35 36 typedef struct mixer mixer_t; 37 typedef struct mixer_ctl mixer_ctl_t; 38 struct MixerDeleter { void operator()(struct mixer *m) const; }; 39 typedef std::unique_ptr<mixer_t, MixerDeleter> MixerPtr; 40 MixerPtr mixerOpen(unsigned int card); 41 void mixerSetValueAll(mixer_ctl_t *ctl, int value); 42 void mixerSetPercentAll(mixer_ctl_t *ctl, int percent); 43 44 } // namespace talsa 45 } // namespace implementation 46 } // namespace V6_0 47 } // namespace audio 48 } // namespace hardware 49 } // namespace android 50