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

[FR]: Volume slider for notifications #488

Closed
guihkx opened this issue Sep 6, 2021 · 13 comments
Closed

[FR]: Volume slider for notifications #488

guihkx opened this issue Sep 6, 2021 · 13 comments
Assignees
Labels
Status-Fixed Ticket is resolved. Type-Desktop-Integration Application badly integrates into used desktop environment. Type-Enhancement This is request for brand new feature.
Milestone

Comments

@guihkx
Copy link
Contributor

guihkx commented Sep 6, 2021

Brief description of the feature request

Hi, I know this might sound like a stupid idea, but I was wondering if it'd be possible to add a volume slider in the Notifications window, because right now if you have your system volume set to 100%, RSS Guard will play a notification bell really loud.

I'm on Linux, so I tried using PulseAudio Volume Control to lower the volume of the notifications just for RSS Guard, but apparently Qt creates a randomly named PulseAudio sink every time you launch RSS Guard, so in the end my volume settings aren't saved once I re-launch RSS Guard.

Thank you in advance.

@guihkx guihkx added the Type-Enhancement This is request for brand new feature. label Sep 6, 2021
@martinrotter
Copy link
Owner

Hello old friend.

I see. Adjusting volume should be possible with QMediaPlayer class but there are two questions:

  1. How should related UI to set volume look? Just a setting in "Notification" tab of settings window?
  2. Isn't it better to use system audio facilities to set volume per program? Especially on Linux, this should be doable with Pulseaudio as well as ALSA.

@guihkx
Copy link
Contributor Author

guihkx commented Sep 6, 2021

Hey! Thanks for the quick response :)

Regarding question 1, I think yeah, that's a nice approach, but then again, I'm not a UI/UX person 😄

About question 2, I mostly agree with you. For instance, the global volume slider on my computer, sits at 100%, because sometimes there are video/music with reaally low volume out there on the internet, so I just leave it at 100%.

And if they're too loud, then I manually lower the global volume slider until the video ends (but in practice, these videos have their own volume slider).

The main issue for me right now is that, like I mentioned before, any volume modification I make for RSS Guard using PavuControl will be ignored next time I launch RSS Guard. See for yourself:

image

The second application on that screenshot is RSS Guard playing the notification bell. The naming scheme for the PulseAudio sink seems random, so I guess this issue would be solved altogether if there was a way to make this name "permanent".

@guihkx
Copy link
Contributor Author

guihkx commented Sep 7, 2021

That's not it... Pavucontrol (the app I'm using), is just a GUI alternative for pactl.

I'm pretty bad at explaining things, so please bear with me. :D

I'll try to use the answer you linked to explain why it doesn't work (currently).

Running pactl list sink-inputs will not list RSS Guard there. See:

$ pactl list sink-inputs

That's right, an empty output. And yes, RSS Guard is already running in the background.

RSS Guard will only show up in pactl list sink-inputs after the actual notification plays:

$ pactl list sink-inputs
Sink Input #80
	Driver: PipeWire
	Owner Module: n/a
	Client: 66
	Sink: 41
	Sample Specification: s16le 1ch 8000Hz
	Channel Map: mono
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "8000"  format.channels = "1"  format.channel_map = "\"mono\""
	Corked: no
	Mute: no
	Volume: mono: 32535 /  50% / -18,25 dB
	        balance 0,00
	Buffer Latency: 0 usec
	Sink Latency: 0 usec
	Resample method: PipeWire
	Properties:
		client.api = "pipewire-pulse"
		pulse.server.type = "unix"
		application.name = "QtPulseAudio:3834"
		application.process.id = "3834"
		application.process.user = "gui"
		application.process.host = "arch"
		application.process.binary = "rssguard"
		application.language = "en_US.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "666ea98c44e04f4290ca90b2c054fc45"
		media.name = "QtPulseSample-3834-140583211813776"
		node.rate = "1/8000"
		stream.is-live = "true"
		node.name = "QtPulseAudio:3834"
		node.autoconnect = "true"
		media.class = "Stream/Output/Audio"
		adapt.follower.node = ""
		object.register = "false"
		factory.id = "6"
		audio.adapt.follower = ""
		factory.mode = "split"
		library.name = "audioconvert/libspa-audioconvert"
		client.id = "66"
		object.id = "80"
		node.latency = "1680/8000"
		pulse.attr.maxlength = "4194304"
		pulse.attr.tlength = "4000"
		pulse.attr.prebuf = "3682"
		pulse.attr.minreq = "320"
		module-stream-restore.id = "sink-input-by-application-name:QtPulseAudio:3834"

