blob: 2eb6613c28442eda1928b82e0ec01156876006a5 [file] [log] [blame]
Shunkai Yao2dcd60c2024-08-27 21:08:53 +00001/*
2 * Copyright (C) 2024 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
19#include <com_android_media_audio.h>
20#include <cutils/properties.h>
21
22namespace android {
23
24class SpatializerHelper {
25 public:
26 /**
27 * @brief Check if the stereo spatialization feature turned on by:
28 * - sysprop "ro.audio.stereo_spatialization_enabled" is true
29 * - com_android_media_audio_stereo_spatialization flag is on
30 *
31 * @return true if the stereo spatialization feature is enabled
32 * @return false if the stereo spatialization feature is not enabled
33 */
34 static bool isStereoSpatializationFeatureEnabled() {
35 static const bool stereoSpatializationEnabled =
36 property_get_bool("ro.audio.stereo_spatialization_enabled", false) &&
37 com_android_media_audio_stereo_spatialization();
38 return stereoSpatializationEnabled;
39 }
40};
41
42} // namespace android