Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.49 KB | None | 0 0
  1. # ----------------------------------------- #
  2. # !!! CHANGE "hw:PCH,0" TO YOUR DEVICE  !!! #
  3. # ----------------------------------------- #
  4. #    in `pcm.playback` and `pcm.capture`    #
  5. # ----------------------------------------- #
  6.  
  7.  
  8. # set default resampler
  9. defaults.pcm.rate_converter "speexrate"
  10.  
  11.  
  12. # Playback
  13. # --------
  14.  
  15.     pcm.playback {
  16.         type dmix
  17.         ipc_key 1111
  18.         slave {
  19.             pcm "hw:PCH,0"
  20.             period_size 1024
  21.             buffer_size 4096    
  22.             # firefox can't play AAC with buffer size lower than 2048
  23.             #   ("failed to init cubeb")
  24.             # defaults for dmix/dsnoop plugins:
  25.             #   format S16_LE; rate 48000; channels 2
  26.         }
  27.     }
  28.  
  29.     pcm.loop_in {
  30.         type dmix
  31.         ipc_key 2222
  32.         slave {
  33.             pcm "hw:Loopback,0,7"
  34.             period_size 1024
  35.             buffer_size 4096
  36.         }
  37.     }
  38.  
  39.     pcm.duplicate {
  40.         # this 4-channel pcm splits one stream into two
  41.         # (e.g. output to speakers and to the loop device)
  42.        
  43.         # / if an app opens 4-channel device to write to,
  44.         #   then channels 1 and 2 map to `slave a`
  45.         #   and channels 3 and 4 map to `slave b`,
  46.         #   which is not what this device is intended for;
  47.         #   use `duplicate_stereo` in this case /
  48.        
  49.         type plug
  50.         slave.pcm {
  51.             type multi
  52.             slaves {
  53.                 a { channels 2 pcm "playback" }
  54.                 b { channels 2 pcm "loop_in" }
  55.             }
  56.             bindings [
  57.                 { slave a channel 0 }
  58.                 { slave a channel 1 }
  59.                 { slave b channel 0 }
  60.                 { slave b channel 1 }
  61.             ]
  62.         }
  63.         #~ route_policy "duplicate"
  64.         # -- or --
  65.         ttable [
  66.             [ 1 0 1 0 ]   # left  -> a.left,  b.left
  67.             [ 0 1 0 1 ]   # right -> a.right, b.right
  68.         ]
  69.     }
  70.  
  71.     pcm.duplicate_stereo {
  72.         # this device may fail at some configurations
  73.         # use 4-channel "duplicate" if it fails
  74.         type plug
  75.         slave.pcm "duplicate"
  76.         slave.channels 2
  77.     }
  78.  
  79.  
  80. # Capture
  81. # -------
  82.  
  83.     pcm.capture {
  84.         type plug
  85.         slave.pcm {
  86.             type dsnoop
  87.             ipc_key 3333
  88.             slave {
  89.                 pcm "hw:PCH,0"
  90.                 period_size 1024
  91.                 buffer_size 4096    
  92.                 # lingot fails with buffer size lower than 2048
  93.                 #   ("cannot set parameters")
  94.             }
  95.         }
  96.     }
  97.    
  98.     pcm.loop_out {
  99.         # system sounds capture device
  100.         type plug
  101.         slave.pcm {
  102.             type dsnoop
  103.             ipc_key 4444
  104.             slave {
  105.                 pcm "hw:Loopback,1,7"
  106.                 period_size 1024
  107.                 buffer_size 4096
  108.             }
  109.         }
  110.         #~ slave.channels 2
  111.         hint {
  112.             show on
  113.             description "System sounds"
  114.         }
  115.     }
  116.    
  117.  
  118. # The Default
  119. # --------------------
  120.  
  121.     # Playback:
  122.     #   [source] -> multi ---> /duplicate/ -> dmix -> hardware -> [output]
  123.     #                      \-> /duplicate/ -> dmix -> *pcm.loop_in* -> (loopback)
  124.     # Capture:
  125.     #   [input] -> hardware -> dsnoop -> *pcm.capture* -> [sink]
  126.     #   (loopback) -> dsnoop -> *pcm.loop_out* -> [sink]
  127.  
  128.     pcm.!default {
  129.         type asym
  130.         playback.pcm "duplicate_stereo"     # variants: "duplicate_stereo", "duplicate"
  131.         capture.pcm "capture"
  132.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement