/*
 * Copyright (C) 2020 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@7.0;

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

interface INoiseSuppressionEffect extends IEffect {
    enum Level : int32_t {
        LOW,
        MEDIUM,
        HIGH
    };

    /**
     * Sets suppression level.
     */
    setSuppressionLevel(Level level) generates (Result retval);

    /**
     * Gets suppression level.
     */
    getSuppressionLevel() generates (Result retval, Level level);

    enum Type : int32_t {
        SINGLE_CHANNEL,
        MULTI_CHANNEL
    };

    /**
     * Set suppression type.
     */
    setSuppressionType(Type type) generates (Result retval);

    /**
     * Get suppression type.
     */
    getSuppressionType() generates (Result retval, Type type);

    struct AllProperties {
        Level level;
        Type type;
    };

    /**
     * Sets all properties at once.
     */
    setAllProperties(AllProperties properties) generates (Result retval);

    /**
     * Gets all properties at once.
     */
    getAllProperties() generates (Result retval, AllProperties properties);
};
