> On 2/24/2021 1:43 PM, paul- wrote:
> > pgf wrote:
> > [... wants to let two audio sources use pCP's output at a time...]
> >>
> > Squeezelite on pCP directly accesses alsa.  Only one process can
> access
> > the alsa device at time, so you will need to do a full pulseaudio
> system
> > to do what you want.   You might try to build your system up with
> > RaspiOS, or use piCore directly.
> >
> >
> 
> If the hardware supports it, two processes can share the same alsa 
> output by using the "dmix" device. With squeezelite I was able to get 
> two processes to share the Analog Output using the same dmix device. I 
> guess I was thinking that I could switch between streams by pausing one
> 
> and starting the other in LMS but I never pursued it.
> 
> I don't know if pCP would support that.
> 
> John

Thanks -- I had given up on using dmix years ago when pulseaudio solved
my problems so well, but in fact, just yesterday afternoon I implemented
this, and it (almost) works just fine.

I've created a .asoundrc file that looks like this, in both /root and
/home/tc (and I've added /root to /opt/.filetool.lst, so /root gets
backed up):

Code:
--------------------
    # taken from:
  #  
https://stackoverflow.com/questions/7002423/how-to-mix-multiple-pcm-streams-using-alsa
  pcm.hw1mix  {
  type dmix
  ipc_key 1939 # must be unique
  ipc_perm 0666 # mixing for all users
  slave {
  # pcm "hw:1"
        pcm "hw:CARD=sndrpihifiberry,DEV=0"
  period_time 0
  period_size 1024 # must be power of 2
  buffer_size 4096
  rate 44100
  }
  bindings {
  0 0
  1 1
  }
  }
  
  pcm.!default hw1mix
--------------------



After doing that, "hw1mix" now appears in the pCP device selection menu.
If I select that, squeezelite will use it happily, and my HifiBerry
AMP2 works with two "inputs".  

It's necessary to put the .asoundrc into a) /root so that it affects
squeezelite's view of alsa, and b) into /home/tc to affect tc's view.  
tc needs it because I'm running a poor-man's network audio server.  On
the remote host that has something to say, I run (essentially):


Code:
--------------------
    $ ssh tc@picore aplay  < myannouncement.wav
  
--------------------


There's probably a way to avoid the duplication of .asoundrc -- I'll
look into it.

The other issue I have is that when pCP first boots, squeezelite doesn't
come up -- it fails because hw1mix isn't available.  If I simply restart
squeezelite, it works fine.  I'll either figure out a fix, or a
workaround.


------------------------------------------------------------------------
pgf's Profile: http://forums.slimdevices.com/member.php?userid=58510
View this thread: http://forums.slimdevices.com/showthread.php?t=113512

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to