# Copyright (c) 2024 Rockchip Electronics Co. Ltd.
# Author: Xing Zheng <zhengxing@rock-chips.com>

defaults.pcm.rate_converter "speexrate_medium"

pcm.!default
{
    type asym
    playback.pcm "rockaa_play_0"
    capture.pcm "rockaa_capt_0"
}

# To user
pcm.rockaa_play_0 {
    type plug
    slave {
        pcm "rockaa_play_effect_0"
        channels 2
        format S16_LE
        rate 48000
    }
}

pcm.rockaa_play_1 {
    type plug
    slave {
        pcm "rockaa_play_effect_1"
        channels 2
        format S16_LE
        rate 48000
    }
}

pcm.rockaa_capt_0 {
    type softvol
    slave.pcm "rockaa_capt_effect_0"
    control {
        name "Master RockAA Capture 0"
        card 0
        device 0
    }
    min_dB -50.0
    max_dB 0.0
    resolution 101
}

pcm.rockaa_capt_1 {
    type softvol
    slave.pcm "rockaa_capt_effect_1"
    control {
        name "Master RockAA Capture 1"
        card 0
        device 0
    }
    min_dB -50.0
    max_dB 0.0
    resolution 101
}

# To Rockaa and other plugins
pcm.rockaa_play_effect_0 {
    type rockaa
    slave.pcm "softvol_rockaa_play"
    conf_play_name /userdata/cfg/rockaa_conf/rkaudio_effect_eqdrc_48000hz_2ch_n48db.bin
    debug_mode 0
    # play_in /tmp/dbg_dump_playin.pcm
    # play_out /tmp/dbg_dump_playout.pcm
}

pcm.rockaa_play_effect_1 {
    type rockaa
    slave.pcm "softvol_rockaa_play"
    conf_play_name /userdata/cfg/rockaa_conf/rkaudio_effect_eqdrc_48000hz_2ch.bin
    debug_mode 0
    # play_in /tmp/dbg_dump_playin.pcm
    # play_out /tmp/dbg_dump_playout.pcm
}

pcm.rockaa_capt_effect_0 {
    type rockaa
    slave.pcm "dsnooper"
    conf_capt_name /userdata/cfg/rockaa_conf/config_aivqe.json
    capt_ch_far 1
    debug_mode 0
    # capt_in /tmp/dbg_dump_capin.pcm
    # capt_out /tmp/dbg_dump_capout.pcm
}

pcm.rockaa_capt_effect_1 {
    type rockaa
    slave.pcm "dsnooper"
    conf_capt_name /userdata/cfg/rockaa_conf/config_aivqe_effect_1.json
    capt_ch_far 1
    debug_mode 0
    # capt_in /tmp/dbg_dump_capin.pcm
    # capt_out /tmp/dbg_dump_capout.pcm
}

pcm.softvol_rockaa_play {
    type softvol
    slave.pcm "dmixer"
    control {
        name "Master RockAA Playback"
        card 0
        device 0
    }
    min_dB -50.0
    max_dB 0.0
    resolution 101
}

# To Hardware
pcm.dmixer {
    type dmix
    ipc_key 5978293 # must be unique for all dmix plugins!!!!
    ipc_key_add_uid yes
    slave {
        pcm "hw:0,0,0"
        channels 2
        period_size 768
        buffer_size 3072
    }
    bindings {
        0 0
        1 1
    }
}

pcm.dsnooper {
    type dsnoop
    ipc_key 5978291 # must be unique for all dmix plugins!!!!
    ipc_key_add_uid yes
    slave {
        pcm "hw:0,0,0"
        channels 2
        period_size 768
        buffer_size 3072
    }
    bindings {
        0 0
        1 1
    }
}

