summaryrefslogtreecommitdiffstats
path: root/conf.d/project/alsa.d/asoundrc.sample
blob: 4ea04dc3a65ce19e0cee5560e1ba50c067d457b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multilin
# 
# Author: Fulup Ar Foll
# Object: PCM hook type 
#
# Test  :  Note: Jabra_USB=hw:v1340
#  Check SoundCard  speaker-test -Dhw:v1340 -c2 -twav
#  Check MixerPCM   speaker-test -DMyMixerPCM -c2 -twav 
#  Check HookPCM    speaker-test -DMyNavigationHook -c2 -twav 
#  Check NavPCM     speaker-test -DMyNavPCM -c2 -twav
#  MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav
#
# Bug/Feature: when softvol control is initialised from plugin and not
#    from AGL binding. At 1st run ctl has invalid TLV and cannot be
#    use. Bypass Solution: 
#     * start audio-binder before playing sound (binding create control before softvol plugin)
#     * run a dummy aplay -DMyNavPCM "" to get a clean control
#
# References: https://www.spinics.net/lists/alsa-devel/msg54235.html
# --------------------------------------------------------------------

# Mixer PCM allow to play multiple stream simultaneously
# ------------------------------------------------------
pcm.MyMixerPCM { 
    type dmix 
    ipc_key 1024
    ipc_key_add_uid false
    ipc_perm 0666   # mixing for all users

    # Define target effective sound card (cannot be a plugin)
    slave { 
        pcm "hw:v1340"  #Jabra Solmate 
        period_time 0 
        period_size 1024 
        buffer_size 8192
        rate 44100
    }

    # DMIX can only map two channels
    bindings { 
        0 0 
        1 1 
    } 
} 

# Define a Hook_type with a private sharelib
# -------------------------------------------
pcm_hook_type.MyHookPlugin {
    install "AlsaInstallHook" 
    lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so"
}


# Define a HookedPCM that point to Hook_type sharelib
# ----------------------------------------------------
pcm.MyNavigationHook {
    type hooks
    slave.pcm "MyMixerPCM"
    # Defined used hook sharelib and provide arguments/config to install func
    hooks.0 {
        type "MyHookPlugin"
        hook_args {
            verbose true # print few log messages (default false);

            # Every Call should return OK in order PCM to open (default timeout 100ms)
            uri   "ws://localhost:1234/api?token=audio-agent-token&uuid=audio-agent-session"
            request {
                # Request autorisation to write on navigation 
                RequestNavigation {
                    api    "control"
                    verb   "dispatch"
	            query  "{'target':'navigation', 'args':{'device':'Jabra SOLEMATE v1.34.0'}}"
                } 
            }
            # map event reception to self generated signal
            event {
                pause  30
                resume 31
                stop   3
            }
        }
    }
}

# If hardware does not support mixer emulate it with softvol
# -----------------------------------------------------------
pcm.MyMultimediaPCM {
    type        softvol

    # Point Slave on HOOK for policies control
    slave.pcm   "MyNavigationHook"

    # resolution=HAL(valMax+1) (default=256)
    resolution 256

    # name should match with HAL but do not set card=xx
    control.name    "Playback Navigation"

    # Make this plugin visible from aplay -L
    hint {
      show on
      description "Navigation SolftVol PCM"
    }    
}

# If hardware does not support mixer emulate it with softvol
# -----------------------------------------------------------
pcm.MyNavPCM {
    type        softvol

    # Point Slave on HOOK for policies control
    slave.pcm   "MyNavigationHook"

    # resolution=HAL(valMax+1) (default=256)
    resolution 256

    # name should match with HAL but do not set card=xx
    control.name    "Playback Navigation"

    # Make this plugin visible from aplay -L
    hint {
      show on
      description "Navigation SolftVol PCM"
    }    
}

# If hardware does not support mixer emulate it with softvol
# -----------------------------------------------------------
pcm.MyAlarmPCM {
    type        softvol

    # Point Slave on HOOK for policies control
    slave.pcm   "MyNavigationHook"

    # resolution=HAL(valMax+1) (default=256)
    resolution 256

    # name should match with HAL but do not set card=xx
    control.name    "Playback Navigation"

    # Make this plugin visible from aplay -L
    hint {
      show on
      description "Navigation SolftVol PCM"
    }    
}