Now, at this point I could use either Pavucontrol or pactl to change the volume of that sink, and it will work. But, in order to make this volume change persistent, the application.name (or node.name, can't quite remember which one) property must be permanent across app restarts, and that's currently not the case with RSS Guard. Once I re-open it, both the application.name and node.name properties will have changed:

pactl list sink-inputs
Sink Input #55
	Driver: PipeWire
	Owner Module: n/a
	Client: 66
	Sink: 41
	Sample Specification: s16le 1ch 8000Hz
	Channel Map: mono
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "8000"  format.channels = "1"  format.channel_map = "\"mono\""
	Corked: no
	Mute: no
	Volume: mono: 65536 / 100% / 0,00 dB
	        balance 0,00
	Buffer Latency: 0 usec
	Sink Latency: 0 usec
	Resample method: PipeWire
	Properties:
		client.api = "pipewire-pulse"
		pulse.server.type = "unix"
		application.name = "QtPulseAudio:25341"
		application.process.id = "25341"
		application.process.user = "gui"
		application.process.host = "arch"
		application.process.binary = "rssguard"
		application.language = "en_US.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "666ea98c44e04f4290ca90b2c054fc45"
		media.name = "QtPulseSample-25341-94558343277376"
		node.rate = "1/8000"
		stream.is-live = "true"
		node.name = "QtPulseAudio:25341"
		node.autoconnect = "true"
		media.class = "Stream/Output/Audio"
		adapt.follower.node = ""
		object.register = "false"
		factory.id = "6"
		audio.adapt.follower = ""
		factory.mode = "split"
		library.name = "audioconvert/libspa-audioconvert"
		client.id = "66"
		object.id = "55"
		node.latency = "1680/8000"
		pulse.attr.maxlength = "4194304"
		pulse.attr.tlength = "4000"
		pulse.attr.prebuf = "3682"
		pulse.attr.minreq = "320"
		module-stream-restore.id = "sink-input-by-application-name:QtPulseAudio:25341"

Hope I was able to explain it better now ^^

Thanks!

@martinrotter
Copy link
Owner

OK, implemented:

image

I added independent volume control to each notification type and as a bonus notifications now can play MP3 sounds and even can play sounds from internet directly - see picture.

@martinrotter
Copy link
Owner

Test with latest dev. build once it compiles and let me know.

@martinrotter martinrotter added Status-Fixed Ticket is resolved. Type-Desktop-Integration Application badly integrates into used desktop environment. labels Sep 7, 2021
@martinrotter martinrotter added this to the 4.0.2 milestone Sep 7, 2021
@guihkx
Copy link
Contributor Author

guihkx commented Sep 7, 2021

As always, thank you so much for the quick implementation <3

I wasn't able to test with the latest AppImage, it's probably missing some library?

$ ➜ ./rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage 
time="     0.074" type="warning" -> core: Qt localization 'en' WAS NOT loaded successfully.

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GLib-GObject-CRITICAL **: 12:50:27.812: g_object_set: assertion 'G_IS_OBJECT (object)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_object_ref: assertion 'object != NULL' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_ghost_pad_new: assertion 'GST_IS_PAD (target)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_element_add_pad: assertion 'GST_IS_PAD (pad)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_object_unref: assertion 'object != NULL' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GLib-GObject-CRITICAL **: 12:50:27.812: g_object_set: assertion 'G_IS_OBJECT (object)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_object_ref: assertion 'object != NULL' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.812: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.813: gst_ghost_pad_new: assertion 'GST_IS_PAD (target)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.813: gst_element_add_pad: assertion 'GST_IS_PAD (pad)' failed

(rssguard-devbuild-6e10be3c-nowebengine-linux64.AppImage:1851): GStreamer-CRITICAL **: 12:50:27.813: gst_object_unref: assertion 'object != NULL' failed

These assertions pop up whenever I click to play the notification audio in Settings.

@guihkx
Copy link
Contributor Author

guihkx commented Sep 7, 2021

Tested on a local build and it worked. Thanks for the amazing work!

@martinrotter
Copy link
Owner

@guihkx Well, this is potential clusterfuck:

probonopd/linuxdeployqt#96
probonopd/linuxdeployqt#123

I will try to include relevant libs into appimage. Also, it may be enough if you just install those packages. What is your distro?

@guihkx
Copy link
Contributor Author

guihkx commented Sep 7, 2021

Ugh. That seems complicated...

I'm on Arch Linux, already have gstreamer installed...

@martinrotter
Copy link
Owner

martinrotter commented Sep 8, 2021

@guihkx Can you try latest dev. build? There are some changes and now on Ubuntu the appimage works. Not tested other distros.

EDIT: Confirm it does not work on other distros.

@martinrotter
Copy link
Owner

@guihkx OK, now all gstreamer plugin libraries are copied into AppImage so sounds should work on all distros out-of-box.

Testesd with KDE manjaro and kubuntu. Works. AppImage is a bit bigger (+30 MB) but should work much better.

Please test and report back. :)

@guihkx
Copy link
Contributor Author

guihkx commented Sep 8, 2021

Worked just fine on Arch too! :)

Thanks for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status-Fixed Ticket is resolved. Type-Desktop-Integration Application badly integrates into used desktop environment. Type-Enhancement This is request for brand new feature.
Projects
None yet
Development

No branches or pull requests

2 participants