/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.audio.effect@5.0;

import android.hardware.audio.common@5.0;
import IEffect;

interface IBassBoostEffect extends IEffect {
    /**
     * Returns whether setting bass boost strength is supported.
     */
    isStrengthSupported() generates (Result retval, bool strengthSupported);

    enum StrengthRange : uint16_t {
        MIN = 0,
        MAX = 1000
    };

    /**
     * Sets bass boost strength.
     *
     * @param strength strength of the effect. The valid range for strength
     *                 strength is [0, 1000], where 0 per mille designates the
     *                 mildest effect and 1000 per mille designates the
     *                 strongest.
     * @return retval operation completion status.
     */
    setStrength(uint16_t strength) generates (Result retval);

    /**
     * Gets virtualization strength.
     */
    getStrength() generates (Result retval, uint16_t strength);
};
