GithubHelp home page GithubHelp logo

Comments (11)

jarcode-foss avatar jarcode-foss commented on August 11, 2024 3

I will look into this, perhaps using a "default" option or something that automatically handles changes to the default sink. It might be a bit awkward if the two devices don't sample at the same rate though.

from glava.

op8867555 avatar op8867555 commented on August 11, 2024 1

@aaahh Thanks for the hint!

I ended up with a script to do that:
pactl move-source-output $(pactl list source-outputs short | grep $(pactl list short clients | grep glava | cut -f 1) | cut -f 1) @DEFAULT_MONITOR@

I think it's still nice to have this implemented in GLava, so I'm going to leave this issue open for now.

from glava.

op8867555 avatar op8867555 commented on August 11, 2024 1

I think subscribing pulseaudio events might also be a good way to implement it. This script captures the idea:

LANG=C pactl subscribe | grep "Event 'change' on server" --line-buffered | while read p; do
  GLAVA=$(pactl list short clients | grep glava | cut -f 1);
  FROM=$(pactl list source-outputs short | grep $GLAVA | cut -f 1);
  pactl move-source-output $FROM @DEFAULT_MONITOR@;
done

I guess one possible way to do this in GLava is creating a separate pulseaudio mainloop thread to subscribe/handle server events, instead of rewriting whole pulse.c to use async api (not quite sure which would performance better).

from glava.

op8867555 avatar op8867555 commented on August 11, 2024

Just curious. What will happen if sample rate changed? Don't Pulse Audio have only one primary and one alternative sample rates?

from glava.

jarcode-foss avatar jarcode-foss commented on August 11, 2024

Just curious. What will happen if sample rate changed?

Nothing will break, but its ideal to sample at multiples of the sampling rate of the audio source, otherwise input has to be interpolated or segmented, which can produce unfavourable output in GLava.

from glava.

mmhobi7 avatar mmhobi7 commented on August 11, 2024

pavucontrol lets you change it under the "recording" tab, if there isn't an option to change the input but you see glava, check out your configuration profile

from glava.

jarcode-foss avatar jarcode-foss commented on August 11, 2024

Looking at this again, I'm not particularily sure how to implement this. I can do a few things here:

  • Frequently call pa_context_get_server_info, destroying & re-creating the audio monitor as the default sink changes (somewhat messy)

  • Change the audio handling code such that multiple audio sinks can be used for a single GLava instance (much cleaner, doesn't require spamming the PA server for info). This method, however, would not allow you to use audio sinks that have yet to be instantiated under PA (ie. plugging in a new device).

Ideally, there would be some code to notify GLava of any changes to the default device, but I'm not sure if it's possible through PA or even something I should be doing within GLava. Perhaps a udev rule in combination with @op8867555's script is an acceptable solution for now -- in which case I would gladly add a complete solution to the README.md file.

from glava.

raagn08 avatar raagn08 commented on August 11, 2024

Following up on this, not sure if I missed something on docs.
I use a separate speaker (Google Nest audio) for output and Glava doesn't work with that.
Some context: I have a Lenovo Legion 7i but it doesn't have audio support on linux, hence ended up with an external speaker. If I change Spotify's output from Nest to this device (7i) it starts working fine.

Is there some way I can have Glava working for this specific device output?

Edit: It works when I connect it with Bluetooth, not when I'm casting from Spotify to Nest Audio. Guess I'm sticking with bluetooth unless someone has a solution for that

from glava.

cmcinroy avatar cmcinroy commented on August 11, 2024

I have found that I suffer from this issue when my bluetooth headphones (a) power off then on or (b) switch to another connected device then back, as happens often throughout a workday.

I have been killing the GLava process then starting it again each time. The discussion here gives me enough to at least workaround the issue. Thanks.

from glava.

AMoonRabbit avatar AMoonRabbit commented on August 11, 2024

Following up on this, not sure if I missed something on docs.
I use a separate speaker (Google Nest audio) for output and Glava doesn't work with that.
Some context: I have a Lenovo Legion 7i but it doesn't have audio support on linux, hence ended up with an external speaker. If I change Spotify's output from Nest to this device (7i) it starts working fine.

Is there some way I can have Glava working for this specific device output?

Edit: It works when I connect it with Bluetooth, not when I'm casting from Spotify to Nest Audio. Guess I'm sticking with bluetooth unless someone has a solution for that

Yeah, if you are casting, then you device isn't actually outputting the audio. Your Nest Audio will be streaming the music directly from Spotify, so I doubt there will ever be a solution for that.

from glava.

pumpkinlink avatar pumpkinlink commented on August 11, 2024

the script from #21 (comment) works perfectly for me! gonna add it to my session startup scripts! maybe this should be added to the docs

from glava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.