Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep audio devices open all the time, and from start of program #96

Closed
pe1chl opened this issue Sep 1, 2014 · 12 comments
Closed

Keep audio devices open all the time, and from start of program #96

pe1chl opened this issue Sep 1, 2014 · 12 comments

Comments

@pe1chl
Copy link
Contributor

pe1chl commented Sep 1, 2014

We are now working on the streaming audio via svxlink, Alsa loopback device and darkice.
It appears to be working now, will do some more testing and tweaking and hopefully some doc.

What caused some problems is the fact that svxlink closes the audio device every time it turns
off the transmitter. It causes issues with the startup sequence of svxlink, darkice and the
parameters of the Loopback interface.

I have been able to overcome them but it requires a mod to darkice. It would work without problem
when svxlink would have the option to keep the output device (in this case a second local transmitter
with output to alsa:hw:Loopback,0,0) open from the startup of the program until closedown.
(instead of only from beginning to end of transmission)

Apparently it was done to work with cards that can only do half-duplex. If possible, detect this
situation during startup (e.g. open the soundcard for receive and transmit and only close the card
for every tx swich when this fails). When it is not possible, please add a config flag that forces
svxlink to keep the card open. Consider that a soundcard may be used only for transmit, and that
it should be possible to keep it open in that case as well.

@sm0svx
Copy link
Owner

sm0svx commented Sep 1, 2014

Actually there already is a function Async::AudioDevice::isFullDuplexCapable() that report if a sound card is full duplex capable or not. The only thing left is to implement the logic in LocalTx. It's probably pretty simple to do.

@Dloranger
Copy link
Contributor

Dloranger commented Nov 27, 2018

I think this might fix one of the issues I have been fighting with high channel count sound cards, is there any plans to fix it?

also, I don't mind experimenting a bit.

Is this roughly the correct place to edit in the new code, line 887 of LocalTx.cpp?
image

@pe1chl
Copy link
Contributor Author

pe1chl commented Nov 27, 2018

Unfortunately there appears to be little development.
When you want to try a solution external to svxlink, look at the possibilities of alsa configuration
(via the file /etc/asound.conf) where you can setup complicated structures of plugins to route the
audio from virtual soundcards to the physical card.
E.g. with "dmix" you can create a mixer that combines the outputs of several sessions into a
single card, translating channel numbers along the way. Maybe you can solve your problem
with that. We use dsnoop and dmix to run different instances of svxlink and remotetrx alongside
using shared soundcards.

@Dloranger
Copy link
Contributor

I am using the alsa stuff already, but alas, it is not being predictable in terms of getting stuff to play nicely. I will keep plugging (pun intended) along and see if I can make some headway, was just hoping someone might know roughly what is going on as I have been fighting with this for about a year on and off with multiple sound card types.

@sm0svx
Copy link
Owner

sm0svx commented Jul 25, 2019

Latest master may solve this issue. Keep audio devices open by setting AUDIO_DEV_KEEP_OPEN=1 in a local RX or TX section. However, audio devices does not open immediately when the application starts but rather on first use.

Reopen issue if unresolved.

@sm0svx sm0svx closed this as completed Jul 25, 2019
@dl1hrc
Copy link
Contributor

dl1hrc commented Jul 25, 2019

please could you explain why we do not open the audio device and remain it open until SvxLink will be closed? What is the advantage of doing it this way?

@pe1chl
Copy link
Contributor Author

pe1chl commented Jul 25, 2019

now the issue has been re-opened anyway: also note that not opening the device immediately but only on first use does not solve our issue. it may solve other user's problems (those that have unreliable drivers that fail when opened and closed repeatedly) but it still does not work nicely with loopback devices, which need to get their configuration at the start.

@sm0svx
Copy link
Owner

sm0svx commented Jul 25, 2019

This was the easiest solution right now to solve the issue with the Fe-Pi audio device. The audio device will be kept open until SvxLink exits but it will not open until first use.

@sm0svx sm0svx reopened this Jul 25, 2019
@sm0svx
Copy link
Owner

sm0svx commented Jul 25, 2019

It will probably not take much to resolve this issue as well. I'll have a quick look.

@sm0svx
Copy link
Owner

sm0svx commented Jul 25, 2019

Happy now? ;-)

@pe1chl
Copy link
Contributor Author

pe1chl commented Jul 25, 2019

You have again updated it?
It is nice to see that you have come back to developing svxlink after a long silence, but by now we have fallen back so far from the head version (and cannot switch a single system due to the remotetrx protocol incompatibility) that I can no longer do quick tests of new functionality.
First we have to be convinced that the head version is stable and then we will have to do an en-masse update of systems.
Currently it is much too hot for that, here.

@sm0svx
Copy link
Owner

sm0svx commented Jul 26, 2019

Yes, updated again: 0ea6db9. It now opens the audio device when the tx/rx object is created.

I'll close this issue for now. Just reopen it if it still does not work when you get time/temperature to test it.

@sm0svx sm0svx closed this as completed Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants